0% found this document useful (0 votes)
5 views74 pages

Basic Structural Modeling Concepts

Uploaded by

22eg105q11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views74 pages

Basic Structural Modeling Concepts

Uploaded by

22eg105q11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd

UNIT-1 Basic Structural Modeling

UNIT-1 Basic Structural Modeling


Classes
 A class is a description of a set of objects that share the same
attributes, operations, relationships, and semantics.
 A class implements one or more interfaces.
 Classes are used to capture the vocabulary of the system being
developed.
 Classes may include abstractions that are part of the problem domain,
and classes that make up an implementation.
 Classes can represent software things, hardware things, and things
that are purely conceptual
UNIT-1 Basic Structural Modeling
 A class is a description of a set of objects that share the same
attributes, operations, relationships, and semantics.
 Graphically, a class is rendered as a rectangle.
UNIT-1 Basic Structural Modeling
Names
 A class name must be unique within its enclosing package.
 Every class must have a name that distinguishes it from other classes.
 A name is a textual string.
 A name alone is known as a simple name;
 A path name is the class name prefixed by the name of the package in
which that class lives.
 A class may be drawn showing only its name
UNIT-1 Basic Structural Modeling
Attributes:
 An attribute is a named property of a class that describes a range of
values that instances of the property may hold.
 A class may have any number of attributes or no attributes at all.
 An attribute represents some property of the thing we are modeling
that is shared by all objects of that class.
UNIT-1 Basic Structural Modeling
Operations
 An operation is the implementation of a service that can be requested
from any object of the class to affect behavior.
 In other words, an operation is an abstraction of something we can do
to an object and that is shared by all objects of that class.
 A class may have any number of operations or no operations at all.
UNIT-1 Basic Structural Modeling
Example
 In a windowing library such as the one found in Java's awt package,
all objects of the class Rectangle can be moved, resized, or queried for
their properties.
 Invoking an operation on an object changes the object's data or state
UNIT-1 Basic Structural Modeling
 We can specify an operation by stating its signature, covering the
name, type, and default value of all parameters and a return type
UNIT-1 Basic Structural Modeling
Organizing Attributes and Operations
 We can elide a class, meaning that you can choose to show only some
or none of a class's attributes and operations
 To organize long lists of attributes and operations, prefix each group
with a descriptive category by using stereotypes
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Responsibilities
 It is a contract or an obligation of a class.
 When we create a class, all objects of that class have the same kind of
state and the same kind of behavior.
 These attributes and operations carry out the class's responsibilities.
 Ex: A Wall class is responsible for knowing about height, width, and
thickness
 A class may have any number of responsibilities
 Modeling a class, translate these responsibilities into a set of attributes
and operations.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Other Features
 We need to visualize or specify other features, such as
1. The visibility of individual attributes and operations
2. Language-specific features of an operation, such as whether it is
polymorphic or constant.
3. Exceptions that objects of the class might produce or handle.
4. Classes rarely stand alone. Rather, when models are built, focus is on
groups of classes that interact with one another.
5. In the UML, these societies of classes form collaborations and are
usually visualized in class diagrams.
UNIT-1 Basic Structural Modeling
Common Modeling Techniques
Modeling the Vocabulary of a System
To model
 Identify things that users or implementers use to describe the problem
or solution.
 For each abstraction, identify a set of responsibilities.
 Provide the attributes and operations that are needed to carry out these
responsibilities for each class.
UNIT-1 Basic Structural Modeling
set of classes drawn from a retail system
UNIT-1 Basic Structural Modeling
Modeling the Distribution of Responsibilities in a System
To model
 Identify a set of classes that work together closely to carry out some
behavior.
 Identify a set of responsibilities for each of these classes.
 Look at this set of classes as a whole, split classes that have too many
responsibilities into smaller abstractions, collapse tiny classes that
have trivial responsibilities into larger ones, and reallocate
responsibilities so that each abstraction reasonably stands on its own.
 Consider the ways in which those classes collaborate with one
another, and redistribute their responsibilities accordingly so that no
class within a collaboration does too much or too little
UNIT-1 Basic Structural Modeling
set of classes
UNIT-1 Basic Structural Modeling
Modeling Nonsoftware Things
To model
 Model the thing we are abstracting as a class.
 To distinguish these things from the UML's defined building blocks,
create a new building block using stereotypes to specify these new
semantics and to give a distinctive visual cue.
 If the thing being modeled is hardware containing software, model it
as a kind of node, so that it is further expanded on its structure.
UNIT-1 Basic Structural Modeling
Modeling Primitive Types
To model
 Model the thing we are abstracting as a type or an enumeration, which
is rendered using class notation with the appropriate stereotype.
 If we need to specify the range of values associated with this type,
use constraints.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Relationships
 The ways that things can connect to one another, logically or
physically, are modeled as relationships.
 There are three kinds of relationships
1. Dependencies
2. Generalizations
3. Associations
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Dependency(a using relationship)
 A dependency is a using relationship that states that a change in
specification of one thing may affect another thing that uses it, but not
necessarily the reverse.
 It is used when we want to show one thing using another.
 Used to show that one class uses another class as an argument in the
signature of an operation
UNIT-1 Basic Structural Modeling
Generalization (is-a-kind-of relationship)
 It is a relationship between a general thing (called the superclass or
parent)and a more specific kind of that thing (called the subclass or
child)
 A child inherits the properties of its parents, especially their attributes
and operations
 An operation of a child that has the same signature as an operation in
a parent overrides the operation of the parent known as
polymorphism.
UNIT-1 Basic Structural Modeling

 A class may have zero, one, or more parents.


 A class that has no parents and one or more children is called a root
class or a base class.
 A class that has no children is called a leaf class.
 A class that has exactly one parent is said to use single inheritance
 A class with more than one parent is said to use multiple inheritance
 A generalization with a name indicates a decomposition of the
subclasses of a superclass on a particular aspect called a
generalization set
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Association
 It is a structural relationship that specifies that objects of one thing are
connected to objects of another.
 If an association connects two classes, we can relate the object of one
class to an object of the other class
 An association that connects exactly two classes is called a binary
association.
 An associations that connect more than two classes; these are called
n-ary associations
UNIT-1 Basic Structural Modeling
There are four adornments that apply to associations
1. Name
An association can have a name, to describe the nature of the
relationship. Give a direction to the name by providing a direction triangle that
points in the direction we intend to read the name.
UNIT-1 Basic Structural Modeling
2. Role
 When a class participates in an association, it has a specific role that
it plays in that relationship.
 A role is just the face the class at the near end of the association
presents to the class at the other end of the association.
 The same class can play the same or different roles in other
associations.
UNIT-1 Basic Structural Modeling
Multiplicity
 An association represents a structural relationship among objects.
 Its important to state how many objects may be connected across an
instance of an association.
 This "how many" is called the multiplicity of an association's role,
and is written as an expression that evaluates to a range of values or
an explicit value.
 Multiplicity is represented as
 exactly one (1)
 zero or one (0..1),
 many (0..*), or
 one or more (1..*).
 We can even state an exact numbers 0..1, 3..4, 6..*
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Aggregation
 A plain association between two classes
 Represents a structural relationshp between peers, meaning that both
classes are conceptually at the same level, no one more important than
the other.
 Used to model a "whole/part" relationship, in which one class
represents a larger thing (the "whole"), which consists of smaller
things (the "parts") called aggregation
 Represents a "has-a" relationship, meaning that an object of the whole
has objects of the part.
 It is a special kind of association and is specified by adorning a plain
association with an open diamond at the whole end
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Other features
 Composite aggregation
 Navigation
 Discriminants
 Association classes
 Special kinds of dependencies and generalizations.
UNIT-1 Basic Structural Modeling
Common Modeling Techniques : Modeling Simple Dependencies
To model this using relationship
 Create a dependency pointing from the class with the operation to the
class used as a parameter in the operation
 Set of classes drawn from a system that manages the assignment of
students and instructors to courses in a university
UNIT-1 Basic Structural Modeling
Modeling Single Inheritance
To model inheritance relationships
 Given a set of classes, look for responsibilities, attributes, and
operations that are common to two or more classes.
 Elevate these common responsibilities, attributes, and operations to a
more general class. If necessary, create a new class to which you can
assign these elements (but be careful about introducing too many
levels).
 Specify that the more-specific classes inherit from the more-general
class by placing a generalization relationship that is drawn from each
specialized class to its more-general parent.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
 Generalization relationship from four classes
 CashAccount, Stock, Bond, and Property to the more-general class
named Security.
 Security is the parent, and CashAccount, Stock, Bond, and Property
are all children.
 Each of these specialized children is a kind of Security.
 Security includes two operations: presentValue and history
 As Security is their parent, CashAccount, Stock, Bond, and Property
all inherit these two operations, hence, any other attributes and
operations of Security that may be elided
UNIT-1 Basic Structural Modeling
Modeling Structural Relationships
 Dependency and generalization relationship between classes are
asymmetric.
 The class that depends on the other class has knowledge of it but not
the other way.
 The child inherits from its parent but the parent has no specific
knowledge of its children.
 That is dependency and generalization relationships are one-sided.
 Association relationships exists between classes that are peers of one
another.
 Both rely on the other in some way, and you can navigate in either
direction.
UNIT-1 Basic Structural Modeling

 Dependency is a using relationship


 Generalization is an is-a-kind-of relationship
 An association specifies a structural path across which objects of the
classes interact.
UNIT-1 Basic Structural Modeling
To model structural relationships
 For each pair of classes, if you need to navigate from objects of one to
objects of another, specify an association between the two. This is a
data-driven view of associations.
 For each pair of classes, if objects of one class need to interact with
objects of the other class other than as parameters to an operation,
specify an association between the two. This is more of a behavior-
driven view of associations.
 For each of these associations, specify a multiplicity (especially when
the multiplicity is not *, which is the default), as well as role names
(especially if it helps to explain the model).
 If one of the classes in an association is structurally or organizationally a
whole compared with the classes at the other end that look like parts,
mark this as an aggregation by adorning the association at the end near
the whole.
UNIT-1 Basic Structural Modeling

Set of classes drawn from an information system for a school.


UNIT-1 Basic Structural Modeling

 The classes named Student, Course, and Instructor.


 There's an association between Student and Course, specifying that
students attend courses.
 Every student may attend any number of courses and every course
may have any number of students.
UNIT-1 Basic Structural Modeling
Common Mechanisms
 The UML is made simpler by four common mechanisms that apply
throughout the language:
1. Stereotypes
2. Adornments----Notes
3. Common divisions
4. Extensibility mechanisms
UNIT-1 Basic Structural Modeling
Stereotypes
 A stereotype can be thought as a metatype, means a type that defines
other types.
 Each stereotype may provide its own set of tagged values, semantics
(constraints), and notation (its own icon)
 3 ways of rendering the stereotype
1. A name enclosed by guillemets
Ex <<name>> and placed above the name of another element.
2. An icon for the stereotype and render that icon to the right of the
name if basic notation for the element is used.
3. Icon itself is used as the basic symbol for the stereotyped item.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Note
 It is a graphical symbol for rendering constraints or comments
attached to an element or a collection of elements.
 Used to attach information to a model, such as requirements,
observations, reviews, and explanations
 Represented as a rectangle with a dog-eared, together with a
textual/graphical comment.
 We can put a live URL inside a note, or link to or embed another
document.
 Hence, UML is used to organize all the artifacts you might generate or
use during development
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Other Adornments
 They are textual or graphical items that are added to an element's
basic notation and are used to visualize details from the element's
specification.
 Example: the basic notation for an association is a line, but this may
be adorned with such details as the role and multiplicity of each end.
 While using the UML, the general rule to follow is:
1. Start with the basic notation for each element
2. Then add other adornments only as they are necessary to convey
specific information that is important to your model.
UNIT-1 Basic Structural Modeling
 Placing text near the element of interest or by adding a graphic
symbol to the basic notation.
 To adorn an element with more detail than add an extra compartment
below the usual compartments for classes, components and nodes.
UNIT-1 Basic Structural Modeling
Tagged Values
 Tagged value are placed in a note attached to the affected element.
 Each tagged value comprise a string that includes a name((the tag), a
separator (the symbol =), and a value (of the tag)
UNIT-1 Basic Structural Modeling
Tagged Values
 Every thing in the UML has its own set of properties
 ie., classes have names, attributes, and operations
 Associations have names and two or more ends, each with its own
properties.
 With stereotypes, we can add new things to UML.
 With tagged values, we can add new properties
 Tags are defined to apply to individual stereotypes so that everything
with that stereotype has that tagged value.
 A tagged value is not the same as a class attribute.
 It can be thought of as a tagged value as metadata because its value
applies to the element itself, not its instances
UNIT-1 Basic Structural Modeling
Constraints
 We can add new semantics or change existing rules.
 A constraint specifies conditions that must be held true for the model
to be well-formed
 A constraint is rendered as a string enclosed by brackets and placed
near the associated element.
 Some properties of associations (order and changeability) are
rendered using constraint notation.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Standard Elements
 UML defines a number of standard stereotypes for classifiers,
components, relationships, and other modeling elements.
 Stereotype specifies that the classifier is a stereotype that may be
applied to other elements.
 UML also specifies one standard tagged value that applies to all
modeling elements.
 Documentation specifies a comment, description, or explanation of
the element to which it is attached
UNIT-1 Basic Structural Modeling

Profiles:
 It is a UML model with a set of predefined stereotypes, tagged value,
constraints and base class.
 Specialization version of UML for a particular area.
UNIT-1 Basic Structural Modeling
Common Modeling Techniques
Modeling Comments
UNIT-1 Basic Structural Modeling
Modeling New Building Blocks
UNIT-1 Basic Structural Modeling

Modeling New Properties:

 Ensure that there is no possibility of expressing them using basic


UML
 Then define a stereotype and add the new properties to the stereotype.
Here the rule of generalization apply.
 Tagged values defined for one kind of element apply to its children.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Modeling New Semantics
 Make sure that we cannot express them using basic UML
 Write new semantics in a constraint placed near the element to which
it refers(dependency relationship)
 To specify your semantics more precisely and formally, write your
new semantics using OCL.
Object Constraint Language (OCL) A formal language used to express
side effect— free constraints.
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
Diagrams
 View the static parts of a system using one of the four following
diagrams.
1. Class diagram
2. Object diagram
3. Component diagram
4. Deployment diagram
 Use five additional diagrams to view the dynamic parts of a system.
1. Use case diagram
2. Sequence diagram
3. Collaboration diagram
4. Statechart diagram
5. Activity diagram
UNIT-1 Basic Structural Modeling
Common Modeling Techniques
Modeling Different Views of a System
To model
 Decide which views you need to best express the architecture of your
system and to expose the technical risks to your project.
 For each of these views, decide which artifacts you need to create to
capture the essential details of that view.
 As part of your process planning, decide which of these diagrams
you'll want to put under some sort of formal or semi-formal control..
 Allow room for diagrams that are thrown away.
UNIT-1 Basic Structural Modeling
 If we are modeling a simple monolithic application that runs on a
single machine, we might need.
Use case view----------- Use case diagrams
Design view-------------- Class diagrams (for structural modeling)
Interaction diagrams (for behavioral
modeling)
 If it focuses on process flow,
Include statechart diagrams and activity diagrams,(to model
system's behavior)
 If it is a client/server system,
Include component diagrams and deployment diagrams(to model
the physical details of your system).
UNIT-1 Basic Structural Modeling
 If we are modeling a complex, distributed system
UNIT-1 Basic Structural Modeling
UNIT-1 Basic Structural Modeling
If you are modeling a complex, distributed system,
then we may require
UNIT-1 Basic Structural Modeling
Modeling Different Levels of Abstraction
To model a system at different levels of abstraction by presenting
diagrams with different levels of detail
 Consider the needs of your readers, and start with a given model.
 If reader is using the model to construct an implementation, he need
diagrams that are at a lower level of abstraction.
 If he is using the model to present a conceptual model to an end user,
he need diagrams that are at a higher level of abstraction.
 Depending on levels of abstraction, create a diagram at the right level
of abstraction by hiding or revealing the following four categories of
things from the model:
 Building blocks and relationships, Adornments, Flow, Stereotypes
UNIT-1 Basic Structural Modeling
To model a system at different levels of abstraction by creating models at
different levels of abstraction
 Consider needs of readers and decide on the level of abstraction that
each should view, forming a separate model for each level.
 In general, populate the models that are at a high level of abstraction
with simple abstractions and the models that are at a low level of
abstraction with detailed abstractions. Establish dependencies among
the related elements of different models.
 In practice, if we follow the five views of an architecture, there are
four common situations encountered when modeling a system at
different levels of abstraction:
 Use cases and their realization, Collaborations and their realization,
Components and their design, Nodes and their components
UNIT-1 Basic Structural Modeling
Interaction Diagram at a High Level of Abstraction
UNIT-1 Basic Structural Modeling
Interaction at a Low Level of Abstraction
UNIT-1 Basic Structural Modeling
Modeling Complex Views
To model complex views
 To present information at a higher level of abstraction, elide some
parts of the diagram and retain the detail in other parts.
 Even after hiding much detail and diagram is still complex, group
some of the elements in packages or in higher level collaborations,
then render only those packages or collaborations in the diagram.
 If the diagram is still complex, use notes and color as visual cues to
draw the reader's attention to the points.
UNIT-1 Basic Structural Modeling

You might also like