you might want to look up some of the materials presented as arguments
under: "design by responsibility", and David Parnas original writings
on cohesion and coupling (i.e. his 1972 paper) -- I think Wikipedia
entry on him gives a fairly good, generic overview w/ links. For
design by responsibilit
On May 4, 1:26 pm, canna wrote:
> so how would you share functions between controllers easily? without
> passing global objects to the functions all the time?
Functions in a module should really only have access to identifiers
and namespaces within that module; hence passing "db" as an argument.
On May 4, 2010, at 4:26 AM, canna wrote:
> Thank you for the answer
> so how would you share functions between controllers easily? without
> passing global objects to the functions all the time?
> is the only way is to bundle it all in one class that will be
> initialized with the 'db' variable?
>
It is your choice. In any language when you use functions in modules
you have to pass variables to them.
I like the idea of instantiating a class. That is how Auth, Crud and
Service work too.
On May 4, 6:26 am, canna wrote:
> Thank you for the answer
> so how would you share functions between con
Thank you for the answer
so how would you share functions between controllers easily? without
passing global objects to the functions all the time?
is the only way is to bundle it all in one class that will be
initialized with the 'db' variable?
or there is other way?
On May 4, 1:49 pm, mdipier
A module is a module. You can import stuff form the module but the
module will not see variables defined in the calling environment.
In the module you can defined a function that takes db as parameter,
import the funciton and call it with the db instance. You will have
the problem not just for db,
6 matches
Mail list logo