Welcome Guest, Not a member yet? Register   Sign In
MVC Code Optimization
#1

[eluser]Gonzo2[/eluser]
Hello Igniters,

I would like to know the optimized way of using MVC. As per my understanding, the Model should consist of all functional and logical computing, where as the View should be graphical representation with basic computing and Controllers should be used for making calls, callback, references and triggers etc.

I have read on some blogs and tutorials that Model should be used only for database handling, which to me doesn't seems appropriate. Models are meant for computing and Controllers for environment handling and should have a slim profile, cause the name is self explainatory and about Views they are for creating views.

Now, about my practice, my Models are fully loaded, portable and irrespective of controllers and Controllers are all slim profile with environment handling, if I do all functional and logical computing in the controllers then too much of code duplication will be there and no reusable codes. Technically stuffing both Model and Controller is possible, but the optimization is the key.

After reading that blog and tutorial posts I am a bit confuss now, am I doing it the right way or am I wrong on the approach!

So, all Igniters in here, which is the right and optimize way for coding MVC.


Gonzo
#2

[eluser]InsiteFX[/eluser]
You will get different answers to this question!

My way:
Controllers - are like switchboards that handle the input and output data
Models - Model the real world problems, business logic and database handling
Views - for Presentation

Just my opinion!

InsiteFX
#3

[eluser]Gonzo2[/eluser]
InsiteFX your way and my way are similar. You treat Controllers as switchboards and I was referencing it as environment handling same way what comes in and what goes out. About Models you said for business logic and database handling, I mean the same and referenced it as functional and logical computing. View again same thoughts you said as presentation and referenced it as graphical representation with basic computing. Thoughts are same, but way of expression is different.


I was scratching my head, where that Model only for database handling came from. Now I am relieved that I am not the only one who thinks that way.

Thanks for sharing.

Gonzo




Theme © iAndrew 2016 - Forum software by © MyBB