Skip to main content

Communicating with names

Posted by daniel on May 18, 2004 at 8:11 AM PDT

"Whether it's fair or not, people judge you by the words you use."

Although that line comes from a radio advertisement trying to sell you a vocabulary building tool, it applies as well to your choice of names for concepts as well as for variables, methods, and classes. I originally was thinking of this quote in the context of a discussion I recently read in Chamond Liu's book "Smalltalk, Objects, and Design" of composition vs. inheritance. Liu decided to use, what he refers to as, the more evocative word "buy" instead of compose. He cites Eiffel creator Betrand Meyer for first using this word in that context. Instead of saying that an automobile object is composed of four wheels, an engine, ... you say that to create an automobile object you buy four wheel objects, an engine,... In other words you are deciding whether to buy or to build. Just this change of wording helps change the way you understand and make decisions.

I think it's completely fair that people judge you by the words you use. I think it's mostly ok that people judge me by the words I use. Tim O'Brien picks up where Andy Lester left of and specializes the discussion examples in Java code of Ill-monikered Variables and Creative Class Naming. Tim rails against names for variables that just mimic their type such as Collection collection and Iterator iterator and doesn't like the following much better: firstNameString or lastNameString.

O'Brien writes "Code is language; nouns, verbs, adjectives, pronouns are all identified by context, not by some distracting suffix. You should know what a variable *is* by the context it appears in. Write concise code, and read it like prose. And, along those lines, make sure that the code is somewhat interesting to read [...]
If something is important, use an interesting word."

Jimothy (yes, he's everywhere) disagrees. He provides the real-life sample code

BufferedOutputStream buffy = new BufferedOutputStream(...);

He comments, "Aww, how cute. The theme continued a few lines later with a variable named 'angel'. Incidents like this make me disagree with your encouragement of creative variable names." O'Brien responds in turn, concluding that " I'm only trying to encourage people to use bolder language."

Our other link in
Also in Java Today
, is to The top 10 (more or less) J2EE best practices in which Kyle Brown, Keys Botzum, and Ruth Willenborg recommend that you "Always use MVC, Apply automated unit tests and test harnesses at every layer, [ and] Build what you know." Their generic J2EE advice is to "Develop to the specifications, not the application server, [and] Plan for using J2EE security from Day One." The specifics include "Always use Session Facades whenever you use EJB components, Use stateless session beans instead of stateful session beans,
Use container-managed transactions, Prefer JSPs as your first choice of presentation technology, [and]
When using HttpSessions, store only as much state as you need for the current business transaction and no more."

Rich Burridge also looks at The Elements of Programming Style in today's Weblogs. He talks about Brian Kernigan and P.J. Plauger's classic "The Elements of Programming Style" and reminds us where programming was at the time the book first appeared. Burridge links to a page that summarizes the elements and comments that most of them hold up today.

Kito Mann continues to provide a comprehensive conference report in TheServerSide Symposium - Day 2. Mann certainly gets the most out of a conference. He reports on presentations on Hibernate, OptimalJ, Lucene and Nutch, Macromedia's Flex, WebWork, and Marc Fleury's keynote on "Professional Open Source and Projects".

James Gosling provides a quick link to two articles from the Economist magazine in his entry Bubble? What Bubble? The articles "The dotcoms come of age" and "A perfect market" together "describe the incredible current success of the internet."

In today's Projects and Communities , the Java Communications community's Java Socket Simulator offers "primitives that mimic the java abstractions for sockets, processes and threads so that these can be replaced in existing java code, thus reducing the pain of constructing distributed simulations and enabling code re-use."

JDiplomacy, in the Java Games community games forge aims to recreate the classic board game Diplomacy as a multi-player online game, complete with an "arbiter" of the game's "everyone moves at once" system.

Building on Jonathan Simon's recent blog, he and Joshua Marinacci are hosting a forum on Swing Usability. They write "Swing has its share of issues - its slow, hard to use for beginners, requires a lot of customization, and more. At the same time, Swing is a very powerful user interface package with great flexibility for almost limitless customization. There are a lot of reasons to use Java, but not without a sufficient UI toolkit."

The Mythical Man Month discussion is coming to a close.
In today's Forums, John Mitchell asks " If code is the critical product of programmers' efforts, how come code is so often treated so cavalierly? For example, how many programmers and organizations do you know that don't use any source code management system (SCM)? Even worse, IMHO, is the use of SCM's which have a clear history of corrupting if now outright destroying data.

Do you think the problem is ignorance or incompetence or what?"

In today's News Headlines

Registered users can submit news items for the href=""> News Page using
our 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
News RSS feed

Current and upcoming
Java Events

Registered users can submit event listings for the href=""> Events Page using our href=""> events submission
form. All submissions go through an editorial review before being
posted to the site.

Archives and Subscriptions: This blog is delivered weekdays as the
Today RSS feed
. All members can subscribe to the email
updates for the site at the href="">
java-net Mailing Lists page. You must be logged in to subscribe
the javanet_Daily and javanet_Weekly lists. Also, once this page
is no longer featured as the front page of
it will be archived along with other past issues in the href=""> Archive.