Exam Scope and Notes

Hi Guys! Hope you well!.......good luck! See this as extra reading material:
Let us consider the following issues:
Scope:
I don’t like giving a specific scope. Last year I gave a scope and it was a disaster. I think we view it
from different angles….or actually I do not know. I even gave the mark distribution…
Scope: Chapter 2-5
Diagrams are interrelated. You must understand the activity diagram to really appreciate a sequence
diagram, to use the messages for the class diagram, understanding the states of an object…etc.!
Exam paper: It is OPEN Book/You are free to use the Internet/go to library…then under supervision
of course! BUT it is 3
HOURS
Section A: Theory, 11 Marks (open book)
Section B: theory + practical (MS Visio), 89 Marks(open book)
(Remember that our analysis/development is use case driven) I will give the use case diagram, and
then it is expected from you to:
1. Understand it, fill in a table related to SSD (I’m serious this time..it carries marks) AND draw SSD
2. Develop/draw a class diagram. I want to see your reasoning processes: what happen with the
nouns? Why this noun is suddenly an attribute. Attribute belonging to which class? Why you ignore
this class. Write all the nouns, eliminate the non-classes and arrive at object model.
3. Develop a state machine diagram.
Read the book careful. Some books will say that ALL objects need a state machine. Careful: an
object’s state is defined by the member values/attributes.
Quote: “States and Transitions”, Requirements Analysis and System Design, L Maciaszek
State machine models are constructed for classes that have interesting state changes, not any state
changes. What is interesting or not, is a business modelling decision. A state machine diagram is a
model of business rules. Even use cases must conform to business rules.
Example: the class Rental has an attribute (thePayment). This Rental object can be in different states
as far as the payments for hiring a video is concerned.
The rental is unpaid, partly paid, or fully paid----Yes you right, these are the STATES of the object
Rental:
1
If you understand this, look at our notes again, and the examples we did. The above is most probably
a first cut diagram…not much detail!
I am sure you will have enough time to finish the paper in 3 hours!!
IF YOU ARE CONFUSED WITH THE SCOPE STUDY Ch2-5
Class Association Revision:
What does it mean if we say there is a ONE to MANY association/multiplicity between Department
and Employee?
Always investigate your data: next page
1. Draw a conceptual OO schema or short an Object schema
2. Consider an instance, and draw an object instance diagram
DEPARTMENT
EMPLOYEE
deptID
c
deptName c
deptLoc
c
Employee:
EMPLOYEE
You DO IT
M
2
Draw now the instance diagram for Department 1:
Can you do it? It is not serious, but I just get worried about some answewrs I get in class, when we
discussed something!
DEPARTMENT
OID: DP34
1
Accounting
Dblock F2
[CE001]
Collection of Employees
OID: CE001
[EMP44], [EMP47]
………..
OID: EMP44
OID: EMP47
10
Dube
[DP34]
3
Class Diagrams
We did not finish our discussion on page 99, Fig 4-20 (no-one ask me!)
The UML Class diagram is used to visually describe the problem domain in terms of types of object
(classes) related to each other in different ways.
There are three primary inter-object relationships: Association, Aggregation, Composition
and Generalization/Specialization. Using the right relationship line is important for placing
implicit restrictions on the visibility and propagation of changes to the related classes, a matter which
plays an important role in understanding and reducing system complexity.
Association
The most abstract way to describe static relationship between classes is using
the Association link, which simply states that there is some kind of a link or a dependency
between two classes or more.
Aggregation (Shared Association)
In cases where there’s a part-of relationship between ClassA (whole) and ClassB (part), we can be
more specific and use the aggregation link instead of the association link, highlighting that ClassB can
4
also be aggregated by
as shared association).
other classes in the application (therefore aggregation is also known
It’s important to note that the aggregation link doesn’t state in any way that ClassA owns
ClassB nor that there’s a parent-child relationship (when parent deleted all its child’s are being
deleted as a result) between the two. Actually, quite the opposite! The aggregation link usually used
to stress the point that ClassA is not the exclusive container of ClassB, as in fact ClassB has
another container.
Aggregation v.s. Association
The association link can replace the aggregation link in every situation, while aggregation cannot
replace association in situations where there’s only a ‘weak link’ between the classes, i.e. ClassA has
method/s that contain parameter of ClassB but ClassA doesn’t hold reference to ClassB instance.
Not applicable to us: Martin Fowler suggest that the aggregation link should not be used at all
because it has no added value and it disturb consistency, Quoting Jim Rumbaugh "Think of it as a
modeling placebo".
Composition (Not-Shared Association)
We should be more specific and use the composition link in cases where in addition to the part-of
relationship between ClassA and ClassB - there’s a strong lifecycle dependency between the two,
meaning that when ClassA is deleted then ClassB is also deleted as a result
5
The composition link shows that a class (container, whole) has exclusive ownership over other
class/s (parts), meaning that the container object and its parts constitute a parent-child/s
relationship.
Unlike association and aggregation, when using the composition relationship, the composed class
cannot appear as a return type or parameter type of the composite class. Thus, changes to the
composed class cannot propagate to the rest of the system. Consequently, usage of composition
limits complexity growth as the system grows.
Can you explain now Fig 4-20? Please help me out!!
6
Summary
Aggregation and Composition are subsets of association meaning they are specific cases
of association.



In both aggregation and composition object of one class "owns" object of another class.
But there is a subtle difference. In Composition the object of class that is owned by the
object of it's owning class cannot live on it's own(Also called "death relationship"). It will
always live as a part of it's owning object where as in Aggregation the dependent object
is standalone and can exist even if the object of owning class is dead.
So in composition if owning object is garbage collected the owned object will also be which
is not the case in aggregation.
Not Examinable BUT Interesting:
Measuring system complexity
System complexity can be measured simply by looking at a UML class diagram and evaluating the
association, aggregation, and composition relationship lines. The way to measure complexity is to
determine how many classes can be affected by changing a particular class. If class A exposes
class B, then any given class that uses class A can theoretically be affected by changes to class B.
The sum of the number of potentially affected classes for every class in the system is the total system
complexity. Did you learn something?!
________________________________________________________________________________
Recommended Book on UML
You should read Martin Fowler’s book: UML Distilled: A Brief Guide to the Standard Object Modeling
Language (3rd Edition). It’s pure gold.
7