I’ve said it before that I am not a fan of php-development, however from time to time I have to look and manage also php-code. Few weeks ago I was asked to save a project made for small business which was never really finished as the company responsible for the project went belly up and the new company these guys started would not finish the project without additional dough. As far as I know the project was a horrible mess from the start as the company promised to deliver for little over 6 thousand euros web content management system, web shop, customer management system and other features on top of that.
Underselling your projects is not a crime and it is possible that these guys really thought that they could do everything so fast. However it is clear that these guys did not really understand customer’s requirements nor the business for which they were building their custom software. Customer’s personnel were all novices in technology themselves, so they did not know better or suspect anything, as for their business those few thousand euros are a lot of money.
As I downloaded the source code from webserver I feared for the worst as the project could be made by total hacks and under the hood I might get to see almost anything imaginable. To my surprise code was rather clean and easy to understand, even though there were few things that got my eye. First of all these guys did not use any existing MVC-framework, but rather they had decided to implement their own and use Smarty-templates. You can argue against Zend Framework or Codeigniter saying that you can create more compact implementation from scratch, but you also know that it is rubbish. By inventing the wheel again you put much more cognitive baggage to next programmer, who has to figure out what and why you were doing something like that – instead of just focusing solving business needs. And naturally there is no documentation what so ever.
Going through the data model from the database I figured out that I could implement missing back office features as long as I would not need to touch the legacy code too much or implement new features on top of it. So to solve this problem without putting my hand too far into rubbish I decided to just apply band aid bug fixes to the legacy code and implement missing features on top of solid tools and well known and documented frameworks.
My selection was Zend Framework for MVC and DAO in php and Flex framework – with Cairgorm MVC-framework – for UI. This combination allows me to model dao and services neatly in Zend Framework and connect Flex-frontend to the php backend with Zend AMF-module. Flex framework allows me to build rich UI in drag and drop fashion, binding ready made data components to the php-backend through simple scripting. Cairgorm framework keeps code neatly organized and makes sure I’m not even trying to create spaghetti code.
And when I finish up everything by documenting the used datamodel and how the code works in principle, I have cleaned up a mess that has caused problems for this small company and hopefully allowed them to get at least some value out of their investment. It is such a shame that companies need to learn the hard way that the cheapest offer is most likely not the best one.