Building a generic toString() method

Zarar Siddiqi’s blog post on java.net talks about building a generic toString() method to dump out the contents of all the attributes of an instance, which of course is invaluable for debugging.

The thing is, one of the number one rules of architecture is to appreciate and understand what is already out there, what has been done before, and what you can reuse.

The Commons Lang library of useful code includes a ReflectionToStringBuilder class which does exactly the same thing.

OnJava.com: Technologies that may challenge Java’s dominance

OnJava.com have an article by Bruce Tate looking into the future at technologies that may either replace or pave the way for upcoming new technologies that may replace the current ‘new Cobol’, which is Java.

Number one on the list and used throughout the article for examples, is, no surprise, Ruby, and the Ruby on Rails framework.

If this framework does not make it big in the next year or so then it will be interesting to look back to see what else changed as a direct result of the impact that RoR is making, because this technology is sure beginning to pick up some momentum.

Ruby on Rails his mainstream IT news

News.com has an article about Ruby on Rails this morning, bringing RoR into the mainstream news, and possibly giving it the attention that I think it deserves in terms of simplifying web application development.

The article gives an overview of the deverloper, David Heinemeier Hansson, and a brief overview of what RoR is about. This should move RoR onto the radar of significantly more people, and may start up more interest in this relatively new framework.

Java only uses pass by value

There is a discussion on the JavaLobby site about an article written on the javadude.com site explaining how Java only uses ‘pass by value’, and never ‘pass by reference’.

I’ve know this for a long time and blogged about it here in my Java section with what I think is a clear explanation of the sematics of pass by value verses pass by reference.

The point is, although Java has references (everthing that is not a primitive is a reference), all parameters to methods are always passed by value. There is no pass by reference in java. The confusion is in the names being used here, because references are actually passed by value.

If you don’t understand this, look at how parameters are passed by reference in C, and write some code that swaps a parameter passed for another, and how it changes the value being pointed to by the orginal parameter before it was passed to the method. You cannot do this in Java. Java only passes by value.