Advanced Structured Modeling
Advanced Structured Modeling
Advanced Structured Modeling
public Y Y Y Y
protected Y Y Y N
no
Y Y N N
modifier
private Y N N N
Visibility
Abstract, leaf, root and Polymorphic
Elements
• The classes at the top of the hierarchy are more generalized or abstract and the classes
lower in the hierarchy are more specialized. To represent abstract classes for which we
cannot create instances, the class name is written in italics in UML. To represent abstract
methods, we write the operation signature in italics.
Leaf and root classes
• A class which has no child classes is known as
a leaf class. Such a class can be represented by
writing leaf as a property under the class
name.
• a class with no parents is known as a root
class and such a class can be represented by
writing root as a property as a property under
the class name.
Contd.
• Whenever we use a class, we'll probably want to
inherit features from other, more-general
classes, and have other, more-specific classes
inherit features from it. These are the normal
semantics we get from classes in the UML.
• However, we can also specify that a class may
have no children. Such an element is called a leaf
class and is specified in the UML by writing the
property leaf below the class's name.
Operation Signature
• The signature of an operation is the line of text that represents it in
a class or interface on a UML class diagram.
• Syntax
+ OperationName (parameter1 : Type1 [*], ...) : ReturnType [*]
• 2. Static scope
There is just one value of the feature for all
instances of the classifier. This has also been
called class scope. This is notated by underlining
the feature string.
Operations
• A class’s behavioral features are indicated by its
operations.
• <<derive>> Specifies that the source may be computed from the target
• <<friend>> Specifies that the source is
accessible from the target regardless of the
visibility of the source element
• <<use>> Specifies that the source elements depends on the target for
its functionality
There are two stereotypes that apply to
dependency relationships among packages.
Two stereotypes apply to dependency
relationships among use cases
There are three stereotypes when
modeling interactions among objects.
One stereotype applies to dependencies in
the context of state machines
0..1
Person
Chessboard
rank:Rank
file:File
1
1
Square
* 0..1
WorkDesk jobId : int returnedItem
66
Composition
• Composition as well as aggregation
relationships represent whole-part
relationships, in which one thing is a part of
the other thing.
• Composition is graphically represented by
adorning the association relationship with a
filled diamond head near the whole end.
Realization
• Realization is a semantic relationship between
classifiers, where one classifier provides the
specification which is implemented by the other
classifier.
• Realization can exist between an interface and
class, interface and component and between a
use case and collaboration.
• Realization is graphically represented as dashed
line with a hollow arrow head pointing towards
the classifier which provides the specification.
Interfaces, Types, and Roles
• An interface is a collection of operations that are used
to specify a service of a class or a component.
• We use interfaces to visualize, specify, construct, and
document the seams within your system.
• Types and roles provide a mechanism for you to model
the static and dynamic conformance of an abstraction
to an interface in a specific context.
• Graphically, an interface is rendered(represented) as a
circle; in its expanded form, an interface may be
rendered as a stereotyped class(a class with stereotype
interface). An interface name must be unique within its
enclosing package.
Interface contd.
• To realize an interface a class or component
must implement the operations and attributes
defined by the interface.
• Any given class or component may implement
zero or more interfaces and one or more
classes or components can implement the
same interface.
• Each end of the association is called a role. Each role
describes the properties of the equivalent attribute on the
class at the opposite end of the association.
In the example diagram, the association between Menu
and Menu Item has roles called Menu and Contents.
Contents is the name of an attribute on the Menu class.
• instances and object diagram. Basic idea of
behavioral modeling
• Instance is some system entity, concrete
manifestation (implementation) of an
abstraction.
• Class may be modeled as being active, meaning
that an instance of the class has some
autonomous behavior.
• Objects are rendered as instance specifications,
usually on object diagrams. So when we see
instance of a class, we can call it object.
• Instance specification describes instance with
appropriate degree of details, either partially or
completely. The description may include:
• Type of the entity, specified by none, one or more
classifiers of which the entity is an instance.
• Definition of values of structural features of the
entity.
• Specification of how to construct, derive, or
compute the instance.
• Anonymous instance: Customer class instance
without name, anonymous object of customer
class
• Orphan Instance: In some cases, class of an
instance is either unknown or not specified.
An instance named newPatient of some
unnamed or unknown class.
• Named Instance: An object could have all of
instance name, class, and namespace
(package) specified. myCustomer
t : Transaction
• Multiobject : keyCode
• active object (with a thicker border; owns a thread or process
and can initiate control activity)
r : FrameRenderThread
id : SSN = “432-89-1738”
active = True
difference:
instances of a class are called objects or instances; but
instances of other abstractions (components, nodes, use cases, and associations)
are not called objects but only instances.
Object Diagrams
very useful in debugging process.
– walk through a scenario (e.g., according to use case flows).
– Identify the set of objects that collaborate in that scenario (e.g., from use case
flows).
– Expose these object’s states, attribute values and links among these objects.
86
3 basic building blocks of UML - Diagrams
Graphical representation of a set of elements.
Represented by a connected graph: Vertices are things; Arcs are relationships/behaviors.
5 most common views built from
UML 1.x: 9 diagram types. UML 2.0: 12 diagram types
Structural Diagrams Structural Diagrams
Represent the static aspects of a – Class;
system.
Object
– Class;
– Component
Object
– Deployment
– Component
– Composite Structure
– Deployment
– Package