• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Starting with CodeIgniter setup: suggestions & best practices

This is in part about the way EllisLab implemented the MVC pattern, dealing with PHP that doesn't act like a normal application that keeps going but a scripting language that needs an entirely new process on each pageload.

That being said: As I learned it models are or contain instances of objects that represent the data you're working with. And as such models are never abstract and always deal with a specific object or list of objects on which they perform CRUD operations or other manipulations (like you mentioned).

While it is sometimes a good thing to keep libraries non-application specific, libraries are in essense toolboxes that deal with specific functionality and quite often with instances of models. Because of that you'll sometimes need to make your library application specific (or at least dependent on specific models) and there's nothing wrong with that.

The main difference is that models are for logic pertaining to 1 specific type of object representing actual information in your system, while libraries are meant to work with one or multiple objects together. An auth library for instance will work with specific users (a user model) and specific acl rules (an acl model) and aswer the question if access is allowed for a certain input.

EDIT: All of what I said is compatible with your quotes from wikipedia. That's what's meant by "the model is the domain-specific representation of the data".

Messages In This Thread
Starting with CodeIgniter setup: suggestions & best practices - by El Forum - 04-19-2010, 09:59 AM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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