This document looks at common mistakes made and problems encountered when developing applications using the Naked Objects framework.
set... method as
reassigning the variable can have unexpected consequences. To ensure
that you don't add a set method (or your IDE doesn't add one for you)
make the variable declaration private. set... and a get... method and that the
base name is the same and the return type matches the paramter
type.get... method for a business object always
resolve (using resolve(NakedObject))the reference to
that object before returing it. Remember that this is not required in
get... methods for value objects and collections, nor
should it be used anywhere else.set... method for a business object always tell
the containing object (using objectChanged()) that it
contents have change. Remember that this is not required in
get... methods for value objects and collections, nor
should it be used anywhere else.createInstance method and providing the
Class required rather than using Java's new
operator. Remember that the returned reference from this method must be
cast to the required object's type.created method rather than
in the constructor. Remember that the constructor is called every time
an object is retreived from the object store.Don't forget to add a serialization idententifier to each naked objects class you create. E.g:
private static final long serialVersionUID = 1L;
Option field rather than a TextString.
This will allow the user to select from a list rather than having
remember the possible values and correctly type the required one
in.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.