February 28, 2008

who needs globals?

Filed under: ZenMagick — DerManoMann @ 3:48 am

One thing that always annoys me in the curren ZenMagick is the number of globals. In particular the pre-instantiated service classes are a nightmare and use up resources whether they are used or not.

To remedy this situation it is worth to question why they are acutally created?

  • Early on I created this convention/contract that all services are ready to use - no need to create objects, etc
  • All services are singletons
  • I didn’t know any better

A recent project involving CakePHP allowed me the time to investigate the CakePHP sources (to a degree) and see some quite impressive code. Compared to that my code looks a bit old fashioned :O

So, I will take some of what I have seen, some PHP5 features (static methods, for example) and hopefully get rid of them!

Template changes will be very simple and I hope to have some sort of migration tool, but that is still open (right now I am not even 100% sure what the actual implementation will look like ;)

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

You must be logged in to post a comment.