May 7th, 2009 | Ekerete
I have had to downgrade my copy of the Zend Framework to 1.7.8 after 5 mins of ‘upgrading’ to 1.8.0 to get access to all the promised goodies (Zend Tool, Zend Application, Zend Navigation, etc).
Unfortunately, Zend_Loader::registerAutoload has been deprecated and I got notices all over my screen. Considering we are working on multiple projects in Zend Framework and we all have local copies I didn’t think it was such a good idea recommending this upgrade to the team especially with deadlines looming really close.
However, I don’t think I’ll be missing any of the new additions considering the hassle involved in using them. Why must everything be so complex in ZF? I copied over the CLI tool for a test run but even that refused to run probably because I had an earlier version of the framework. I really want to love ZF (not that I have a choice, anyway) but with every new feature I think is cool comes the ‘why do I have to do all this to use it?’.
I had a look today at the Zend QuickStart to see if it had been updated to use Zend_Application and it has. However I still can’t figure out how this ‘new’ (more complex) way of setting up my application has any advantage over the ‘old’ way. I think I’ll stick with Jara. Furthermore, the ‘QuickStart’ is not really quick at all. What happened to the good old days when we built a blog in 20 mins without writing any code? Instead what we have is setting up cli tools, writing classes to initialise my app and an introduction to the Data Mapper, the most complex of Martin Fowler’s database access architectural patterns. I thought the quickstart was meant to sell the framework. This isn’t doing a very good job.
I’ll probably feel better tomorrow and get everyone to upgrade but for now I guessed I’m pissed I can’t use the new stuff. However the truth still remains that ZF is not for the ‘lazy’. To use it well you’ve got to work hard and for a RAD tool that’s an irony.
Posted in Zend Framework | 2 Comments »
April 21st, 2009 | Ekerete
I spent a couple of hours last weekend going over a Rails app I wrote almost two years ago. It was the very first Rails application I had written (apart from the follow-the-screencast throwaway ones) and I couldn’t help cringing when I saw the code I got paid good money to write.
That app is still my most ambitious project ever and I’m still shocked I decided to do it in Ruby (a language I barely knew) and Rails (after playing with it for a few weeks) when I had a couple of years experience in PHP and some production apps already running on CodeIgniter. I guess it was the hype.
However, almost two years later and the app is still running smoothly (I had to tweak it a bit over the weekend). I am still not sure I would have taken on the project – an internal stock trading app with a social angle to it (I was freelancing then and working alone) if I had to do it PHP but in retrospect it would probably have been done better in PHP. I’d have had less fun though.
Rails is so deceptively simple it makes you feel you’re a superstar programmer even when you just have a couple of lines of code under your belt. However, after working with it for a while, you start to appreciate how complex it is to get things done when they don’t fall into the Ruby on Rails sweet spot. I wouldn’t have it any other way though. When it rocks, it really rocks.
I currently use PHP (and the Zend Framework) at work and I have come to appreciate the flexibility of ZF but I wouldn’t recommend the framework for programming beginners. Using a lot of the components requires a good grasp of programming concepts and compared to Rails where components are written for specific use cases, with ZF, you have to come up with yours. I am currently still trying to figure out where I can use Zend_Navigation in the recently released version of ZF. I know it will come in useful but I just have to tweak and flesh it out to make it work for me and that pretty much sums up the ZF-Rails differences quite well. One makes you think you can without even trying while with the other, you know you can but you’ll just have to work at it.
Posted in Rails | 3 Comments »
April 17th, 2009 | Ekerete
I just spent last weekend setting up a new slice at SliceHost (my bestest host ever) for a couple of Rails apps only to read this post announcing the release of Phusion Passenger for Nginx.
Considering I only needed the slice for Rails (No php and the DB is on another slice), I could have gone with Nginx except that I’ve been spoilt by Passenger’s upload-and-go deployment and being able to squeeze more apps into a small VPS (the inactive ones shut down and release memory). Now hopefully, it’s the best of both worlds.
I’ll still have to learn Nginx quirks considering I’ve always used Apache but the promise of faster page serving and a lower memory footprint is motivation enough.
Kudos to the guys at Phusion for their awesome products (I also use Ruby Enterprise). Congrats on your anniversary and a lot more power to your elbow!
On a related note, I learnt the hard way that Rails 2.3 and an old version of Passenger don’t mix very well.
Even after updating the passenger gem I couldn’t get Rails to load. The solution is to re-install the passenger module (passenger-install-apache2-module) and update your apache config file. Hope that helps someone as I spent a bit too long trying to fix it.
Posted in Rails | 1 Comment »
February 1st, 2009 | Ekerete
I use RedGreen when working on rails projects and have gotten used to the visual feedback I get when tests pass or fail. It has definitely helped with my Red-Green-Refactor flow.
I just found out phpunit supports colors in tests and it’s built-in as well. No gem installation required. Sweet!
Turning on colours is done either with a command line argument or by adding an attribute to the phpunit XML configuration file.
Command Line:
phpunit --colors testfile.php
XML File:
<?xml version="1.0" encoding="UTF-8"?>
<phpunit colors="true">
<testsuite name="All Tests">
<directory>./</directory>
</testsuite>
</phpunit>
- No Colours:

- Passing Tests – with colours:

- Failing Tests – with colours:

- Skipped or Incomplete Tests – with colours:

Posted in PHP | No Comments »
January 21st, 2009 | Ekerete
I recently had to set up a Zend Framework project at a friend’s house and realized how reliant I am on Zend Studio to set up a fresh project. Meet Jara Base – the ZF starter app and my solution to this minor issue. It’s essentially a slightly modified version of the Zend Studio project structure with the following variations/additions:
- Added a test helper to the tests folder.
- Added a static route plugin for handling static site pages.
Usage
Adding static pages
Most applications have pages for static content e.g. an about page, a contact page, etc. I prefer my static pages without the controller name and the ‘page’ route removes the need to add the controller name to the url. Jara Base already includes an about page with a corresponding view and this page is accessed with ‘http://www.example.com/about’ rather than ‘http://www.example.com/index/about’.
To add a static page, add an action to the ‘Index’ controller of the ‘Default’ module. Add a corresponding view and the page will be available at ‘http://www.example.com/:action’.
Static routes with the same name as your controller actions are created by default.
To disable static routes, comment out (or delete) the static routes line in the plugins section of the application config file (application.ini).
Posted in Zend Framework | 6 Comments »