Yelotofu

Yelotofu ~ “In building standards compliant sites we are creating a better Web for the future.”

Archive for August, 2007

The Convergence of Language

I always get a sense of Déjà vu when switching between programming languages. It may just be me and the languages I'm familiar with but it feels as though the popular web languages are converging; not only in the syntactical vein but also in methodology and approach. All are moving towards Object Oriented Programming (OOP) and embracing Design Patterns.A few years back OOP was generally a skill software or Java developers had to prove proficiency in; nowadays it's a must have for web developers of any grounding. PHP, JavaScript, ActionScript, C#, Ruby and others all tout OOP adherence and advocate OOP style programming. PHP at version 5 has even been re-built on OOP principles from ground up.

OOP promotes modular based development; has a universally understood language, design patterns; and faciliates distributed programming. For seasoned programmers OOP is a godsend; but it's becoming ever more difficult for newbies to get a foot in the door. The learning curve continues to increase as the Web development world becomes more sophisticated and converges into full OOP.

In contrast this sophistication has lead to more frameworks and open source libraries coming to life; making life much easier for those who use them. Ruby on Rails (RoR) for example employs the MVC design pattern framework. The inner workings of RoR have been encapsulated so well developers do not think twice about concepts such as Data Mappers, Business objects, Presentation layer, Inheritance, Factories, Adapters, etc etc! It no longer matters for those using the framework because all the complexity has been thought through and handled by the clever people who created that framework.

It seems most developers are veering towards framework based application development. PHP alone has a ton of frameworks: CakePHP, Symfony, CodeIgniter, the Zend framework are but just a few. The good old days of inline spaggetti code and "one man built from scratch" sites are numbered; the spaggetti code days weren't even good anyway! Soon enough we'd all be using a framework or open source library of some sort to build all our websites.

Finally I should mention; the real reason I think frameworks are thriving is not because it dumbs things down for the rest of us but because clients are becoming more and more in tune with what's possible these days and want more for their money; yet continue to demand quick turnarounds. So a framework is good for reducing stress; and of course, easing the heavy leg work involved in building kick-ass web applications.

Clean URLs with CakePHP and IIS

CakePHP works on IIS out of the box but it's a pity the default setting is on querystring URLs. To serve clean URLs in CakePHP simply uncomment the following line in /app/config/core.php:

define ('BASE_URL', env('SCRIPT_NAME'));

By doing this CakePHP will direct each page request to the base script (by default thats index.php) and take charge of URL rewriting using the PATH_INFO environment variable.

This is ideal for serving CakePHP on IIS especially if you're not using Helicon Tech's ISAPI Rewrite and do not wish to fiddle about with configuring it or you're on a shared environment and cannot touch the IIS settings.

Your CakePHP URLs will now look like:

http://mywebsite.com/index.php/posts/view/10

Rather than:

http://mywebsite.com/index.php?url=posts/view/10