Recently, I was tasked with the job of porting a PHP application over to an environment without any previous PHP installation. How hard could it be, right? Set up the Web root for the application files and install all the prerequisites – piece of cake!
Not so much as it turned out. Because the old environment was running in a pure LAMP setup and the target environment was Windows, SQL Server, and IIS, virtually nothing worked and there of course were no easy replacements for the required frameworks and drivers.
So instead, I took it upon myself to rewrite the app using ColdFusion, our application server of choice. Since the front-end was not going to change, I was able to reuse the existing HTML (minus embedded PHP code), CSS, and JS files pretty much as they were. Only the PHP code remained. The original vendor had used the CodeIgniter and PHP ActiveRecord frameworks to code the app yet all the data that was brought in from the database was done so at first request and then ran in the user’s browser memory. Why then, use an ORM such as ActiveRecord? A read-once and never-write use certainly wasn’t made any easier by using the framework. Perhaps the vendor simply was what Joel Spolsky refers to as an “Architecture Astronaut”, always using technologies like these even when they aren’t really required. As for CodeIgniter, all I could figure out (being a non-PHP programmer) was that it took one page of code and turned it into twenty for no good reason.
Slowly I worked my way through the desired logic and recoded the back-end services in ColdFusion and what I ended up with was shocking.
The PHP and framework code that was delivered to me totalled 416 files, 99 folders, and 12.2MB of space.
What I wrote, no frameworks used (or required really), fully duplicating the functionality of the old app, amounted to 12 files, 2 folders, and a stunning 72KB(!!) of space.
Somehow, all those frameworks made a simple site incredibly complicated and I’m certain they didn’t make the developer’s lives much easier. Given the time it took the vendor to deliver the site in the first place, it certainly didn’t make them any faster.
I’m sure there’s a time and place for pre-written frameworks and design patterns that have abstracted reality to the n-th degree, but sometimes you just have to write some code (shoot from the hip coding as it were) because that’s all that’s required. And the space and time savings can’t be ignored either. Also, because I didn’t have to install PHP and countless other dependencies on my servers, the administration of those machines has been kept simpler and therefore more secure.
Sometimes I wonder if the big minds of programming over the years, giving us OOP and then ORM’s and design patterns, abstracted things to such a degree, they forgot what the original goal was (write a bunch of code that solves a problem for a business) and got caught up in their own cleverness. There are times I just shake my head and what I’m hearing or reading and wonder who pays these good folks to sit around and think up some of this stuff instead of being, you know, productive!
Here endeth the rant. Anyone who reads this will probably flame me for being an ignorant savage who still uses GOTO’s in their code, but I see myself as someone who uses the right tools for the job. Maybe I am a dinosaur, but I still solve problems for my customers quickly and I’ve never heard any complaints about my solutions being unmaintainable – except from the Architecture Astronauts of course.