• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Where to put plain object classes?

#40
You'll probably never find a satisfactory generalized answer to the question of which classes are libraries and which are models. I generally think of libraries as a location for things which tend to interact with multiple parts of the MVC pattern, or don't easily fit into the pattern. I also frequently use it for code which was not originally written for an MVC framework in the first place, or even libraries originally written for other frameworks, even if they are MVC frameworks.

Models I tend to use primarily for data access, whether the data happens to be in a database or some other form. I tend to put my business rules into models, but I rarely have reason to store the business rules separate from the model(s) which interface the data to which those rules apply. In many cases I also include methods in my models which allow those rules to be retrieved or executed by the controller (more often than not because it simplifies working with certain libraries in CI, like form_validation).
Reply


Messages In This Thread
Where to put plain object classes? - by geekita - 12-02-2014, 05:51 AM
RE: Where to put plain object classes? - by mwhitney - 01-05-2015, 01:25 PM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 05:18 AM
RE: Where to put plain object classes? - by Jamie - 01-06-2015, 03:08 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.