Welcome Guest, Not a member yet? Register   Sign In
Libraries or Models, favouritism?
#15

[eluser]xwero[/eluser]
You are right you as a developer has the final say in what to use or not. You can start putting everything in the controllers and once you are seeing you are copying code you check if the abstraction doesn't create too much overhead (memory, execution time) and abstract the code into a library. If you see you are copying queries in your code you can put them in a model.

The difference between a model and a library is that the model library gets loaded by default which means it already knows the CI object and does a check if the model is already loaded or not. In a library you need to code this yourself.

The model library is created because it's a part of the MVC pattern the framework uses to make the code easier to maintain and reuse.

If you want to create your own model library no one will stop you. If you have your own DRY methods we want to know them it could be interesting to learn from.


Messages In This Thread
Libraries or Models, favouritism? - by El Forum - 02-25-2008, 08:28 AM
Libraries or Models, favouritism? - by El Forum - 02-25-2008, 10:41 AM
Libraries or Models, favouritism? - by El Forum - 02-25-2008, 10:46 AM
Libraries or Models, favouritism? - by El Forum - 02-25-2008, 02:59 PM
Libraries or Models, favouritism? - by El Forum - 02-25-2008, 04:54 PM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 01:33 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 01:43 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 02:13 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 02:24 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 03:05 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 03:20 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 03:34 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 03:42 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 03:50 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 04:26 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 08:08 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 08:40 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 10:23 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 10:33 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 11:34 AM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 01:01 PM
Libraries or Models, favouritism? - by El Forum - 02-26-2008, 01:41 PM
Libraries or Models, favouritism? - by El Forum - 03-29-2008, 10:14 PM
Libraries or Models, favouritism? - by El Forum - 03-29-2008, 10:26 PM
Libraries or Models, favouritism? - by El Forum - 03-29-2008, 10:30 PM



Theme © iAndrew 2016 - Forum software by © MyBB