Design Patterns

The class I’m teaching this week and next is a massive, customized combination of Design Patterns, JSTL, JSF, Spring, and Hibernate. It’s going to be an adventure.

Today, though, we were digging into patterns. Design patterns has usually been my favorite course to teach. If teaching is all about giving people the ability to do things they couldn’t do before, then patterns is one of those fundamentally enabling topics that helps all your code everywhere. It also helps people understand code from others that they’re reading, not to mention the Java APIs.

We talked mostly about Abstract Factory, Factory Method, Singleton, Strategy, Template Method, and Observer. Suffice it to say that it was a rather long day. I happen to like all of those and use them regularly. There are other creational patterns, too, like Builder and Prototype, that our materials didn’t dig into but I discussed with the students.

Yup, they’re fried, and it’s only Tuesday. It’s a standard dilemma. We have lots of material to cover, but it’s just hard to absorb that much that quickly. The students are roughly intermediate Java developers (with a wide standard deviation), but still sometimes the Java stuff itself is a bit of a challenge to them.

I brought up the Head First Design Patterns book and they seemed interested. I have mixed feelings about the whole Head First series. Kathy Sierra herself once wrote that people who criticize the books are often people who already know the technology. That’s probably true. The Head First EJB book was wonderful and got me through the Sun Certified Business Component Developer exam. On the other hand, I didn’t like the Head First Servlets and JSPs book at all. But, then again, I already knew servlets and JSPs when I read the book.

Personally, my favorite patterns book is still Applied Java Patterns by Stelting and Maasen, even though it’s getting a bit dated by now (published in Dec, 2001).

[The Mets blew a great opportunity. They had men on 2nd and 3rd with one out and didn’t score. They’re down to three outs left in order to keep from going down 3 games to 2.]

Incidentally, the students use IBM’s Rational Application Developer 6.0 in their jobs. That’s normally okay, but the design patterns materials I have use Java 5 generics, enhanced for loops, and other cool features. For this part of the class we’re using Eclipse 3.2 with the ever-popular MyEclipse 5.0 plug-in. That should really pay off later when we get back to the server side.

What happened to IBM’s tracking of Eclipse developments, anyway? When they first released WSAD 4.0 (WebSphere Studio Application Developer), they also released Eclipse 1.0. They stayed exactly 3 numbers apart for years after that, going to WSAD 5 (Eclipse 2), WSAD 5.1 (Eclipse 2.1), WSAD 5.1.2 (Eclipse 2.1.2), and even RAD 6.0 (Eclipse 3.0). Now Eclipse has moved to 3.1 and then to 3.2 and we’ve gotten nothing from IBM. I’ve heard rumors of a RAD 7, but I don’t know what that’s all about.
Okay, the move to Eclipse 3.1 was big and difficult because that’s the first version that really worked with Java 5. WebSphere still doesn’t get Java 5 at all, which is one of the many reasons I tend to prefer JBoss (now a division of Red Hat).

Speaking of annoyances, Hibernate 3.1 works with Java 5, but doesn’t use Java 5 generics. As ugly and awkward as the generics implementation is (try making a Map where the values are also a List some time), I find it very annoying that I can’t use generics in my code because query.list() and criteria.list() methods both return List of Object. It’s back to casting again, plus I can’t use the for each loop.

Hibernate 3.2 is a hairs-breadth from release. I hope they’ve fixed that, but the betas don’t seem to show it.

The Mets went one-two-three in the 9th. So much for that. As long as the Yankees have been eliminated, I’m happy. 🙂

Rumble, rumble (or so they tell me)

I’m in Winston-Salem, NC this week and next.  I’m working on the Hibernate materials this evening with the NLCS game on in the background (top of the 8th, St. Louis leading the Mets 4 — 2).  Every so often the TV beeps at me as the local station begins a slow crawler along the bottom.

It seems we had a massive earthquake here early this morning.  It measured a whole 2.4 on the Richter scale.  Woo.  We’ve even had a couple of major aftershocks this evening, measuring 2.1 and 1.4.

Who knows?  Maybe if I’d been watching a pot of still water at the time I might have seen it vibrate.  Or not.  Good thing the TV keeps reminding me about it, though.