News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Reddit.com:
What exactly is 'model' in MVC?
June 20, 2014 @ 11:25:48

If you're relatively new to the world of the MVC (Model-View-Controller) design pattern and its use, you may be trying to figure out exactly what each piece is. One of the more difficult relationships is between models and controllers, more specifically what each are supposed to contain. In this discussion over on Reddit several people weigh in on their opinions and own suggestions about what models should be.

Sometimes I feel I should avoid session in model ... but sometimes I feel using session in controller is putting business logic in controller which is bad ... sometimes I feel I should avoid $_POST and $_GET in model ... but sometimes I feel receiving data in controller and then send all of them to model is an unnecessary move ... sometimes I feel one model should represent almost everything about one certain table ... sometimes I feel it's almost god pattern if that table is the core of your application, but separate the model into many model is confusing too since they are using the same table. I wanna be a Model Master who can explain 'Model' very well. Who can help me plz.

Comments on the post explain models in several different ways including:

  • Thinking of it as a representation of "domain" functionality
  • Models as a 1-to-1 relationship with database tables
  • The differences between them and collections
  • Links to some helpful libraries like Eloquent and Doctrine
0 comments voice your opinion now!
model mvc modelviewcontroller opinion definition

Link: http://www.reddit.com/r/PHP/comments/28luto/what_exactly_is_model_in_mvc/

blog comments powered by Disqus

Similar Posts

Rafael Dohms' Blog: The UG Rollercoaster

ThinkingPHP: Google Analytics PHP API (CakePHP Model)

The Bakery: Four New Articles/Components (Colors, Models, InotImg & CakeSWXPHP)

NerdMom Blog: Kohana 3 & CodeIgniter 2

Jani Hartikainen's Blog: A simple way to make your code better: Stop adding more parameters


Community Events





Don't see your event here?
Let us know!


developer framework wordpress language podcast list interview threedevsandamaybe configure laravel code library release introduction bugfix series community api application project

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework