UML Diagram of a Solution to Expression Problem

This page documents UML diagrams for the solutions to the Expression Problem using object algebras as described  here  by Bruno C. d. S. Oliveira and William R. Cook. Consider a simple expression evaluation consisting only of “literal” and “add”. The UML class diagram is shown below:

start
Augmenting the above with the “subtract” operator  yields the following class diagram:
Sub

 

Now if we want to add a Print feature in addition to the Eval Feature we would add classes as show below:

Print

Notice that since Print starts off with “lit”, “add” and “sub”, there is no need multiple inheritance as for Eval.

Comments

The solution appears simple enough that you may wonder what the fuss is all about. It is more likely a case of a solution becoming obvious after the solution is given.

 

Advertisements

About The Sunday Programmer

Joe is an experienced C++/C# developer on Windows. Currently looking out for an opening in C/C++ on Windows or Linux.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s