next up previous contents
Next: What were the Benefits Up: Doing the Refactoring Previous: Reaching The Limits

Final Moves

  figure434
Figure 3.1: UML-Diagram of Resulting Design

The final refactorings I make, are to change DatabaseFormat methods from static ones to normal instance methods. By adding a static getInstance() that is able to return single instances of different subclasses of DatabaseFormat I create an access point to the class. Two of those subclasses are created. One for the Progress DBMS the other for Oracle that provide the different syntaxes needed for producing correct SQL statements for those databases. They just overwrite those methods of DatabaseFormat that have to produce different results (see A.3, p.gif).

The database server now uses a parameter supplied in the configuration file to determine which database it is connected to and gets the according instance of DatabaseFormat by using the getInstance() method.

The resulting structure is shown at the UML diagram of the concerned classes (see 3.1, p.gif), which is created using JRefactory (see 2.3.2, p.gif) on the package and by hiding the unwanted classes under the margin.


next up previous contents
Next: What were the Benefits Up: Doing the Refactoring Previous: Reaching The Limits

Michael Hunger
Mit Okt 25 00:48:16 MEST 2000