0% found this document useful (0 votes)
23 views50 pages

Understanding Static Modeling in UML

Static modeling is a phase in the software development life cycle (SDLC) that focuses on the static view of a system, detailing objects, classes, and their relationships without addressing dynamic behavior. It includes class diagrams that describe object types and their relationships, and distinguishes between analysis and design phases, with specific outcomes and stakeholders. Key concepts include class attributes, operations, relationships such as associations and generalizations, and modeling techniques like the Noun Verb Method and CRC cards.

Uploaded by

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

Understanding Static Modeling in UML

Static modeling is a phase in the software development life cycle (SDLC) that focuses on the static view of a system, detailing objects, classes, and their relationships without addressing dynamic behavior. It includes class diagrams that describe object types and their relationships, and distinguishes between analysis and design phases, with specific outcomes and stakeholders. Key concepts include class attributes, operations, relationships such as associations and generalizations, and modeling techniques like the Noun Verb Method and CRC cards.

Uploaded by

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

Static Modeling

UNIT II
SMD (TE COMPUTER)
Static Modeling

X Modeling is one of the phases in SDLC.


X Basically it is of two types: Static and Dynamic
X Static Modeling shows static view of the system.
X It shows participated objects, classes or components in system and their relationship.
X It does not deal with dynamic behavior of the system.
X Eg: static dia are class dia, object dia , package dia etc…..
Analysis VS Design

Analysis Design
X It define and explore problem domain X It explore solution domain and applies
X It is conducted by system analyst or X It is conducted by system architects,
business analyst or system , etc.. developers or system analysts.
X The outcome of analysis is SRS document. X The outcome of design phase is low level
system design or detailed design
documents.
X The primary components formulated during
X The primary components formulated during
the analysis phase is requirement
the design phase is static & dynamic view
specification for diff modules and their
of the system in the form of various
description in terms of use cases, stories
diagrams.
etc..
X system architects, developers or system
X System analyst, customers , end users,
analysts, project managers are the primary
business analysts , product owners are the
stakeholders.
primary stakeholders.
Class Diagram

X A class diagram describes the types of objects in the system and the various kinds of static relationships
that exist among them.

X A graphical representation of a static view on declarative static elements.

X A central modeling technique that runs through nearly all object-oriented methods.

X The richest notation in UML.


Classes

A class is a description of a set of objects that


ClassName share the same attributes, operations,
relationships, and semantics.
attributes
Graphically, a class is rendered as a rectangle,
usually including its name, attributes, and
operations
operations in separate, designated
compartments.
Class Names

ClassName The name of the class is the only required


tag in the graphical representation of a
attributes class. It always appears in the top-most
compartment.
operations
Class Attributes

Person
An attribute is a named property of a
name : String
class that describes the object being modeled.
address : Address
In the class diagram, attributes appear in
birthdate : Date
the second compartment just below the
ssn : Id
name-compartment.
Class Attributes (Cont’d)

Attributes are usually listed in the form:


Person
attributeName : Type
name : String A derived attribute is one that can be
address : Address
computed from other attributes, but
birthdate : Date
doesn’t actually exist. For example,
/ age : Date
a Person’s age can be computed from
ssn : Id his birth date. A derived attribute is
designated by a preceding ‘/’ as in:
/ age : Date
Class Attributes (Cont’d)

Person

Attributes can be:


+ name : String
+ public
# address : Address
# protected
# birthdate : Date
- private
/ age : Date
/ derived
- ssn : Id
Class Operations

Person

name : String
address : Address
birthdate : Date Operations describe the class behavior
ssn : Id and appear in the third compartment.
eat
sleep
work
play
Relationships

In UML, object interconnections (logical or physical), are


modeled as relationships.

There are three kinds of relationships in UML:

• dependencies

• generalizations

• associations
Dependency Relationships
A dependency indicates a semantic relationship between two or more elements.
The dependency from CourseSchedule to Course exists because Course is used in
both the add and remove operations of CourseSchedule.

CourseSchedule
Course
add(c : Course)
remove(c : Course)
Generalization Relationships

Person A generalization connects a subclass


to its superclass. It denotes an
inheritance of attributes and behavior
from the superclass to the subclass and
indicates a specialization in the subclass
of the more general superclass.

Student
Generalization Relationships (Cont’d)

UML permits a class to inherit from multiple superclasses, although some programming
languages (e.g., Java) do not permit multiple inheritance.

Student Employee

TeachingAssistant
Three Types of Relationship in Class Dia

1. Association between classes


2. Class Hierarchies : Composition & Aggregation
3. Class Hierarchies : Generalization & specialization
Associations Between Classes

X Associations between classes are generally shown as solid lines


connecting the associated classes.
X A notable exceptions to the solid line rule are the use of dashed lines to
depict dependencies as special case of association,
17
Associations

X A semantic relationship between two or more classes that specifies connections among their
instances.
X A structural relationship, specifying that objects of one class are connected to objects of a second
(possibly the same) class.
X Example: “An Employee works for a Company”

Employee Department Company

UML Class Diagrams


Association Relationships

If two classes in a model need to communicate with each other,


there must be link between them.
Link
An association denotes that link.

Student Instructor
Binary Associations:-

X There is a bidirectional relationship bet the classes which are associated.

X For ex: students register for subject is one way of thinking the association
and another is subjects enrols students.

X Therefore there is association bet two classes and so called binary


association.
20
Multiplicity in Associations

X Multiplicity
X The number of instances of the class, next to which the
multiplicity expression appears, that are referenced by a single
instance of the class that is at the other end of the association
path.
X Indicates whether or not an association is mandatory.
X Provides a lower and upper bound on the number of instances.
21

X Multiplicity Indicators

Exactly one 1

Zero or more (unlimited) * (0..*)

One or more 1..*

Zero or one (optional association) 0..1

Specified range 2..4

Multiple, disjoint ranges 2, 4..6, 8


X Types of multiplicity association:

1. One to one association


2. One to many association
3. Many to many association
X One to one association:-
Example:- Every college has one principal and one principal can administer
only one college. So the relation bet principal and college class is one to
one.
X One to many association:-
Example: student s studies in only one college but one college has multiple
students.
X Many to many association:-
Example: - subjects and students. Many students can register to many
subjects and vice versa.
Association Relationships (Cont’d)

We can indicate the multiplicity of an association by adding multiplicity adornments to


the line denoting the association.

The example indicates that a Student has one or more Instructors:

Student Instructor
1..*
Association Relationships (Cont’d)

The example indicates that every Instructor has one or more Students:

Student Instructor
1..*
Association Relationships (Cont’d)

We can also indicate the behavior of an object in an association (i.e., the role of an
object) using rolenames.

teaches learns from


Student Instructor
1..* 1..*
Association Relationships (Cont’d)

We can also name the association.

membership
Student Team
1..* 1..*
Association Relationships (Cont’d)

We can specify dual associations.

member of
1..* 1..*
Student Team
1 president of 1..*
Association Relationships (Cont’d)

We can constrain the association relationship by defining the navigability of the


association. Here, a Router object requests services from a DNS object by sending
messages to (invoking the operations of) the server. The direction of the association
indicates that the server has no knowledge of the Router.

Router DomainNameServer
Association Relationships (Cont’d)

Associations can also be objects themselves, called link classes or an association


classes.
Registration
modelNumber
serialNumber
warrentyCode

Product Warranty
Association Relationships (Cont’d)

A class can have a self association.

next

LinkedListNode
previous
Class Hierarchies: Composition and Aggregations

X In static Modelling , Complex real world object are mapped into abstract designing &
programming worlds object. The object attributes & operation are first specified in
suitable classes & relationships are identified.
X There are possible scenarios when identified class is made of other classes. Such
relationship is described by the composition and aggregation relationship and also
called whole / part relationship.
Aggregation Relation

X Aggregation – A hollow diamond is attached to the end of the path to


indicate aggregation. The diamond is attached to the class that is the
aggregate. Aggregation provides a definitive conceptual whole part
relationship
Association Relationships (Cont’d)

We can model objects that contain other objects by way of special associations called
aggregations and compositions.

An aggregation specifies a whole-part relationship between an aggregate (a whole) and


a constituent part, where the part can exist independently from the aggregate.
Aggregations are denoted by a hollow-diamond adornment on the association.

Engine
Car
Transmission
Association Relationships (Cont’d)

A composition indicates a strong ownership and coincident lifetime of parts by the whole
(i.e., they live and die as a whole). Compositions are denoted by a filled-diamond
adornment on the association.

Scrollbar
1 1

Window Titlebar
1 1

Menu
1 1 .. *
X On the whole we understood that Aggregation is a weak aggregation .
For ex College has multiple department , if any one dept get deleted
college will not hamper.

X On the other hand Composition is stUong aggregation where instance one


class made impact to other class. For ex. Smart phone has battery, screen,
processor . Etc.. If anyone get fail then it will make a strong impact to
others. Smart phone will not work . So it is a strong aggregation.
37
Aggregation: Example

contains
League Team
*

Membership aggregation: A league is made up of


Many teams.

4 wheel
made of
Auto engine Strong aggregation.
1

* part

[Link] 5/13/2021
38
Class Hierarchies: Generalization and
specialization

X Generalization is a relationship between a general and a


specific class.
X The specific class called the subclass inherits from the
general class, called the superclass.
X Public and protected properties (attributes) and
behaviors (operations) are inherited.
X Design representation “inheritance” OO concept.

5/13/2021
39
Generalization: Symbol

X It represents “is a” relationship among classes and objects.

X Represented by a line with an hollow arrow head pointing to the


superclass at the superclass end.

5/13/2021
40
Generalization: Example

Vehicle

Car Boat Truck

5/13/2021
41
Combined Example
drives
Person 0..* Vehicle

Car Boat Truck

5/13/2021
Different ways of modeling class
diagram

1. Noun Verb Method

2. CRC (Class Responsibility Collaborator ) Method


Noun Verb Method

X It is a very simple way to find classes, attributes and responsibilities. It analyzes text to find out classes, attributes
and responsibilities. Noun and noun phrases in the text indicate classes or attributes of classes and verb and verb
phrases indicate responsibilities or operation of a class.

X After collection of information analyze it in a very simple way by highlighting it as below.


™ Noun: For example Flight.
™ Noun Phrases: For example Flight number
™ Verb: For example allocate
™ Verb Phrases : For example verify credit card
Different ways of modeling class
diagram : Contd….

CRC Card Method

X Although proponents of the object paradigm often say that identifying objects is a simple and intuitive process, a
number of noted experts admit that this is not always true! …

X The solution is to use the CRC process to determine the classes necessary to the system as part of the design
process for the application.

X CRC (classes, responsibility, and collaboration) cards can be used to visualize and test different class-based models
during the design phase.

X It is a proven technique used and advocated by leading methodologists.


Different ways of modeling class
diagram : Contd….

CRC Card Method

X Write down classes name on the index card

X Next to each class , list the following :

ƒ Responsibilities : problems to be solved ; short verb phrases

ƒ Collaborators : other classes that are sent messages by this class


46

CRC Card

Class Name Collaborations

Responsibilities
47

CRC Card Example


Weather Station Collaborations
User Interface(UI)
Responsibilities
Date
1. Select 24hr/Current Time
2. Set Date Time Temp
3. Display Current Wind
1. Temp(T) Pressure
2. Wind (W) Humidity
3. Pressure (P)
4. Humidity (H)
4. Display 24hours
1. Hi/Lo for (TWPH)
5. Display Trends in TWPH
6. Calibrate Calibrator
48

CRC Card: UserInterface

UserInterface Collaborators
Responsibilities Keypad

Display
1. Input date
2. Input time Temp
3. Input selection Wind
4. Display data Pressure
Humidity
49

CRC Card: Keypad


Keypad Collaborators

Date
Responsibilities
Time
1. Store date
2. Store time Selection
3. Store selection
Account
Responsibilities
Responsibilities
-- handles deposits
• anything that a class knows or does -- reports fraud to managers
(Contract or obligation)

• Free-form text; one phrase per responsibility.


• Technique - CRC cards (Class-Responsibility-Collaborator); Kent Beck and Ward
Cunningham’89

X A collaborator is also a class which the (current) class interacts with to fulfill a responsibility

Customer Account
Opens account Account Knows interest rate Manager
Knows name Knows balance
Knows address Handles deposits
Reports fraud to
manager

50

You might also like