The following screenshot shows a typical Naked Objects application in use. It is a expense claim system that allows employees to prepare and managers to maintain expense claims. Each icon on the screen represents an object where the larger ones on the left represent the classes, or types, of objects available in the system.
Each class of object that the user can start working with (create new instances, find existing instance etc) is displayed in the classes window (on the left). Each object created is available to the user and when displayed appears as shown here in the remaining windows.
Each object can be viewed in ways that are suitable for that object - collections can be viewed as tables and lists, customers as forms etc. Each business object also has a menu which is used to access the capabilities of that object. The value objects - text, numbers, dates - held by a business object can be edited using the keyboard and mouse.
The business objects can also be dragged and dropped onto other business objects or into empty fields that require that type of object.
To build such system you concentrate on those business objects - Customer, Call, Order, Invoice, Flight, Airport, Plane, Crew etc - and leave the interface and persistence to the framework. These objects are defined as Java classes following a small number of coding conventions and the implementation of an interface provided by Naked Objects. An example of such a class is shown below.
package ecs.delivery;
import org.nakedobjects.object.*;
import org.nakedobjects.object.value.*;
public class CreditCard extends AbstractNakedObject {
private static final long serialVersionUID = 1L;
private final TextString nameOnCard;
private final TextString number;
private final TextString expires;
public CreditCard() {
expires = new TextString();
nameOnCard = new TextString();
number = new TextString();
}
public final TextString getExpires() {
return expires;
}
public final TextString getNameOnCard() {
return nameOnCard;
}
public final TextString getNumber() {
return number;
}
public Title title() {
String num = getNumber().stringValue();
int pos = Math.max(0, num.length() - 5);
return new Title("*****************".substring(0, pos)).concat(
num.substring(pos));
}
}
Copyright (c) 2002 - 2004 nakedobjects.org
You may print this document for your own personal
use, or you may copy it in electronic form for access within your
organisation, provided that this notice is preserved.