[pLog-svn] Some programming questions?

howard chen howachen at gmail.com
Tue Mar 4 21:20:07 EST 2008


On Wed, Mar 5, 2008 at 4:16 AM, Jon Daley <plogworld at jon.limedaley.com> wrote:
> How do you set the _provider variable in your example?  A global?
>

Why not? a Users or Blogs classes should always be the same during
their life, no matter you create it during action, or view.


>  There are some classes that could be treated as singletons, and perhaps
>  Users is one of them, I think you would have to be careful in applying the
>  "static principle" across the board, because I'd expect that sometimes the
>  class objects are meant to be used and thrown away, and not influence
>  other people instances of the objects.
>


One of the reason is reuse, sometimes we need to create a User class
in Action, sometimes in View (or maybe you can pass the reference to
view), Plugin developers might also need Users and they create their
own.

This lead to performance slow down, more memory usage and more LOC
(line of codes), with static class, caching is even more easy.

Howard


More information about the pLog-svn mailing list