Sunday, July 29, 2012

The road (not) taken

One of the key issues when you are developing a product (as opposed to a custom-built solution) is that there is often no definitive guide that tells you the best route forward.

Consider a trip you are planning to take to a nearby, but unfamiliar, town. The destination is known; perhaps all avenues of travel have also been accounted for. But how sure are you that driving yourself from point A to point B is better than, say, hiring a cab, taking the bus or train or something else? Would it make sense to go from A to C before B, just because C to B might solve some future requirement of yours?

Therein lies the catch when you are working with something as wonderfully - and as infuriatingly - flexible as PHP. Having followed my own style for the past couple of years, it would be infinitely easier for me to start coding for ice-Labs the same way - knock off each module one by one, using my own filing, navigation and  processing systems - rather than spend (a lot of) time learning a new framework and then twisting my plan accordingly to execute it.

The catch, as I expect it, would happen later during the game when I will probably find myself redesigning the code as I go along, modifying it here and there; a bigger pinch would be the amount of time spent on re-coding for the same basic elements (anyone who's coded a form for updating an existing record knows the pain I am talking about!); further down the line, as the next-gen of my staff takes over the maintenance of this product, there must be a clear and coherent framework that's apparent to the slowest among them!

Contrast this with the implications of using a framework such as Yii or CodeIgniter. Most of my basic work is already taken care of, such as modelling the data, setting the flow of control, etc. With Yii, there is an even greater degree of automation that promises to make a lot of my work easier, a lot of it compressed into one-line commands that ties into the API of Yii. Salivating thought... until you realize that the price to be paid is reinventing the way you've usually done things.

That is not often a bad thing - and after all, hundreds of programmers around the globe would not be testifying for these frameworks if the promises remained unfulfilled. Yet, for every site built with frameworks, there are at least two or three or even five that are gloriously independent of any such 'box'... and in some cases, are the better for it. Do you really need to obfuscate your URL or make it searchable by SEOs and bots? For most applications where data security is paramount, the answer would be a resounding no.

There is a learning curve that is associated with the use of frameworks too. The time that you would have spent on re-coding/re-designing/re-using your work at a later stage, when doing it your way, is spent on picking up the rudimentary basics of the frameworks at the initial stages itself. And don't forget the hours that precede this step, hours spent on researching and comparing frameworks to arrive at the shortlist! (Often with no clear winners, GeekWorld being what it is - apples by any other name could be oranges still!)

The clincher for me was merely a matter of pragmatism. Pro-plan, slated to be the first release out of ice-Labs, is a small project in the larger scheme of things - and a large project in the smaller scheme of things. Had I done it my (complete) way, Pro-plan could have been live by now (except maybe for delays caused by Acts of God or my own sloth) - but learning something new is a price worth paying. Between CodeIgniter and Yii, the choice is surprisingly easy for a guy to whom one is as new as the other. Yii wins the vote for its scaffolding features and generators.

The road thus not taken is my own.

Will Yii be the Yiing to my Yaang? Only time will tell...

Till then... Yiip Yiip Yurray! :D

1 comment:

  1. Never thought that thoughts on a technical matter could be written down in such an engaging way. Yiikes, I actually enjoyed it! :D

    ReplyDelete