Link to home
Start Free TrialLog in
Avatar of ExpExchHelp
ExpExchHelpFlag for United States of America

asked on

UML Class Diagram

I'm taking a class that includes a high-level review of UML.   For a small assignment, we need to develop a Class Diagram based on a "Morphological Box" (see JPG posted at:
http://img682.imageshack.us/content.php?page=done&l=img682/8663/morphologicalboxtouml.jpg&via=mupload).

I'm not expecting a solution here.... I'm simply asking if someone could get me some pointers for gettting started.  

Here's what the solution should include:
- Super class
- Sub class
- Example of possible instances

Again, could someone give me an example (pseudo code would be ok) so that I have a solild starting point?

Thanks,
EEH
Avatar of marklorenz
marklorenz
Flag of United States of America image

You'd want to start by examining the concepts in the domain, in this case (looking at the diagram) you'd want Feature, Weight, Length, and Material.  And you'd then have types of Features (i.e. subclasses like NailRemovalFeature, ...), types of Material, ...

The instances would be as shown in the diagram:
- anAngledNailRemovalFeature
- anEightInchHandleLength
- ...

HTH, Mark
Avatar of ExpExchHelp

ASKER

Mark,

thanks... I appreciate the prompt reply.

I'm still not entire sure how to set up those class diagram boxes (with proper syntax).   Is there any chance you'd provide me a sample drawing for one of the sub classes?

Thx,
EEH
Here is part of the Feature class hierarchy.
Class-hierarchy.png
Mark,

I worked on my solution and just noticed your 2nd reply with the example.   I will have to modify my diagram a bit given that "AngledNailRemovalFeature" is a child of NailRemovalFeature.

Besides that change that I'll have to make, could you pls review my current approach and let me know if anything else may be wrong?

Also, based on my naming convention, do the 2 suggested (by you) instances correctly apply?   Or do I need to rename them?

Thanks,
EEH
ClassDiagram.jpg
Mark,

pls see my question above.   In previous post, the attached must have been shrunk by EE.  Given that's tough to read, pls refer to a better image resolution at:
http://img12.imageshack.us/img12/9205/classdiagram.jpg

Thanks,
EEH
In your diagram, you need to separate out the types.  A Feature is not a type of Hammer.  You have good attributes in Hammer, but they are wrong type - Feature should be features (plural, since there can be multiple) and of type List; Length should be length (since attribute and not class) and of type HandleLength (capitalized since class).

You need to show containment relationship (diamond end of line) between Hammer and other classes, not specialization (subclassing).
Mark,

again, I truly appreciate your help on this diagram.  

I've posted an updated (not fully completed) version at:
http://img198.imageshack.us/img198/9205/classdiagram.jpg

A few follow-up questions:
1. I use Visio 2003.   For "features", I did not see a drop-down choice for type=List.   What object/property contains that?

2. I've applied lower cases to all 4 attributes.  
-- length = HandleLength
-- do all of the classes have to have an associated attribute?   E.g. weight=HeadWeight, material=HandleMaterial, etc.

3. Do I need to break out "NailRemovalFeature" with another subclass such as "AngledNailRemovalFeature" (per your suggestion)?

4. Containment relationship.   Right now, I've drawn a containment relationship between Hammer and NailRemovalFeature.   All other 4 classes have simple lines.   Given that I need the "cardinality" relationships (1:1 or 1:0), I'd have five "1s" next to the diamond.   Is it recommended to simply draw the number values (next to subclasses) in a textbox?

Wow, plenty of questions... I hope you don't mind providing me more insights on this topic.   8)

Thousand thanks,
EEH
1- List is an abstraction of other classes.  See if they have any Collection type classes (may have names such as list, map, hash, arraylist, ...).  If only Array, you can use that (tho not technically the same)

2- all attributes must be of some type - like HandleMaterial, but could be simple object class too, such as String, int, ...

3- Angled could be handled via attribute setting, but that's a design choice.

4- The cardinalities can be different - each line is separate relationship.  So, Feature may be 1..* (one or more); Weight would be 1; ...
satisfactory answer?
meant to mention - if ur using visio (which is a fine drawing tool, but not really a UML tool), you should get ArgoUML - it's free and much better for UML development
Mark,

I'm still not entirely certain how to properly draw the class diagram.  

Do I have 2 levels or 3 levels?    I could see that there's more than only 1 answer.   Keeping it simply though, could you pls provide me more specifics on the drawing layout.

Thanks -- I appreciate your patience,
EEH
you would have a Hammer in the middle, with containership relationships to multiple other classes.  These other classes will have hierarchy of one or two subclasses each.
Mark,

wow... I thought this was a rather straight-forward process.   I'm not fully tracking you.  

Besides above mentioned processes, I could think of another scenario such as:
1. Hammer
1.1 Head
1.1.1 NailRemoval
1.1.2 StrikingElement
1.1.3 HeadWeight
1.2 Handle
1.2.1 HandleLength
1.2.2. HandleMaterial

I've attached the Visio file.   Would you mind providing me one complete parent, child, grandchild relationship in the Visio file?   [Note:  changed .vsd to .txt in order to upload it]

Thanks,
EEH
Class-Diagram-v03.txt
ASKER CERTIFIED SOLUTION
Avatar of marklorenz
marklorenz
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Mark:

thousand thanks for the help.   I truly appreciate it.   I've learned a great deal from your response about class diagram objects, attributes, etc.

Again, thanks!
EEH