Frameworks, libraries and graphs
In his Serious Beard Talk, delivered at DjangoCon 2008, Cal Henderson explains how he thinks frameworks affect productivity. I would like to bring it up again, because it's still as relevant as ever, and it's hard to link busy software engineers to YouTube videos (of things that aren't cats).
A framework (or library?) exists to save you from doing common, repetitive tasks (he's thinking of things like mapping URIs to places, and reading and writing entities to the database) by providing a bunch of pre-existing code that'll do all this stuff for you:
- If you decide to write all this stuff from scratch, you're going to be spending a lot of time developing boring, repetitive code (but maybe you're still doing it better than other people?), and you're not going to be delivering anything fancy. Eventually, though, you'll get up to speed, and your well-understood, targeted framework/library will assist you in every way.
- If you pick the framework route, it takes you a short amount of time to get one of the damn demos to start, then you get a whole load of stuff for free, but, eventually, you run into things the framework can't or won't do for you, and you have to work out how to ram your workflow down its stupid throat aargh. Your delivery speed plummets, but eventually you'll get it working, and you'll have some free good design and code reuse in there. Now, with a decent grounding in how the framework works, and your extra flexibility layer, you can get back to the good stuff.
This results in roughly The Framework Graph, shown here, reproduced (in Paint) without permission.
I believe an unawareness of this Graph comes up frequently, even when not discussing frameworks directly:
- I don't want to use a big complex library, it'll be simpler to do it myself.
- I can't get it to do quite what I want, I'll start again from scratch.
- I don't really understand why it makes this operation so hard, the tool must be broken. (Hibernate, anyone?)
- Why does it want all those parameters/config/values? I just want it to work.
I can pick many examples from my non-professional experience has come up, my favourite is (coincidentally!) That Graph Drawing Code:
- I have two forks of some disasterously [old and] terrible plotting code for generic popularity data visualisation and political compass aggregation, and I have recommended (and/or forced) other people to use the same technique in their projects, mainly to avoid the tyrany of
gnuplot
. - For a more recent project plotting hard drive prices, I chose to finally give in and learn
gnuplot
. It was a pain, but the resultinggnuplot
code is much neater than any of that PHP, and then I've got things like suprise svg support for free. Plus, it means that I can quickly bang out other things, like my statcounter browser versions reinterpretation.
In summary: The big horrible library/framework/tool/etc. will almost certainly provide you with more total productivity in the short (when most projects fail, at about the vertical line on the Graph), medium and long term, regardless of any pain it gives you.