Archive for the ‘Java Bar’ Category

h1

IDE Extortion

October 19, 2007

Why, in the name of all that is binary, is Sun pushing NetBeans down our throats via its tutorials? The new Swing Tutorial teaches how to use NetBeans more than how to code a Swing app. The JavaFX Tutorial is the same. This kind of IDE extortion does little good for the Java community.

Thank the patron saint of programmers for Groovy’s SwingBuilder.

Update – another example: Getting Started with the JavaFX Script Language (for Swing Programmers):

There are two options to choose from when creating your first JavaFX Script application:

h1

Why do people insist on doing EVERYTHING in Java?

August 20, 2007

Why do people insist on doing EVERYTHING in Java?

1. Simple put, most of the time Java is good enough. Shops have infrastructure built around Java–the work necessary to convert to some new bright, shiny technology is rarely worth the time and effort.

2. I believe we’ve been bitten before by false promises so as in industry, we’re a bit gun shy when it comes to wholesale buying of new technology that professes to do it better, faster, cheaper.

3. Java’s shortcomings are well documented and it’s relatively easy to find workarounds. If something in Groovy doesn’t work the way I expect it should, I’ll fall back on Java if the job needs to get done quickly.

h1

Mother of All Mantras

May 13, 2007

Blaine has put out a call to stop using mantras, including some of the catch phrases near and dear to an agilist’s heart, such as YAGNI, for one. His point is that they too often stifle the creative process. Before an idea is fully explored, someone on the team can claim, “That’s not the simplest solution,” and all right-side brain activity ceases. Blaine’s solution is that we don’t use mantras, which I have translated into the Mother of All Mantras: Don’t Use Mantras (DUM).

He’s right. The trouble is we tend to distill an idea down to its simplest form so it can be neatly packaged and easily communicated but in doing so, we squeeze out most of the subtleties of the original thought. Hence, its meaning is ambiguous and open to interpretation. “Simple” doesn’t mean “simplistic,” yet the two words are often used interchangeably.

I find this same ambiguity in the way people toss around design patterns.  Design patterns were intended as a communication aid between software architects, but people being people, they often confuse the issue. Recently, I was asked if there was another name for the Visitor Pattern. The question struck me as very odd, as if someone were doing a crossword puzzle. Yes, the GoF book provides alternate names for some of their patterns but only for purposes of cross-reference, as if to say, “This pattern has multiple names, but let’s agree on one name and use it going forward so we more easily understand each other.”

We tend to apply our own experiences  and prejudices to the meaning of words and phrases. This works fine with art but it doesn’t work well with technology.

If I asked you explain the Factory pattern as defined by the GoF, you may go on and on about where it applies and how you’ve used it, but you would be wrong. I defy you to find the Factory pattern in the GoF book. There isn’t one. There are Abstract Factory and Factory Method.

In short, we can’t totally diregard the tools we use to communicate, but neither can we use them with total confidence. Don’t be afraid to use a mantra or a catch-phrase or rule-of-thumb but always be prepared to explain your idea another way.

h1

The Why of Code

May 5, 2007

There’s been some discussion lately about literate programming and related ideas (syntactic sugar, et. al.) centered around a quote from Abelson & Sussman’s book, Structure and Interpretation of Computer Programs: “Programs must be written for people to read, and only incidentally for machines to execute.”

Nutrun thinks literate programming potentially masks inefficiencies and bugs. By way of example, he says, “The moment something like submit_the_payment_and_send_a_message_to_the_customer…somehow doesn’t send messages to the customer, while making a couple of redundant roundtrips to the database, we’re in trouble.” But that is true whether or not the code is literate.

I think it’s a disingenuous example. The issues here are error-handling and orthogonality rather than whether the method name is or isn’t literate. Literate programming doesn’t prohibit bad programming practices. It’s meant to convey a quick understanding of the code’s purpose. If customers were complaining they weren’t getting their messages, a literate method name clues me in faster than one named, say, “execute.”

It’s obvious that code must be written for both people and machines. The difference is that machines execute code while people interpret it. We need to understand why the code was written. Code doesn’t have to be perfect English but it has to be more than merely readable; it also has to be unambiguous. Literate programming aims to accomplish that goal.

h1

Open Source Will Close the Book on Java

August 19, 2006

I learned Java because it was free. I could download and install it, and write distributable software without spending a red cent. The marketing (“Write once, run anywhere”) didn’t speak to me. The promise of smart toasters didn’t speak to me. I simply didn’t have the resources to buy a C++ compiler. I mention these things in the interest of disclosure because I am apparently too feeble-minded to understand the open source concept. There’s a general concensus that open source is somehow a Good Thing, but no one I know can articulate why this is so.According to Wikipedia, open source software is “software whose source code is published and made available to the public, enabling anyone to copy, modify and redistribute the source code without paying royalties or fees.”

Now, why would I want to do that? I want to use a word processor, not rewrite one. If I find Word somehow inadequate, I use something else. If nothing else is available, I either tolerate the shortcomings of Word or write my own word processor. Believe me, the time it takes me to write a word processor is worth far more than money spent on Word. I have to make a value decision. Life’s full of tough choices, isn’t it?

I suppose the argument could be made that open source allows for and encourages the improvement of software but you’d have to show me proof. I don’t think Open Office is better than Microsoft Office. I don’t think Linux is better than Windows. I have never looked at the source code for Open Office or Linux but I’ve used them both. I might use one or the other for various reasons but, again, that’s a value decision I make.

Having said all that, I have nothing against open source. If a software company releases its source as part of its strategic business plan, more power to them and thanks for all the fish. Some of my best friends write open source software. But I suspect the rabid proponents of open source software are like back seat drivers–they want a free ride but want to tell you how to drive. They aren’t against control as long as they’re the ones who have it.

If there were no argument against open source, I’d shut up. But there are legitimate questions to which the open source crowd does not have answers (and therefore, choose to ignore). Foremost is the concern that Java’s platform independence will deteriorate. Sun’s ex-CEO Scott McNealy points out that Microsoft introduced “features into its own version of Java that wouldn’t work in non-Windows systems.” At work, I use IBM’s Rational Application Developer (RAD). I can’t use the new features of Java 5 because RAD uses an IBM version of Java that hasn’t yet been updated. These are the problems that will plague open source Java.

I say, be careful what you ask for. Leave it alone. If you don’t like the way it is, don’t use it. Do it yourself. But for crying out loud, quit your bitching. Java is already free. Don’t spoil it for the rest of us.

Update: Immediately after posting, I found this. I couldn’t agree more. Very few people are actually interested in Java’s source code.

h1

// This is a comment

August 11, 2006

I recently ran across an blog entry concerning bad code examples. The gist of the article is that even when, nay, especially when, teaching we should use good coding technique. I thought it an excellent point.

Not long after, I ran across this JPA example code over on the GlassFish Project. The code is straightforward, but what caught my attention were the utterly superfluous comments. For example, this snippet under the “Using in J2SE” heading:

// Create EntityManagerFactory for persistent unit named
//
"pu1" to be used in this test
emf = Persistence.createEntityManagerFactory("pu1");

How useful is the comment? Not very. Even worse:

// Begin transaction
em.getTransaction().begin();

Now, really, do we need to document self-documenting code?

h1

InfoQ: “Don’t Call Us We’ll Call You?”

July 4, 2006

InfoQ: If I missed the “contact us” link, I apologize in advance.

I’ve read a couple of entries on javablogs from InfoQ, so jumped over to their site to check it out. I tried to subscribe to their RSS feed with Bloglines but no feeds were available. I surmised I had to register at InfoQ to get the feed. I went ahead and signed up (using a Firefox plugin to generate a password based on the current URL) and when I went to subscribe to my RSS feed (again with Bloglines) I was exposed to the “InfoQ Personalized” feeds for [insert InfoQ member name here]!” I wasn’t too thrilled about the ability of others to subscribe to my own “personalized” feed, but no problem. It turns out my feed wasn’t listed. Evenutally, I received an email from InfoQ with the link to my “personalized” feed so I was able to subscribe in Bloglines manually.

I logged out and then thought I should notify someone at InfoQ of this little problem. When I tried to log back in, a nice little Javascript box pops up to enter my id and password. Well, guess what? My password was invalid because the password generator depends on the URL. I’ve run into this before so I clicked on the “Forgot your password?” link. Nothing happened. No notificiation that email was sent, no “Try Again” message, nothing.

Why am I telling you all this? Because I can’t tell InfoQ since there is no “contact us” link (that I could find) on their site. InfoQ is a new site, launched June 8th. They must be confident their site is perfect or, just as likely, they’re not interested in what you have to say. I will mention here there is a link to “contribute news” but I had no news, just a complaint about the usability of their site.

h1

Is Eclipse Bloated?

June 29, 2006

Ed Burnette at ONJava.com has a nice article about what’s new in Eclipse 3.2 Java Development Tools.

I like most of the new features but it occurred to me that I don’t use most of what Eclipse already offers. In fact, I’m probably unaware of much of Eclipse’s time saving tools. Part of being a good developer is knowing the tools you use, so I realize I should spend more time getting to better know the tool I use every day.

But is Eclipse, touted as “an IDE for anything and nothing in particular,” becoming “an Everything for everything and all things in particular?” Is Eclipse becoming so full of “stuff” that it’s nearly impossible to know and use all of its useful gadgets? If not, at what point does it become Word-like, in that 80% of its users utilize only 20% of its features?

I don’t want to start any IDE flames. Eclipse is an incredible tool and the fact that it’s free is astounding. I’ll continue to use it as long as the “fluff” doesn’t get in my way.

h1

Inventing the Wheel

June 25, 2006

APIs: Howto – O'Reilly ONJava Blog
"…every time I look at JavaMail or Swing I can’t help but think that there should be a set of minimalist top-level classes that provide a simple, clean and obvious way to meet 80:20 requirement that I can then cast to more complicated objects if I need to get real fancy."

Amen. Sun's philosophy has always been that their responsibility was to provide low-level APIs and let programmers do the rest. This result is that developers waste so much precious time re-inventing (in some cases, inventing) the wheel. It's one of the major reasons folks are starting to take a look at Ruby, Groovy, et. al.

h1

NoFluffJustStuff Conference Takes Omaha by Storm

April 2, 2006

Unsurpassed Quality
NoFluffJustStuff just concluded the Greater Nebraska Software Symposium, its first-ever stopover in Omaha, NE. It couldn't have turned out better, despite the stormy weather. The presenters are all first rate–they don't just talk about this stuff; most all have invaluable real-world experience they are willing to share. There is honestly not a dud in the bunch. I'm invigorated (if not a little brain-sore) and anxious to implement some of the techniques and ideas that I walked away with. Seriously, if you are a Java web developer, you owe it to yourself to attend one of these conferences, even if you have to foot the bill yourself.

Test First
The first Saturday of the month the city tests its tornado warning system. This happened while I was in a session given by Venkat Subramaniam. Hearing the siren, Venkat asked what the noise was. We told him it was the tornado warning. The look on Venkat's face was priceless as he looked to duck and cover. "Don't worry, it's just a test," we told him. Without skipping a beat he said, "You should say, 'test' first!"

Happy News
One of the highlights was definately the announcement that they'll be back in Omaha next year. Hoo-rah, I'm going to No Fluff!