Library Vs Model |
[eluser]Peng Kong[/eluser]
here's the way i see it. models do all the database talking (data in and out)... no one else does it. view contain all the presentation (html, css, js)... no where else contains it. i think this way of looking at models are views are pretty similar from developer to developer. controllers functions 'map' to one or more views. They determines which view to show based on "your logic" which determines on the flow. "your logic" that is specific to that controller's function stays in the controller. "your logic" that is 'across the board' (aka reusable) goes into libraries, helpers and plugins. Libraries, as mentioned, contains "your logic" which is reusable to many parts of your application. Libraries can make use of helpers and plugins. Helpers are just simple, useful, reusable, standalone functions. Plugins are many related functions and help achieve a common purpose. They are strictly standalone (no dependency). Plugins have a clearly defined interface for you to call anywhere in "your logic". --- However, i'm finding that even after doing all that, you will get to a stage where complex applications have too many views, models and controllers. Things start to get messy and you ask yourself, "How do i group up related views, models and controllers into folders... rather then just ONE folder for ALL the views, ONE folder for ALL the models and ONE folder for ALL the controllers". There's where Modular Extensions by Wiredesignz comes into play. After using Modular Extensions, i prefer to put more module logic into controllers and application logic into libraries (for other modules to use). maybe i don't know better but i feel this is a flexible D.R.Y. approach. |
Messages In This Thread |
Library Vs Model - by El Forum - 02-01-2010, 03:36 PM
Library Vs Model - by El Forum - 02-01-2010, 07:28 PM
Library Vs Model - by El Forum - 02-01-2010, 07:35 PM
Library Vs Model - by El Forum - 02-01-2010, 07:37 PM
Library Vs Model - by El Forum - 02-01-2010, 07:42 PM
Library Vs Model - by El Forum - 02-01-2010, 07:57 PM
Library Vs Model - by El Forum - 02-01-2010, 08:08 PM
Library Vs Model - by El Forum - 02-01-2010, 08:14 PM
Library Vs Model - by El Forum - 02-03-2010, 08:43 AM
Library Vs Model - by El Forum - 02-05-2010, 04:35 PM
Library Vs Model - by El Forum - 02-06-2010, 12:19 AM
Library Vs Model - by El Forum - 02-11-2010, 08:46 AM
Library Vs Model - by El Forum - 04-04-2012, 07:40 PM
Library Vs Model - by El Forum - 04-04-2012, 08:13 PM
|