Revisiting old code, and Good decisions made

20 06 2008

Over 5 years ago, I began work on an application called CONGO, a registration and badging system, not only in the vein of “There’s gotta be a better way”, but also to help out a friend who was running registration at con in Philadelphia.

The first versions of CONGO were crude, but worked well – with a custom Swing interface, custom terminals and servers, it was an impressive setup. What wasn’t apparent was this was my first foray into writing any decent sized Java application. I made what I thought at the time were good design decisions, and looking back on 30+ events run, and hundreds of thousands of badges printed, I’d say the design was, for what I knew at the time, solid.

But it’s time to change. With everything I’ve done over the last 3 years in Java and enterprise-level applications, I feel I’m ready to rewrite CONGO into a proper Java based webapp. CONGO 1.0 was part Java, part PHP, part templating. CONGO 2.0 will be a pure java application, based on Struts, and will allow features that I could not shoehorn into the old model

I started work on CONGO2 about a week ago, and I have my first screens working properly and chaining together as they should. Part of this process is factoring in the old logic code, and linking it up with the new presentation layer I’m building using JSPs and Struts. This means making calls to 12,000+ lines of Java code that was written as I was learning the language.

But one thing I did consistently – I documented my methods. Every piece of the CONGO appserver has full Javadocs describing how to call the method, and what it returns

Because I’m doing CONGO2 using modern tools (like Eclipse and Tomcat, my GUI is showing me these docs whenever I try to link to my old code, and is reminding me how to use the old libraries. Why is this remarkable? Because other than generating static documentation, I’ve never actually seen my own comments and documentation popping in interactive windows in my IDE. Until now.

It gives me a little thrill each time I see my own docs pop up as helper windows in Eclipse, showing me comments I made half a decade ago on structures and calls, and reminding me how to use the system.

It wasn’t easy to learn Java, it wasn’t easy to learn Swing, it wasn’t easy to learn JSPs, JSTL, and Struts. But now I do know them – some more than others, and I’m enjoying this massive refactoring of one of my proudest creations.

Advertisements

Actions

Information

8 responses

20 06 2008
Lisa

Are you normalizing the database too? 😉

20 06 2008
dbs

The first step is going to convert everything off the PHP code onto JSP and Struts. No database changes at all. I want to duplicate Coconut compeltely in Java. Once that’s done, I’m going to start adding things lke the new Addresses structure (stop using reg_locations, break it out into ‘phones’ ’emails’ and ‘addresses’ or the like).
The next step after that will likely be a total reworking on the transactions system, which was sorely stressed on the last event, and has some gruesome hacks in it.
Once those are done (or perhaps during them, I’m not sure), chances are I’m going to switch the database interface to Hibernate, which will probably require a refactoring of 80% of the code in the old classes, but will also, at least, normalize the tables. 🙂

21 06 2008
Tom Limoncelli

Have you considered Google GWT? You write everything server-side in Java, and it compiles the routines that should run on the web browser into JavaScript. Works with Eclipse, etc.

21 06 2008
dbs

@Tom
Contrary to popular perception, Google isn’t the answer to everything. I considered it, and discarded it. To me GWT is not mature, is a very niche technology for the moment, and isn’t exactly a marketable skill. It might in the future, but if I”m going to spend weeks learning a new environment, I’ll learn one that is in wide adoption.
Not to also be too snarky, but if Google Apps are any indication of the magic of GWT, then it is wildly inappropriate for what I’m doing at the moment.

21 06 2008
Tom Limonelli

Dude, I know Google isn’t the answer to everything. If I did I’d ask why you didn’t use Google App Engine too.
I’m more curious (1) if you hadn’t heard of GWT at all (which would be an interesting data point), or (2) you did an evaluation and what you didn’t like about it (which is very interesting to me).
The other thing I’d recommend is YUI: http://developer.yahoo.com/yui
I’ve seen some excellent YUI designs, and I heard interesting things when the creators were interviewed on a podcast.
Tom

22 06 2008
Randal L. Schwartz

Have you considered using Seaside, the up-and-coming continuation-based web framework running on Portable (and mature!) smalltalk? See http://seaside.st for details.

22 06 2008
Randal L. Schwartz

Have you considered using Seaside, the up-and-coming continuation-based web framework running on Portable (and mature!) smalltalk? See http://seaside.st for details.

22 06 2008
dbs

@Randal
Heya merlyn, ltns 🙂
There’s sort of a long term issue with me and frameworks (heck, with languages too). There’s always something up and coming. If you keep learning the new shiny, you never learn why it’s so shiny, and what it was designed to replace. You’ve seen it with Perl->Python->Ruby-> whatever the latest whee is, and you see it with web frameworks.
I decided to go with Struts (at least using Struts2) and JSP and the JSTL and the like because it is, by far, the most widely deployed web framework around. Just search monster.com for any keyword combination for Java, and try to find more jobs 🙂 (okay, you might be able to do it with ‘java servlets’, but that’s cheating.
And, much as I love the concept of Smalltalk, it’s not exactly a career move to get into being a Smalltalk Guru. It’s sort of like being a LISP god. You get adored by a few people, but it’s hard to make a living at it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: