What’s in your Stack?

As most of the readers here probably already know, the term “stack” when it comes to app development is typically meant to describe the entire software structure on which the application is built. For instance, LAMP is a common example, standing for Linux, Apache, MySQL and PHP.

Developers are often tweaking and re-selecting pieces of their stack – the newest thing comes along, we like to try it out. But usually we’ve got a “go-to” stack for getting real work done, and constrain our experiments to a separate area until we’re sure something has what it takes to get included in our favorite stack.

There’s usually two major types of components in our stack – the bits we actually deploy, and the bits we use to actually develop with – the latter includes pieces we usually don’t actually ship with the finished product.

For instance, a classic J2EE stack might consist of the “deployable” pieces: Oracle’s standard Java EE 6, Hibernate, JSPs (technically a part of J2EE in any case), and Tomcat as a servlet container.

And the development stack might includes Eclipse, Maven, and various plugins to make Maven do our bidding.

There are a number of attributes I wanted in my own personal favored stack. This included:

Easy management of dependencies: I like knowing and controlling exactly what bits go into my finished application, and unless I can control all of the dependencies accurately, I can’t achieve acceptable quality.

Fast cycle-time: I want a stack that during development provides me with a rapid cycle time. E.g. the time between making an edit and seeing the results in either an application or test to be as short as possible.

Easy testability: I need my stack to facilitate testing, as my normal mode of development is BDD/TDD, where I write code because a tests tells me to, by and large. I want my testing tools to support my choice of test frameworks as well.

Modern language support: My choice of language for my own development is Scala, so I need a stack that supports Scala well. I won’t go into my reasons for choosing Scala, that’s a topic I’ve covered in another blog post.

So, without further delay, here’s my favored stack. First, the deployable bits:

Scala: I’m currently using Scala 2.8.1. Scala allows me to use a REPL for easy experimentation, which helps with my fast cycle-time requirement as well. The 2.9 release of Scala makes the REPL even more capable, but I haven’t tinkered with it much yet. I’ve talked at length about why I choose Scala in other posts, but it’s not for lack of knowing and having seriously tried other languages and environments. I can’t say I’ve tried them all, but I’ve tried quite a lot, and Scala remains my top choice.

**Scalatra: **Scalatra is a lightweight non-intrusive web app framework that lets me create web applications quickly, easily, and with maximum flexibility. I can write both RIA-style applications with REST/AJAX/COMET functionality or non-RIA request/response style applications, while maintaining statelessness and supporting scalability.

Scalate: With strong integration with Scalatra, Scalate is a powerful template system, perfect for generating XHTML for web applications in an extremely DRY and expressive manner. It’s like an up-to-date version of Velocity, but with Scala goodness and much more powerful.

SBT: A long-time Maven aficionado, I was hard-pressed to consider a different build system. I was, however, honest about Maven’s shortcomings, of which there are quite a few. I tried SBT and went back to Maven several times. I was intrigued enough with the advantages to come back again for another try, though, and I’ve now mastered it enough, and am getting enough benefits, that I won’t switch back.

Casbah:Casbah is the “missing link” between the Java MongoDB drivers and Scala. It allows database objects for Mongo to be readily constructed with Scala’s expressive map syntax, and type-safe retrieval of fields, not to mention it’s advanced query support.

Squeryl: On the occasion I need to interact with relational databases, Squeryl has become my tool of choice – but I’ve also dabbled with a few alternatives. One alternative I won’t go back to under any circumstances is Hibernate, or even worse, Entity EJB’s.

OpenJDK: Open JDK is a capable and independent JVM that supports Scala well.

MongoDB: I’ve used relational databases for several decades, but now that I’ve worked with key/value systems such as Mongo, I seldom find a job that RDBMS is better suited for.

Winstone: The Winstone servlet container allows me to create a single simple executable jar that incorporates both my app and the servlet container necessary for it to run in a single super-lightweight package that is easy to deploy and manage. Given it’s light footprint, it allows me to run multiple servers on a single system and provide a cluster “in a box”.

Linux: For deployment, I choose Linux. I’ve never found a business situation that wasn’t better served by Linux than by Windows, ever. Enough said.

Now the development stack:

IntelliJ IDEA: IDE support for Scala is not fantastic yet, but it’s quite good and getting better. The best of the lot is IntelliJ IDEA with it’s Scala plugin. It’s not perfect, but it’s quite capable. I will admit I frequently find myself being tempted to use TextMate, Kod, or, more recently, Sublime instead, however, but the completion and refactoring tools keep me sticking with IntelliJ.

SBT & JRebel: SBT‘s own support for continious deployment and testing is excellent, but when combined with the (free for Scala) JRebel tool, it’s downright unbeatable. I can work on a webapp, make code or UI changes, flip to my browser and hit refresh and see the result. I can tell SBT to keep running my tests every time they need to run, and immediately see any breaks as they occur.

Jetty: SBT uses a built-in Jetty servlet to auto-deploy webapps for continuous development, so Jetty is part of my stack as well.

Mac OSX: For development, I work on a Mac system much of the time. I do have a desktop Linux system, but the impressive portability and power of my MacBook Air is hard to compete with.

The above are my current weapons of choice for web application development. So, what’s in YOUR stack, and why?

Principles and Practices

Tired of the Software Development Grind? Know it can be done better? Check out my book: Principles and Practices of Software Craftsmanship or sign up for my Craftsmanship Dispatches newsletter.

Published: March 31 2011

  • tags: