by Brian M. Coyner
I recently attended the Gateway Java Software Symposium in St. Louis, MO. One of the more interesting sessions at this conference, in my opinion, was Dave Thomas' talk on Naked Objects. Naked Objects represents a radical shift in developing GUI applications. In its simplest form, programmers write business model objects, exposing the functionality of that object and its relationships to the end users. The users of the application interact directly with the business model object, therefore anything the object can do the user can do.
Dave points out the obvious: user interfaces are too hard to write and they typically do not provide all the functionality we need. Have you ever walked into a fast-food restaurant and the person taking your order says, "My computer will not let me do that." If so, then you might appreciate what naked objects are trying to accomplish:
unfettered access to all of the object's functionality.
So how does Naked Objects work? Naked Objects is a framework that uses reflection to determine the data and behavior of business model objects. Since reflection is being used you may have guessed that we must follow certain naming conventions. For example, if you define the method
public TextString getFirstName(), then the user interface shows a label and text field representing the first name. The
TextString class represents a Naked Object string, and informs the framework to create a text field that allows the user to manipulate the first name.
Another cool thing is that Naked Objects are manipulated through drag-n-drop and right-click menus. The Naked Objects framework automatically supplies this functionality. Once again, this means that you focus on writing the business model objects and the user interface is automatically generated. Be aware, the generated user interface is very different to what typical users are used to. For example, each object is represented in its own non-modal window. This means if you have a
Customer object and you are working with three instances, "Bob", "Chuck", and "Joe", then you will have three open windows. Of course, this may change if the Naked Object framework grows.
What about persistence? Ah, another great question. The Naked Objects framework supports JDBC and EJB, as well as writing out to XML files. When unit testing you can use a transient persistence mechansim.
Should You Care?
Is Naked Objects the wave of the future? Probably not. It is a cool idea, though, that may work well for certain types of applications. I have tried to think of how naked objects would fit into my current project. To be honest I don't think it's a good fit because we have a very structured system, where naked objects, as they are today, appear to work well with loose and interactive systems.
Here's a quote from Dave's presentation: "Even if you never use the Naked Objects Framework, think about how the approach might affect your future designs."
Perhaps one day I'll get around to writing a full-blown article. Until then the Naked Objects website provides some good example applications to play with. Enjoy!
does this slow things down?
all that reflection going on... instead of :
does this slow things down?
I haven't used the framework yet, but my guess is that this would not appreciably slow things down. The user's interaction (e.g., typing, clicking, etc.) is going to be many, many orders of magnitude slower than the reflection processing. Besides, reflection is much faster in JDK 1.4 than it was in JDK 1.1.
Related to Morphic?
Morphic was a direct-manipulation UI toolkit originally part of Self, developed at Sun. Its alive and well and living in Squeak Smalltalk: http://minnow.cc.gatech.edu/squeak/30
Thanks for the publicity on Naked Objects - we wantto get word out. Please note that in the latest release of the framework, all objects are shown within a single window (i.e. a workspace) not in separate windows as in the version Dave Thomas was using. Several other big improvements have been made.