The Unpossible Programmer

Friday, November 18, 2005

Wabi-Sabi & Java

I just finished reading a short, but somehow fulfilling book called Wabi-Sabi for Artists, Designers, Poets, & Philosophers, by Leonard Koren. Roughly 50 or so pages filled with various "imperfect" imagery and some thoughtful glimpses into the nearly lost art of Japanese tea ceremonies.

I won't delve into a cultural aesthetic that I hardly comprehend after a brief stint through text, but the back cover sums it up quite well - Wabi-Sabi is "a beauty of things imperfect, impermanent, and incomplete. It is a beauty of things modest and humble. It is a beauty of things unconventional".

Ok, ok - so what the heck does that have to do with programming Java? One line of the book that stood out for me was the following: "Pare down to the essence, but don't remove the poetry."

One of the major downfalls to the Java programming language is its immense complexity and the sheer enormity of technologies built using it - I mean, good grief, when one sets out to learn Java, they'd better have a distinct plan of attack, or they'll get lost in incredibly deep seas of information.

Pare down to the essence - aka get rid of all that complex junk which serves only to make programmers feel better about themselves. The poetry will still exist, in its simplicity.

Take a J2EE project for example. You have three tiers - a model, a view, and a controller. What is the simplest way to achieve functionality within each tier? With Java, there are so many choices and technologies available, it would take someone years and years to find an ideal enterprise solution. Fortunately for us programmer geeks, getting there is half the fun.

I recently took a crack at this and developed a J2EE "spine" for work, simply a complete generic enterprise Java project which utitlizes some fun things (at least fun in my warped programmer's mind). The project can be pulled from the repository, and modified quickly into whatever it needs to be.

1. The database (model) tier.
I put Hibernate to work, which simplifies ORM's (object-relational mappings) and allows Java objects to be easily created from database tables. Add xDoclet into your Ant build file, and the process is simplified even further.

2. The business logic (controller) tier.
EJB 3.0 makes stateless session beans a snap - add in the correct attribute to your class, and you're done. (requires Java 1.5)

3. Web Presentation (view) tier.
I have embraced the amazing powers of Jakarta Velocity - quite simply the best technology to hit dynamic html pages since their creation. Velocity templates (in combination with the equally powerful Struts framework) makes for one jaw-dropping combo. With the Velocity-Struts package, all the Struts beans become readily available to your Velocity page - no more funky JSP tag libs, or hard to remember attributes. Just access your beans and properties as you please. Oh, and did I mention no more stupid pre-compiling of the web pages themselves? Yeah, buddy.

4. Testing - Cactus, JWebUnit, et. al.
I love writing tests with Junit and the associated technologies. I finally figured out how to make Cactus (as a separate web app in my .ear) work as a collected set of tests that can be run from a web site at any time during deployment. Once again, you have to sift through all the complex jargon to find out that Cactus is just a web shell for housing JUnit tests, and that the tests themsleves can be short, simple, and only used when necessary.

This is what really drove home the phrase "Pare down to the essence" to me. Why do Java programmers insist on wallowing in their own superficial magnificence? Beauty and simplicity lie within Java, one just has to first jump the gargantuan hurdles of the language, and the fact that these technologies evolve so quickly, that documentation is usually sparse and difficult to read, if it even exists.

I truly believe now that you can find the poetry in any programming language, as long as you can "pare down the essence" and arrive at a simple, yet elegant solution. Don't make it overly complex just because you can - I've been there, and even if you don't end up being the one supporting the complex (albeit magnificent) application, it will eventually bite someone in their posterior.

Tuesday, November 15, 2005

POST TO YOUR DAnG BLOG!

Oh my. Has it been four days since I started this already? Ok, here we go.

Before we get started, let me just say that I'm a bit disappointed in myself lately. I wish I would have started this blog when I was within the wonderfully raging, swirling mists that totally envelop me during a programming project. Alas, twas not to be.

Ah, to feel the nearly endless possibilities again. That's all I really want - to start a project and from the moment development begins, the possibilities...

(imagine really cool dissolving effect here)

It starts with the very first programming language you learn. For me, that language was HTML. You see the code unfold before you, and there it is - your first pattern. You learn the attribute that controls the color of the page, and you begin seeing in your mind all the ways you can change that attribute and make the page behave in a certain way. Then you learn another attribute, notice the similarities to the first, and then you see it - by combining the two, you can make something entirely different happen. And so on and so on.

Before you know it, you're knee deep in a full-fledged Java J2EE project, complete with three tiers - an amazing database tier using hibernate, an ejb tier with stateless session beans, a web tier using struts, tiles, and velocity templates...ahhhh. The best part is that you see the picture in your brain first...you see all the fantastic things you've created before - and the re-shuffling occurs almost on its own: what if this piece went here, that piece went there; even before you set pen to paper, or connect the dots in your visio diagram.

It's silly, I suppose. Dictionary.com defines programming as "To provide (a machine) with a set of coded working instructions." Sounds as though it should be methodical and stale, doesn't it? Not to me. That's why I believe in little Ralph Wiggums' unpossibility. To me, "unpossible" means nothing is impossible - no idea is too far out there, no combination of thought is completely without usefulness.

I promise my next post will be on a specific programming language, but for now, you'll just have pardon some wistful reminiscing.

Thursday, November 10, 2005

The Beginning of Unpossibility

Weary programmers, here, at last is a small shrine by the wayside to rest your weary feet and bask in the glory of thoughts on all aspects of web programming - designs, languages, and dare I say it - even personal musings. Feels good, doesn't it?