2.3 Getting Started

To start engineering the application, the part of the real world (referent system), which need modeling, is to be analyzed. This analysis will be the basis for the model(Model system). For the purpose of making this model, the diagram editor Freja is used. When you start the Mjølner tool, you will get a window as shown below. This is the source browser and editor (Sif). When making a diagram using the diagram editor (Freja) or graphical user interface (GUI) using the GUI-editor, the source code generated will appear in this window.

[12kb 639x471 GIF]

You have to create a new library file using the New BETA Library... command in the File menu. The library file used here is called MyShop, which results in:

[16kb 790x592 GIF]

To start up the diagram editor you click on the UML command in the toolbar (as indicated in the picture above) and a digram work sheet will appear. With this work sheet it is now possible to make the model, while the source code is generated in the code editor, as you will see.

[5kb 332x184 GIF]

2.4 Modeling

Now look at the assignment. Which concepts of the bookstore, should be considered as classes in the model.
Of course the products need to be modeled. Also a shopping cart, should be modeled. It will now be illustrated how this is done.

To make a class corresponding to the concept product, you first right click on the MyShop-lib box, Then select New and then Local class.

[3kb 309x169 GIF]

A popup window, will now allow you to make your new class. First, I make the class 'Products' and next make the class 'Shopping Cart'.

[9kb 391x300 GIF]

Now lets look at what classifies these concepts, First 'Product': a product has a name, a price and an unambiguous identification. A virtual shopping cart, should have a way of keeping track of the products currently in the cart, and for this shopping cart a total price.
To insert these into the model, you right click on the 'Product' box select 'New' and then 'Attribute', In this popup window, you can now write the name, type of the new attribute, The picture below shows how the product attribute name.

[8kb 406x225 GIF]

The rest of the attributes are inserted in exactly the same way. except for 'productInCart' in the 'Shopping Cart',  which is an one-to-many aggregation between the 'Shopping Cart' and the 'Product'. The way you make an aggregation, is to select Relations in the menu bar, then Aggregations.

[11kb 421x425 GIF]

In a popup menu like shown above, it will then ask you to give the aggregation a name. For lack of a better name, here its called 'ProductsInCart'. Then select the multiplicity of the whole and the part. The multiplicity of the whole is of cause only one, and the part is one-to-many, which is written as 1 to *.
If we now take a look of our model, it should look like

[2kb 349x204 GIF]

The line from the 'Shopping Cart' attribute ProductsInCart to the 'Product' class illustrates the one-to-many aggregation between them.
The black bullets on the right side of the boxes indicates a description connected to the attribute or class. by double clicking on one of the black dots, a new box appears like shown below. Which is the comment connected to the attribute 'name'.

[1kb 328x106 GIF]

Now look at the products, which the bookstore wants to sell through this program: books and CDs. An important information about a book is who has written it, and for CDs who is the artist, so we need two sub-classes, one called book and another called CD.

To make a subclass of a superclass. First make the class which is desires to be the subclasses. This is done like when the 'Products' class was made. Now make a  'Book' class and a 'CD' class. the defining property about a book is the author, and artist for a CD, add these attributes to the new classes, like it was done with the attributes in the 'products' class. Then use the menu Relations and the specialization,

[5kb 270x171 GIF]

now left click on the superclass and right click on the subclass. In this case left click on 'product' and right click on 'book'. Then repeat the procedure to make 'CD' an subclass of product to. The 'book' and 'CD' classes are now specialization's of the concept 'product.

The model should now look like:

[3kb 492x289 GIF]

A common book store usually have more than one book or CD to sell so the application needs to keep track of a list of products.
Now look at the model, it is clear that this list should hold both books and CDs. Here the object oriented language (OOL) comes in handy, because the concept book is a subpattern of product, and will inherit all its properties, as well as the concept of CD is a subpattern of product, which means it is enough to make af list of 'product' objects, then the list will both hold books and CDs.
In the real world all the products will be in a stock room. So what we need is a Stock room class. To make it more simple, the stockroom will always have a copy of the books and CDs, so there is no need to register to number of copies.
By using the same procedure as with the 'ShoppingCart' class, it's easy to make this class. Just make a new class, called 'Stockroom', and make an aggregation, like the one between 'ShoppingCart' and 'product' only here its between 'Stockroom' and 'product'.

The final model should now look like:

[3kb 533x381 GIF]

This analysis/modeling is of cause far from complete, but it suffices for the purpose of showing, how the most general functions of the CASE-tool Freja works. Now to the design of the graphical user interface (GUI)


Mjolner Integrated Development Tool - Tutorial
© 1991-2004 Mjølner Informatics
[Modified: Friday October 27th 2000 at 14:56]