My job lately has been an interesting mix of grunt work and cool new stuff. The former is inescapable and has to be done, but I obviously enjoy the latter a bit more. One item I’m relishing is finally getting my hands dirty with the Zend Framework. A little background first…
The writing on the wall
I’ve been programming in PHP for more than five years and I’ve coded some rather large projects completely by hand and from scratch. I sort of take pride in that I suppose, but I also realize it’s not a very sustainable way of working… especially in a fast-paced environment like a newspaper. Sure, I’ve built up a library of reusable functions and classes, I have my own standard file structure and naming conventions… the whole nine yards. But my own methods have a couple of significant drawbacks. The first problem is that things start to get unwieldy when a project grows to about 30 or 40 different views. This may not be a problem on most projects, but scope creep is always lurking and software has a tendency to expand over time. The second problem is that my methods are rather ad hoc and difficult for other people to fully grasp without a lot of time spent getting up to speed. This is probably very similar to how I feel when I inherit somebody else’s wacky code base.
A better way
So I started looking around for something that would be more scalable and that would adhere to some widely accepted architecture… probably MVC. At the same time, I didn’t want a solution that was all-or-nothing. On small projects I wanted the freedom to cherry pick what I needed from a framework and jettison the rest. Obviously that disqualified most of the usual suspects like Ruby on Rails, Django, CakePHP, Symfony, etc. I decided to give the Zend Framework a spin and see what I thought.
Last week I started testing the waters and using a few classes like Zend_Config, Zend_Db, Zend_Mail, and Zend_Validate. My original intention was to dip my toes in the water, but I ended up just going ahead and jumping in with the full MVC framework and the whole shebang. It’s a relatively small project (for now) that is completely scoped out and technically very feasible. The deadline is Thursday (yeah, this week). Despite my 5+ years with PHP, I’ve never done anything with an MVC architecture so I’m reading pages and pages of documentation online and figuring it out as I go. Fortunately the docs are good and the ideas are fairly intuitive once I get my head around them.
It’s strange to feel like a newbie again, but that’s what Web programming is all about: constant learning and adaptation. Stop learning and the Web world will pass you by in a hurry. Anyway I should have quite a bit more to report later this week. Wish me luck. If nothing else, it will be educational…