304 Migrating Applications from WebLogic, JBoss and Tomcat to WebSphere V6
Good OO approaches and thinking lead to elegance, reusability and easier
maintenance. Good OO approaches and thinking are surprisingly rare among
developers using OO languages and technologies. Use of design patterns and
IDE tools can help guide the developer into good OO practices but
understanding OO design principles is fundamental.
Unified Modeling Language (UML) is a visual way of expressing concepts in
software development. Use cases and class architectures, for example, can be
expressed unambiguously. Unified Modeling Language does not have to be used
but developers need to have a way of communicating design ideas clearly and
without extraneous details. Unified Modeling Language class diagrams, for
example, are one view of the OO component architecture. They show the entities
that the developer wants to show and do not show those that would confuse
issues. Rational Rose and Rational Application Developer V6 both have UML
diagram capabilities. It is recommended that developers use this functionality.
Tip: There are two basic OO principles that we especially recommend
because of the many benefits that are associated with their use:
Coding to interfaces
This principle is coding to interfaces instead of concrete implementations.
The interface is the contract between the provider of a service and the
client. Changing the implementation does not break this contract; only a
change in the interface can do this.
This principle can be seen as an extension to the first one. Using
inheritance instead of object composition causes problems, because
subclasses directly depend on the parent class. A change in the parent
class might break classes down further in the inheritance hierarchy.
A better strategy is to use object composition in combination with the
principle of coding to interfaces. This results in finer-grained objects that
are used through a façade that hides the implementation details. The
objects are assembled at runtime, by Dependency Injection or code, which
has the added benefit of allowing you to easily switch the implementation.