Welcome Guest, Not a member yet? Register   Sign In
Models, where, when and why?
#3

My two cents (as I've been having some "completely redesign the application" thoughts this morning)... And spent some time reading about "design patterns".

Compared to you, Thyrosis, I don't use many libraries in a project, (mostly) just for stuff, that I really now I will reuse and is application independent - like email, ACL for user based applications (as I use my own), for example a "config" library (used for user changeable configuration)...

And as far as I understand (correct me if i'm wrong), basic MVC pattern is a "funny" beast, as it is pretty old (before the web, modern applications...), so the M is nowadays not used just for data retrieval but for a lot more.

I use the CI Model in this way:
- To retrieve the data and return it to the controllers
- To manipulate/change/convert the data so it's usage is simple later on
- To check consistency or "logic" like so: "if row X in A does not exist, do not insert into row X into B" or "if X exists then update Z,Y,W" and at the same time (where constraints are not set in the DB) to check and keep consistency of data
- And in some cases, I call some library's methods and functions to again, return data which can be simply used in controllers (and later, views).
- I do try to keep controllers as slim(er) Smile (but when I started with CI, this was not the case, I did everything in controllers and used models exclusively for data retrieval)

I have to say, your approach, using mainly libraries, has some benefits...
Anyways, as for the libraries, I second Rufnex - they should be written in a way, that they are depended only on "themselves", so no models needed...
Reply


Messages In This Thread
Models, where, when and why? - by Thyrosis - 10-24-2014, 12:03 AM
RE: Models, where, when and why? - by Rufnex - 10-24-2014, 02:39 AM
RE: Models, where, when and why? - by navotjer - 10-24-2014, 04:10 AM
RE: Models, where, when and why? - by InsiteFX - 10-24-2014, 04:44 AM
RE: Models, where, when and why? - by kilishan - 10-24-2014, 08:17 AM
RE: Models, where, when and why? - by Thyrosis - 10-25-2014, 02:16 AM
RE: Models, where, when and why? - by John_Betong - 10-24-2014, 10:04 AM
RE: Models, where, when and why? - by Hobbes - 10-29-2014, 06:41 AM
RE: Models, where, when and why? - by jlp - 10-29-2014, 08:50 PM
RE: Models, where, when and why? - by albertleao - 10-30-2014, 11:41 AM
RE: Models, where, when and why? - by InsiteFX - 10-30-2014, 04:28 PM
RE: Models, where, when and why? - by Thyrosis - 11-01-2014, 01:27 AM
RE: Models, where, when and why? - by alroker - 11-16-2014, 11:55 AM
RE: Models, where, when and why? - by Thyrosis - 11-18-2014, 05:51 AM
RE: Models, where, when and why? - by RobertSF - 11-20-2014, 08:19 PM
RE: Models, where, when and why? - by veedeoo - 11-17-2014, 09:04 PM
RE: Models, where, when and why? - by bclinton - 11-17-2014, 09:32 PM



Theme © iAndrew 2016 - Forum software by © MyBB