Home Books Software Projects Forums

Object-Oriented Calculator

Our newest project is a Java example which we hope will serve the developer community as a tutorial for both the UML as well as the principles of object-oriented design. The example program is a calculator, chosen because of the wealth of design principles which can be demonstrated by this program while still keeping to a manageable size.

In this preview of our project you will find a working program and the beginnings of our discussion of the design. More will soon follow. Some of the object-oriented design principles we hope to discuss are:

  • Inheritance - The class Operation is the ancestor of a number of descendant classes which implement the various operators supported by the calculator.
  • Packages - Separate packages are used for the model and the view and loose-coupling is enforced between classes in these two packages.
  • Patterns - Patterns such as Observer and Factory Method are employed to demonstrate good, established design principles.
  • State - The calculator uses a small state machine to keep track of user input.
  • Interfaces - The interface Value is used to abstract the data type supported by the calculator. Other types could be supported by implementing this interface.

In addition, some of the other topics we hope to discuss include UML design tools, Java IDE's, requirements, testing, and software metrics.

The project is open-source and uses the GPL license. Please read and understand the license if you are new to open-source. More details for developers will soon follow on these pages; for now, please visit the discussion forum for this project.

UML Diagrams:

Class
Sequence
UML in SVG: Source:

JAR:


Valid XHTML 1.0!