Book Review: Java 5.0 Tiger: A Developer’s Notebook

Java 5.0 Tiger: A Developer’s Notebook (publisher site) Brett McLaughlin David Flanagan

Java 5.0 Tiger: A Developer’s Notebook (J5T) was one of two books I requested from O’Reilly’s User Group support program during my last semester of school. I requested J5T because I was going to be working on an independent study that used Java 5 features in the existing code base. I was comfortable with “basic” Java from previous course work, but since it isn’t part of my day-to-day work, I hoped that a J5T would serve as a nice supplement to my existing knowledge. And for the most part, it did.

J5T does an excellent job of providing an overview of the new features in Java 5. The book is divided into chapters, with each focusing on one particular new feature. Topics covered include generics, autoboxing, annotations and threading, among others. The chapters on generics and Java 5’s enumerated types were particularly helpful, as these are two features that greatly simplify lots of Java 1.4 code. Seriously, who wants to deal with a Collection and have to perform a type-cast every time you get an object out of it? And while static classes with simple public final static members did 80% of the job of enumerations, having true enumeration support brings that final 20% which really makes it, well, work. Correctly.

The chapter on threading is also a welcome utility when I’m working with Java applications. Java’s threading has been a persistent mystery to me and McLaughlin and Flanagan do a good job of covering the basics you need for most use cases.

My complaints about the book are incredibly few and mostly echo my previous complaints about the last Developer Notebook I reviewed. They mostly boil down to this: I hate it when my books get scuffed, let alone have coffee slipped on them, so faux drink circles do not make me feel relaxed, only like I need a wet rag to wipe the book down.

Overall J5T is an excellent utility book for people coming from a Java 1.4 background. This also implies that it’s lifetime is somewhat limited: these features are only going to be new for so long, and more and more developers are going to get their first taste of Java in a Java 5 world. Luckily for authors, there’s always new features being added, currently in the Java 6 (Mustang). And if you don’t want to write about language features, I’m still waiting for Java Version Numbering in a Nutshell. Now that would be useful.

date:2006-06-29 16:06:00

On my way…

So I spent last week in sunny Key West for a post-graduation, much needed vacation.  I usually go on record as anti-vacation — I like to think my life isn’t something that needs escaping —  but five days of sunning, snorkeling and, well, doing nothing, was really nice.  So today I’m heading down to the iCommons iSummit in Rio de Janeiro.  I’m going to be traveling something like 23 hours: Fort Wayne, Indiana to Cleveland, Ohio to Houston, Texas to Rio de Janeiro, Brazil (with a one hour stop inSao Paulo). Of course, the first leg is already delayed; luckily there’s FlightView which lets me be completely obsessive-compulsive about the inbound plane.  Yay for technology.

date:2006-06-21 12:48:12
category:aside, my life

“Live from Tex-ass”

Once again I’m late to the party, but I’ve been listening to Sufjan Stevens’ excellent `Come on feel the Illinoise <>`_, the second in his proposed series of 50 albums, one for each state. The album features an amazingly poignant ballad “John Wayne Gacy, Jr“ about the serial killer of the same name. Illlinoise is one of the most unique albums I’ve heard in quite a while.

Given the current political situation, I’d like to make a suggestion for a future Sufjan album: when you get to Texas, perhaps you can honor the G-W with another serial killer ballad. Just a thought.

date:2006-06-08 08:06:02
category:aside, politics

Dear Mr. President,

I understand that you are quite concerned about judicial activism. I appreciate your concern regarding historical precedent and original intent. Perhaps you could [STRIKEOUT:re-]read the Federalist Papers for additional perspective. In particular I recommend Number 10. I’m sure you’ll find Madison’s thoughts on the tyranny of the majority fascinating. One reading is that your majority [STRIKEOUT:and political capital] (sorry, I forgot that where once there was a surplus there is now a deficit) justify the Federal Marriage Amendment. I submit that an alternate reading is that judges are simply protecting a minority of the population from said tyranny. Since you arethe decider“, I eagerly await your decision.



date:2006-06-06 10:04:30

The Long View

If you want a thorough fisking of our esteemed President’s radio address yesterday (dedicated to the Federal Marriage Amendment, natch, because that’s the most pressing issue we face as a country), see Ted’s blog entry. It seems to me that this issue only comes up when Bush needs to appeal to the [STRIKEOUT:facists] [STRIKEOUT:zealots] [STRIKEOUT:bigots] [STRIKEOUT:wackos] Republican base. But that would imply he was simply pandering, which we know he wouldn’t do — he’s a uniter, not a divider; a straight shooter, remember?

So I’d like to share a story with you to give us some perspective on the issue. Last year our neighborhood association voted to modify our convenant for what I believe was the first time since the neighborhood’s inception, sometime around 1920. The primary motivator was to raise association dues; they were stuck at an appallingly low $5 per year, with a voluntary $30 security fee also levied to keep Bob in donuts and old cop cars. As you might guess, $35 per year per house does not get the neighborhood much. Some landscaping. Dirt day (where they dump big piles of dirt in several strategic places so people can replenish their landscaping; I can’t make this up). And Bob in the cop car with the donuts so we can continue to have “security patrolled” on our lovely “Welcome to Southwood Park” signs.

Along with the dues increase were a couple other changes. One banned renting to people other than family members, to combat the perceived threat of absentee-landlord-ism. And the last one, which everyone rightly seemed ashamed to mention, struck language from our convenant that prohibited people of “Ethiopian or Mongolian descent” from owning property in lovely Southwood Park. As you might imagine, no one wanted to discuss this amendment, we just wanted to get it through. Its a bit disturbing to realize you signed a statement in which you agreed to obey the neighborhood covenant only to find out it includes such blatant bigotry. If the Federal Marriage Amendment ever passes, this is what we’re saddling future generations with: an embarassing 21st Amendment repeat, to be completed under cover of political darkness so they can finally put the embarassing mistakes of forefathers behind them (see: 3/5 Compromise).

So why will future generations need to repeal the hopeful 28th Amendment? Because people will realize that marriage isn’t just about children, its about two people committing to one-another? Perhaps. Or maybe (hopefully) they won’t. Maybe instead the people will demand that same-sex couples be given rights, regardless of this silly amendment, and state legislators, in their desire to remain in office, will construct a seperate but equal institution. We’ll call it civil union for the sake of argument. And while they’re at it, some enlightened state legislatures will define civil unions broadly, as a civil agreement between two people regardless of sex (excepting siblings, first cousins, minors, dogs, cats and Mr. Ed). So when opposite-sex couples have the option of a)entering into a union as an expression of their love to one another, or b)entering into a union that smacks of religious fundamentalism and bigotry, perhaps they’ll choose the former.

Wouldn’t that be deliciously ironic? In their desire to not look like complete assholes, some amendment backers have said, in effect,

“Look, civil unions are one thing; of course those faggots should be able to cry like queens in the hospital when one of them deservingly dies! Just don’t touch marriage. It’s special.”

So what if civil unions are really the more subversive of the two options? What if people finally realize that marriage is a religious ceremony with no business in our government what-so-ever? Here’s hoping.

date:2006-06-05 15:51:41
category:my life, politics

Strategic Debugging

At PyCon this year the folks from Wingware were kind enough to provide free licenses to Wing IDE Professional to all sprint participants. I had tried the free download of Wing back in the 1.x days, and came away… unmoved. It didn’t suck, it just didn’t do anything I couldn’t do with Emacs, vi, or Eclipse. So last week I was dealing with a particularly deep-seated bug in ccPublisher. ccPublisher uses the Zope 3 component model to stitch together software components and then uses events to communicate between them. This particular bug involved an event listener which was responding to events it should have ignored. Something that, well, it’s not supposed to do.

My typical debugging strategy makes liberal use of print statements. I like to think of it as “instrumentation” when in reality it’s just the wrong way. It helps me solve lots of problems but in this situation was no help. So this was an opportunity to actually delve into debugging strategies and try to improve my skills in that area. About the same time that I ran into this bug, I saw an announcement that Wing IDE 2.1 Release Candidate was available. I downloaded Wing IDE Professional 2.1 RC1, used my free license and set up a project. As an editor, Wing IDE has a few really nice features: code completion that works and performs well, code outlining (member listing, etc) and the ability to correct mixed identation (something that has plagued a few source files I’ve worked on). But debugging is where Wing really shines. Once I figured out how to ignore certain exceptions [1], I was able to set breakpoints and watches in such a way that I was able to quickly track down the bug in my code.

So would I actually buy Wing? I’m not sure. At $179 for a single Professional OS license (Wing supports Linux, Windows and Mac OS X), Wing is pushing the boundaries of what I’m willing to pay. There are two other options in my mind: PyDev + Eclipse and Emacs + PDB + PDBTrack. I love Eclipse for Java development, and I can not fathom how companies like Borland intend to compete against it with products like the suck-tacular JBuilder. And PyDev does a passable job of adding Python support to Eclipse. It is telling, however, that it’s never been compelling enough to make me abandon Emacs as my primary Python editor. The real problems are speed — using PyDev under Eclipse is noticeably slower than using Eclipse for Java development. But that’s something they’re working on, so perhaps it will continue to improve.

As I alluded to above, I use Emacs as my primary editor, but Emacs is a bit of black-magic to me: I know enough to be productive, but I’m sure that with a week of intensive training under a real Emacs master I could be even more productive. Witness the 4 days spent with Jim Fulton on the Zope 3 Sprint at PyCon — I had never seen M-x shell before, let alone PDBTrack. PDBTrack is now part of python-mode that allows you to follow the progress of the Python debugger (PDB) in your Emacs buffer as you step through code. So I guess I need to dive into PDB and see how it compares to Wing. Nevertheless, Wing is definitely a valuable addition to my development toolbox.

[1] You have to tell Wing to ignore certain exceptions that it thinks aren’t handled but really are. For example, a call to hasattr(obj, 'attr_name') will attempt to access obj.attr_name; if an AttributeError is thrown, hasattr clears the exception and returns False. However, since the exception is cleared in C code, Wing can’t tell that this isn’t a “real” exception. Luckily Wing does remember which exceptions you want to ignore, as well as their context (i.e. where the code was called from, etc). A bit annoying, but I’m not sure they can do anything about it.

date:2006-06-05 09:07:40