Archive for December, 2009
Quick code review of Expression Engine 2.0
Posted by Avi in Programming on December 29th, 2009
I just got a hold of the public beta of Expression Engine 2.0. I have been using Expression Engine 1.x for a number of years now, and I’ll admit, I wasn’t the most experienced PHP programmer at the time. It was probably the first large PHP program that I had ever used, and I was a little bit awed at how such a massively big OO program could be written.
Since then, I’ve improved my skills tremendously. I’ve learned about SOLID, and DRY. Dependency Injection and Test driven design. I’ve learned about domain modeling, and proper OO design. The code in EE 1.x is utter crap, of course! Global variables scattered everywhere. Copy & Paste style coding. Non-resuable components. No coherent API to speak of. Purely designed plugin system. Who could blame them, though. The code was written almost 10 years ago, in PHP4–with no intention of dropping PHP4 support.
I think I first heard about EE 2.0 almost two years ago. It was coming out that summer. Ever little bit of news that came out made me a little more gittier. It was going to be built on Code Igniter, an MVC framework. Boy was I suprised. Read the rest of this entry »
CQRS (Command and Query Responsibility Segregation) in PHP
Posted by Avi in Programming on December 10th, 2009
It always seems to me that the PHP world is one step behind the current trends in the “enterprise world”. For example, Rails popularized the “ActiveRecord” pattern a few years ago. Ever since then, there has been an explosion of ActiveRecord implementations in PHP. Many even mistakenly refer to them as an “ORM”, but I won’t beat a dead horse here. ActiveRecord is great for your basic run-of-the-mill address book/cookbook/blog type of app, where it basically data driven, and there’s not much “business logic” to go around. For the majority of PHP applications out there, these tools are a god send.
As PHP matures, especially the object model, advanced developers have started to realize the limits of this pattern. Now the big rage is the DataMapper pattern, and DDD. We try to separate out the domain of application, and the holy grail is now transparent persistence. With great tools like Doctrine 2.0 and Object_Freezer, both of which are only possible with the new additions in PHP 5.3, these dreams are becoming a reality.
Read the rest of this entry »