Welcome Guest, Not a member yet? Register   Sign In
design philosophy: helpers,libraries, and bears oh my
#1

[eluser]fivestringsurf[/eluser]
This is NOT my first week using CI and YES Ive read the documentation (flow chart, mvc, helpers docs., etc...)

I just wanted to get some feedback on some of you more experienced developers on how you choose to separate your code. It seems I get stuck between what becomes a library and what becomes a helper(amongst other things). I keep redeveloping my work and keep switching reasons to do so...sometimes even models get dragged into the confusion.
------------------------------------

Right now here is how I choose my separation:

Libraries: Anytime I am extending CI core /or/a large class of my own such as login/log out routines.
Helpers: Things that I would normally use "include()" for. smaller code for say an html form that I use repeteadly.
Models: database connectivity divided up into C.R.U.D folders I try to have all my models simply return the object they fetched and nothing more...that makes my controller have a bit more code/formatting results but I always know what to expect from the models.

---------------------------------------
I try to have all calls to models,helpers, and libraries from controllers only; that way I know where everything is coming from and don't have to chase down functions/methods; the only exception would be with one of my large custom libraries. It makes each controller a bit with conditionals (ifs/switch/etc...) but it becomes easier to read the code.

I noticed ci2.0 also has a "third_party" and "core" folder just to add to the perplexity.
----------------------------------------

I would appreciate some conventional wisdom in these regards.
What are your rules for separation?
helper: ?
library: ?
model: ?
???


Messages In This Thread
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 07:34 AM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 07:47 AM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 07:53 AM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 12:29 PM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 12:38 PM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 03:29 PM
design philosophy: helpers,libraries, and bears oh my - by El Forum - 02-24-2011, 04:18 PM



Theme © iAndrew 2016 - Forum software by © MyBB