I’ve seen a huge number of frameworks lately in my travels around the Internet. I’ve played with CakePHP, symphony, and Ruby on Rails (which, for some reason, I keep spelling with a z at the end…it just feels right). My friends have been telling me to learn a framework. They swear that it makes web development infinitely easier and that I’ll “never go back”.
Before I receive a flurry of emails, let me clarify: frameworks have their place in the world of software. Here’s where frameworks have their place (basically the same place object oriented code belongs, seeing as how myself and Paul Graham are of similar opinions in this regard):
Large companies — places that have literally dozens of programmers working on the same system. Specifically, situations in which someone could be using massive pieces of code which they have no part in writing. Then large portions of code can be changed while minimizing changes to links between code.
I’m sure someone is thinking “but Brian, everyone has to pass on their code to someone else eventually, and frameworks are well documented and easy to learn.” To that I have a story:
Most new engineering interns at Yahoo! are given one task for their first week (after the day-and-a-half of orientation): setup their dev box. This is an initiation of sorts, they must deal with various dependencies and using some proprietary tools. Why? So they become accustomed to Yahoo!’s systems and code structure. And it works. Give someone bitch work for a week and they’re forced to sift through the code. It’s like an initiation of sorts.
Anyway, back to my point: Frameworks are not necessary and actually hinder the creative process. Let’s look at the selling points of frameworks (and my counterpoints):
- They keep code organized/make modifications easier — So do include files
- They’ll get you up and running faster — Sure, most frameworks make some assumption that you want some CRUD setup and will provide it with no or few additional settings. But what if you want to completely customize this setup? You have to rewrite it. Even for startups, this is a waste. They say less than 20% of a programmer’s time is spent writing actual code. Why do we need to save the 5 minutes it takes to throw together a basic crud framework and then copy/paste it a bunch of times, just to spend half an hour rewriting things later when we need to customize?
- What do I use to make a crud system? I wrote a function-based CRUDer (Note: I just cleaned this up a tiny bit to link to here…let me know if things are broken). All it does is generate a bunch of SQL functions and such, nice and simple. Could I have added a ton of extra features? Sure. But the point is to get you running, have a generic setup and let you modify the hell out of it. You shouldn’t have redundant code, you should have functions anyway. The one thing I would consider doing is putting in one function that will debug SQL queries to avoid that redundancy, but nothing more. I must have rewritten a table sorting setup a dozen times, but each time it was slightly different, and rightly so.
That’s it, I can’t think of a single additional benefit to generic frameworks. In addition, while I am the last person to advocate security through obscurity as primary protection from attackers, if your code is well-written, then it’s probably as secure, if not more, than a framework simply by virtue of the fact that yours isn’t public (open source projects: ignore this sentence).