In Defense of Frameworks

Well, it’s been awhile again.  Hi everyone (insert excuses about work, time, etc.)  Anyways…

I’ve seen a lot of posts and comments on reddit lately talking about how using an out-of-the-box framework (Rails, Django, Cake, Grails, etc) doesn’t really buy you anything, and might actually harm you in the long run.  Most of these arguments tie into the 90-10 rule where you’ll spend 90% of your time on 10% of your code (the unique part your site.)  At that point, you need to optimize, scale and focus your energies on these parts of the site, and the framework will inevitably get in the way (see Twitter.)

I see some merits in that argument, but I don’t know how much I buy it.  There are a few things that frameworks do get you, and in the end if you’re writing something to last, you’re going to be building a custom framework anyway!  So, here are my reasons as to why frameworks aren’t bad.

Rapid Iteration/Bootstrap

Yes, I know… when you’re Twitter things like Rails’ ActiveRecord starts to suck.  But, you need to get TO Twitter before you start worrying about those types of optimizations.  Even if you know your site is going to have a steep growth/adoption curve, you still won’t gain much by writing everything from scratch.  No matter how brilliant you are (and I know you’re brilliant!), there is an incredibly high likelihood that you won’t even know what exactly will be the bottleneck once your users start using the site.   Who knows?  Premature optimization is an evil bitch.  You can spend months optimizing the database schema and perfecting your Hadoop map/reduces and then find out that your site’s JavaScript is killing computers that are slower than that quad-core under your desk.

Free Stuff

If you go it alone, you’re setting yourself up for more work in the long run.  Sure, there are libraries out there, but you are responsible for their integration.  You’re responsible for best practices.  Meanwhile, framework users can easily leverage the community for improved backends, plugins and templates.

Free Improvements and Core Testing!

A corollary to that is you get free improvements when you use a framework.  Upgrading to a newer version of Django will give you a slew of upgrades and performance improvements that cost you nothing more than a regression test of your software on the new version.  It’s a great pick-me-up for your site.  Also, you get free security patches (although at the same time, a large framework is more of a target than your own code) and the confidence of knowing that a slew of developers and users have run their own unit tests (not to mention running the framework in their production!)  And of course, if your site does become the next Twitter, just as many people will be trying to hack you as Rails.

A Common Vocabulary

Another amazingly useful thing about using a standard open source framework is you can leverage the community for help and recruiting.  Having a conversation with another developer using the same framework provides a common vocabulary that allows you have to amazingly efficient conversations.  “I am having some difficulties integrating Twitter OAuth as an authentication backend.”  “Did you try a signal?” etc etc.

Related to this is, its much easier to hire and bootstrap new employees when you are using a framework out in the open.  Throw a Django or Rails developer into your large codebase, and sure there will be some ramp up time (your architecture, custom code, hacks) BUT you will have a common starting point.  Throw a person into your custom framework and the ramp up will take considerably longer.

Finally,

You’re Going To Write One Anyway

If you decide to go it alone, you’re going to end up writing your own custom one anyway.  Now, I know for most developers it’s more fun to start your own from scratch instead of leveraging one out there.  Additionally, most developers find their own framework better.  50% of the time its just because they know it better.  They know how to hook into since they wrote it.

At work, my team wrote their own custom closed source CMS and Framework.  Sure, it works great and covers our needs, but I see these ramp up problems all the time when we hire people.  I also know that, if my team doesn’t update or secure the framework, nobody else will do it.  Instead of just developing our own site now, we also develop the framework.  This is possible because we have a team of developers, so we can split our time.

But, if you’re one guy working on a side project (or the gestation period of your startup), use a framework.  Sure, you’ll end up spending 90% of your time on that 10%.  Sure, you might be cursing a ‘limitation.’  But, for the most part, the reason you only need to spend another 10% of your time on the other 90% of the code is because it’s already written for you!

Framework + Language Attention Deficit Disorder

I love technology and love playing with the latest and greatest (which being ‘latest’ always means there’s something new to play with.)  In the wee hours of night after work, I’ve been playing with various frameworks and languages for a few of my side projects and discovered that I have fallen into this rut where I keep reimplementing the startup idea I have in different languages.

First, I tried to create my own framework.  That, as it became painfully obvious, was not the best idea ever (even though I’ve done that for the full time job with a team.)  When reinventing the wheel though, its best to look out there and see what else is avaible.  At least be influenced by it.  This is when my ADD kicks in something fierce.

I played with the following: Wicket, Tapestry, Rails, Grails, Zope, Restlet, Django, Rails on Java, and JSF (ICK!).  The saddest part is that, depending on the framework/language, I’ve developed pretty large core pieces of functionality in many of those frameworks.   Then I threw them out!  I guess one positive of all this back-and-forth is after playing with these frameworks, I can feel pretty confident about the one I settled on (Django), but even now I have pings of “let me try something new!” (or flipping back to Grails occasionally.)

Anyone else have these ADD issues with frameworks and languages?  How do you end up settling on one?

If anyone is interested, I can talk about a few of those above (why I went or didn’t go for them.)

Django+Eclipse with Code Complete Screencast

Here is my first screencast, finally polished off.  In it, I discuss how to set up the Eclipse IDE to do your Python and Django development, complete with code complete, jump-to-code functionality and live  breakpoints + code replace.  I’ve recently migrated away from Textmate (a large reason for this was wanting to develop on both Linux and OSX) and found that Eclipse has really sped up learning Django and some of the libraries I’ve used.
I reference a few URLs for this screencast.  They are:

I also reference a chunk of code that your manage.py should be.  I’ve uploaded that to snippet to django snippets.  It was originally posted here in 2007, so I’ve copied it to Django snippets in case that post disappears.

With that all said and everything out of the way, here is the video.  Please let me know if you have any questions! (In case you’re wondering, I used IShowU HD Pro to record this and iMovie to edit [badly].)

Also, comparing the Pre’s 18 apps to the iPhone’s 50k?

Also, did anyone else find it kinda douche-y, that they put up a graph of the Pre’s 18 apps vs the iPhone’s 50,000? The Pre has been out for 40 fucking hours. That’s 18 more third party apps than Apple had at that point. (Let’s not forget that Apple had to be dragged kicking and screaming into third party native app development.)

Disappointed with the 3GS and AT&T

Ye who enter this post, abandon all hope.

First of all, let me preface with the standard Apple-fanboy disclaimer. I’m a huge Apple fan (as the ridiculous number of Apple products littered all over my by apartment can attest to.) They really have pushed forward the entire Cell Phone industry, and have been a catalyst for the next generation of Something Great(tm.) That being said, …

The keynote left me a little “wanting.” The updates were boring, incremental and not what you’d typically expect from Apple. Apple doesn’t do incremental. It doesn’t do evolutionary. It does revolutionary. And to see a keynote that literally spent 5 minutes talking about voice-activated controls is borderline pathetic.

There was very little new announced or demoed. The hardware upgrades are what normally would be considered “bumps” in the Laptop world. I still don’t understand what “2x the magic” means, but I’m going to assume the magic is ram. I just find it awfully insulting that some of the features are not being ported over to the 3G (video recording, voice commands.) Jailbroken phones already have video recording! The one thing that would have been game-changing, a front facing camera, didn’t seem to make it out.

Regardless, I understand that the hardware form factor is pretty much “perfect” (See? I can be fanboyish) It’s perfect because it gets out of the way. The real form factor of the iPhone is iPhone OS. And Cupertino, that’s where we have a problem. The form factor has become totally stagnant.

Everyone remembers the first time they saw the iPhone OS. It really felt like something plucked out from the future. It’s like Doc Brown showed up in his Delorean and gave us this piece of technology from 20 years in the future.

But that was 2007. This is 2009. The iPhone OS still looks like 2007, and its built with some (bad) 2007 assumptions. The OS does not scale for people who install tons of apps. Ever try to move an app from Page 8 to Page 1 in Springboard? Shit is broken. It’s just an inelegant solution, and I’m not sure what is an elegant solution, but if anyone can figure it out, its the apple team.

Or so you’d think. The Core UI coming out of the iPhone lately has been, well, shitty. The notification system is a dramatic example of “not really thinking the UI out.”

Here’s a pic from the keynote:

Seriously?  Imagine getting 30 of these.

Seriously? Imagine getting 30 of these.

Imagine a spammy app. Something like Tweetie, or AIM, or a news app. Imagine getting 30 of these notifications? That design just doesn’t scale. The alternative format of collasping the alerts is just as shitty. Instead you either get messages like “Twitter (30) – View” or “Twitter (30) / ESPN (10) / AIM (82)” which are unusable. It just doesn’t work. It’s inelegant, and its almost embarrassingly implemented. Compare that with the Palm Pre:

Now that's more like it!

Now that's more like it!

Now that’s a 2009 new modern system. The design is built with notifications at the core. The notifications system slides in and out, regardless of context, doesn’t distract, and can be used to read details in place of your current app (not forcing you to switch context.) Now, I’m not just putting the Pre on a pedestal, Android does this too (and really really well.)

This completely ties into the biggest fundamental flaw in the OS. The lack of background applications (except for the Blessed Few Apple Apps.) I hate not being able to run Pandora or Slacker in the background (or AIM, or Tweetie, or push Gmail.) I (barely) understand the battery arguments, but shouldn’t the 3G S new super battery have made those points moot? Additionally, Apple needs to stop coddling me like a little child. If I want to run folding@home on my phone and give it 15 minutes battery life, let me do it. If an app truly destroys the battery, the review process will ferret this out (“This RSS reader sucks battery like crazy.”) Don’t throw the baby out with the bath water!

Now of course, other phones have their flaws too. The Pre doesn’t have an on-screen keyboard (which stinks if you want to shoot off a “Coo” text message) and I’ve become super fast with the iPhone’s corrective type system. Also, not being able to write directly to the graphics layer means no awesome games like Need For Speed Underground. But, I do think those are coming. Web OS’ 1.0, so far, is far superior to iPhone’s 1.0.

In another (related) rant or observation. Did anyone else notice the strange acrimony between Apple and AT&T during the keynote? There were some (snide) comments in passing about no tethering and (especially) no MMS. Take that and add in no newly discounted data plans, no nice upgrade pricing for 3G owners and rumors of Apple taking the entire $100 price cut on their end for the 3G, and it seems like AT&T is losing some of the love that they’ve had for the folks off 280. Maybe Apple is playing hardball with their exclusivity contract? Hmm…. food for thought.

Follow

Get every new post delivered to your Inbox.