I’m currently working on a book about, among other things, software architecture for J2EE applications. A few days ago I sent off a rewritten draft of one of the chapters to my co-author, who sent it back with, among other comments, the observation that one of my diagrams was upside down.

One thing I’d mentioned in the chapter was that, in an ideal world, the various tiers in an enterprise application “look up to each other”. That is, the lower tiers are aware of the interfaces to the higher tiers, but the higher tiers don’t know about the lower tiers. This is a pretty well accepted design principle–there’s no need for an EJB (or whatever) to know anything about the servlet/Swing GUI/whatever that’s invoking it.

However, my explanation only works if you think about the business tier as the “top tier”. Which is what I’ve always done. When I’m visualizing an application I think about the presentation tier passing information requests “up” to the middle tier and the middle tier passing things “further up” to the database. Of course, the tiers get progressively more generic as you head away from the presentation layer towards the database. So it’s just as logical to draw the picture from the bottom up, with the presentation layer sitting on top of the middle tier, which sits on top of the database, and so forth. And this is, indeed, what a lot of people do.

Sun’s no help here. Their official picture goes left to right.

Seems like a trivial observation…but…I’d never overtly noticed the difference until I started explaining “looks up” to people. And since I’m trying to introduce people to the concept of tier separation in the first place, I want to do it in a way that is broadly intuitive to the largest possible audience. So, I’m going to do a little poll: do you put your business tier at the top of the picture, the bottom, or on the side? If you’ve got an opinion (or have ever thought about this at all), let me know below, or by email.

Top, bottom, left or right?