Monday 11 May 2009

Getting Out Of The Browser

If you hang around the programming threads of Nairaland.com you will notice that majority of the programmers are web developers. The reason for the preference for web/PHP development by Nigerian developers varies a lot. But one argument that keep recurring (especially on Nairaland) is that PHP is pretty easy to learn and get up and running with.

I've done a little bit of web development with PHP, but most of my programming experience is in developing standalone programs (compiling source code to binary the old fashioned way).
Based on my experience with both web and standalone app development I am of the view that, contrary to popular assumptions, developing standalone programs is much easier.

I find it really difficult (though not impossible) to maintain an elegant code when mixing PHP and HTML. Though there are ways around this like templates but that doesn't compare with coding in C++ or C# in terms of maintaining an elegant and clean source code.

Another major frustration one gets is in maintaining state. Because the web is a stateless environment, one needs to use tricks like hidden fields or cookies to pass data across different pages. The same can be achieved in conventional programming using public variable or passing values through method parameters.

Debugging PHP applications is like running backward up a hill. Apart from the absence of a debugger (as far as I know) one cannot use the old trick of printing to console. Because there simply is no console but a web page. I know that the Zend Studio comes with a debugger but one has to cough out more than $1000 to buy it.

I remember talking to a web developer friend telling him about the Firebird open source database management. I told him that the Firebird engine can raise events which you can handle in your client application through a call back function. Suddenly my friend became lost and asked me to explain again. After explaining for the second time without him understanding me, I remebered that my friend is strictly a web developer and doesn't know what events or callback functions are.

He doesn't really know how much he has been missing by living all his developer life in a web browser. When I compare him with most of my team mates who can develop both for the web and non-web platforms I see them like super heroes that can get in and out of the browser at will.

What most web-only developers do not know is that it doesn't take much to get out of the browser. With their existing PHP skills picking up a language like Python, C# or Java will be much easier than they imagined. It should not be forgotten that the web was primarily design to be a presentation medium and that any other functionality is an after tought. This therefore makes it very difficult to squeeze some solutions through a web browser.

I think the right thing to do is develop web apps for problems that are based solved by web apps and standalone apps for problems that are best solved by standalone apps. But how do you know when to use what ? You need to experience both worlds. So if you are a web-only developer try getting out of the browser for once. I bet you'll never regret it.