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!