Hypothetical framework choices
I subscribe to feeds of items tagged with “django” on a couple of sites, and tonight I noticed a link which posed a hypothetical situation of wanting to port a large J2EE application to either Rails or Django, and asking about making the choice between them.
I wrote up a reply, but attempts to post it there netted me “The page you were looking for was not found. Moron.” So here it is in all its glory; maybe someone will get some use out of it, maybe not.
As always: it depends.
Some good hypothetical questions to ask in this hypothetical situation:
- Does anyone on the team already have good working knowledge of Ruby or Python? And by “good working knowledge” I mean not just syntax, but standard libraries, third-party ecosystem, etc. You need to know up-front what the language already has and what you’ll need to write on your own.
- How willing are team members to adapt to a dynamic language and the accompanying set of programming idioms? Some God-awful things have been foisted on the world by people who just straight ported Java code without wondering whether the target language could express the same intent in a more effective way.
- Do you have the ability and willingness to make any necessary infrastructure changes? Rails and Django both rely heavily on a shared-nothing architecture and scale out rather than up, which can involve some serious changes when coming from J2EE. Standard deployment is also different and multiple “standards” exist — Python, for example, prefers either mod_python or WSGI, while Ruby prefers FastCGI, SCGI or (increasingly) proxying to Mongrel.
- What assumptions from Java need to be thrown out or reconsidered when transitioning? Threading, for example, is nowhere near as ubiquitous in Ruby or Python, and programmers fluent in those languages seem, on average, to be much more skeptical of threading as a concurrency model. The “application” itself is also somewhat different, and generally far more tightly focused on request/response cycles with a very different concept of persistent state between requests.
- What other systems will the application have to interact with, and what expectations do those systems have? Most J2EE applications don’t exist in a vacuum, so you need to plan ahead for how you’ll handle communication with legacy components. Additionally, Ruby and Python can certainly do SOAP, XML-RPC, etc., but the code to handle them tends to look unnatural — “everything happens by passing XML documents around” is not the preferred idiom of either language.
That’s just for starters, but hopefully it’s an indication of a more productive line of questioning for choosing a framework (and remember that there are more things out there than just Rails and Django — Ruby and Python both have a variety of frameworks available).
Disclaimer: I’m the release manager for Django and work for the company which originally developed it.