Skip to main content

This may be a stupid question, but

Posted by daniel on December 30, 2003 at 8:26 AM PST

How often have you heard a question that begins like that and leaves you thinking deeply and answering "I'm not sure". You scratch your head and think, that's definitely not a stupid question.

That isn't to say that all stupid questions are created equally. Some highlight an issue that has multiple answers and amounts to the questioner seeking guidance from those with more experience. Others can be answered with a quick pointer to relevant docs. Others are unanswerable. Some of them actually are stupid.

I'm sure you know someone who answers these "I have a stupid question" questions by first advising "There are no stupid questions." I'm not one of those people. I think there are plenty of stupid questions. More accurately, I think there are many questions asked by people who haven't done their part to think through the question and search for possible answers first.

Sometimes this lack of due diligence is through laziness and sometimes it is because the questioner didn't know where to start. Before there was a J2SE, when the releases were just referred to as JDK, we were overwhelmed at the size increases from JDK 1.02 to JDK 1.1. Add the explosion in classes that occurred in J2SE 1.2 and onward and you can see why a developer may need a pointer now and then to know where to start looking.

We're starting a new feature on for those (Not So) Stupid Questions . These aren't questions that can be easily answered by checking out the relevant docs. These are questions like our first one which asks "when the choice isn't forced by a use of static variables, when should you use static methods". If you have thoughts on the question, please add your thoughts to the talkback - but be kind. Someone has asked a legitimate question and can benefit from your advice and guidance. Also, feel free to submit your own question for a future feature.

Ron Hitchens, author of Java NIO, submits his first entry in today's
Weblogs . In The End of the Beginning? Ron extends Nicholas G. Carr's analysis of the IT industry to software development saying "Throughout their lifecycles, each has initially transformed - or disrupted - their environment and then themselves been transformed because of the changes they brought about. I believe software development is entering such a mid-life, transformative stage - it's changing because of the changes it's caused in business and society."

He discusses a change that he noticed after using IntelliJ's Idea where he "began to think of coding less as a text editing activity and more as an object crafting activity."

Rather than thinking of the code as lines of text, I now conceptualize it as chunks of functionality that can be split, combined or reshaped as needed. The chore of making changes to the text files is handled by the tool. I'm able to devote my concentration to the more important aspects of programming: responsibilities, relationships, cohesion, coupling, patterns, and all the other stuff that makes for well engineered software. And when I see that something needs to be changed I don't hesitate because the tool can make the change easily - even if that change may affect a hundred source files. This makes for better code and it makes me a better coder. [...]

If tools can liberate us from mundane text editing and we code so much better when interacting with a more wholistic model, why do we bother to keep the text file representations at all? In today's world, it certainly seems as though building programs by manually munging text files is one of the least efficient - and most expensive - ways to go about it.

I'm beginning to think that Michael Nascimento Santos has a book inside of him begging to get out. His latest entry is simple method call: that is all it takes . He underlines the often ignored fact that "An application exception does not cause the container to rollback a transaction. " In other words, "Transactions are not automatically rolled back when you throw your custom Exception-derived instance. [... But ] you throw a RuntimeException or a javax.ejb.EJBException to wrap a checked exception, you are safe.

In Also in Java Today we link to the JavaWorld article Sizeof for Java. Vladimir Roubstov discusses why you might want an indication of an object's size. He also asks, " given that you usually deal with object graphs, what is the definition of an object size? Is it just the size of the object instance you're examining or the size of the entire data graph rooted at the object instance? The latter is what usually matters more in practice." He presents you with code examples for measuring an object's size.

Presenting the right abstraction is a balancing act. In a network application you don't want to pretend that remote objects are local and allow developers to ignore the cost of these calls. Anders Hejlsberg discusses some of these Inappropriate Abstractions with Bill Venners and Bruce Eckel. For the CORBA approach to networking, Hejlsberg says "The nirvana ideal was that you could just say Object obj = CreateMeAnObject(), and then call obj.ThisMethod(), obj.ThatMethod(), and you wouldn't know if that object was over in Thailand, right next door, or in the same process. The problem with that type of programming is: it works great in a single process; it works quite well across processes; it works fairly well in a small intranet; but then it completely sucks thereafter."

In Projects and Communities, we follow a trail from the Java Patterns community homepage that leads to preview chapter downloads from the second edition of the book Designing Webservices with the J2EE Platform. Also, the Java Desktop community is featuring a link to A conversation with Peder Ulander. Ulander describes the Java Desktop System and stresses the attention given to security.

In today's News

Registered users can submit news items for the href=""> News Page using
news submission
All submissions go through an editorial review by news director Steve
Mallet before being posted to the site. You can also subscribe to the
href=""> News RSS

This blog is delivered weekdays as the href="">Java Today
feed. Once this page is no longer featured as the front page of href=""> it will be archived at href=""> You can
access other past issues in the href=""> Archive.