0% found this document useful (0 votes)
3 views

Unit - II Oomd

The document provides an introduction to structural modeling in UML, focusing on the importance of classes as the building blocks of object-oriented systems. It explains the key components of classes, including attributes, operations, and relationships such as dependency, generalization, and association. Additionally, it discusses how to effectively model classes and their relationships to represent the system's framework.

Uploaded by

lucifersivaji
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Unit - II Oomd

The document provides an introduction to structural modeling in UML, focusing on the importance of classes as the building blocks of object-oriented systems. It explains the key components of classes, including attributes, operations, and relationships such as dependency, generalization, and association. Additionally, it discusses how to effectively model classes and their relationships to represent the system's framework.

Uploaded by

lucifersivaji
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

UML

Unit – II
2.1. Introduction to Structural Modeling

Structural model represents the framework for the system and this framework is the place
where all other components exist. Hence, the class diagram, component diagram and
deployment diagrams are part of structural modeling.

Structural modeling captures the static features of a system.

2.2 Classes:

 Classes are the most important building block of any object-oriented system.

 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.

 We can use classes to represent software things, hardware things, and even things that
are purely conceptual.

 A class is an abstraction of the things that are a part of your vocabulary.

 A class is not an individual object, but represents a whole set of objects.

 The most important parts of an abstraction: its name, attributes, and operations.

 Graphically, a class is rendered as a rectangle.

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
2

Names

 A class name must be unique.


 Every class must have a name that distinguishes it from other classes.
 A name is a textual string. That 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.

Attributes
 Attributes are related to the semantics of aggregation.
 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 name may be text, just like a class name.
 an attribute by stating its class and possibly a default initial value

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
3

Operations

 An operation is the implementation of a service that can be requested from any object of the
class to affect behavior.
 A class may have any number of operations or no operations at all.
 An operation name is a short verb or verb phrase that represents some behavior of its
enclosing class.

Organizing Attributes and Operations


 When drawing a class, you don't have to show every attribute and every operation at once.
 In fact, in most cases, you can't (there are too many of them to put in one figure) and you
probably shouldn't (only a subset of these attributes and operations are likely to be relevant
to a specific view.

Responsibilities
 Responsibilities are an example of a defined stereotype.
 A responsibility is a contract or an obligation of a class.
 A class may have any number of responsibilities, although, in practice, every well-
structured class has at least one responsibility and at most just a handful.

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
4

Common Modeling Techniques of Class:

1. Modeling the Vocabulary of a System

2. Modeling the Distribution of Responsibilities in a System

3. Modeling Nonsoftware Things

4. Modeling Primitive Types

When drawing classes in the UML

 Show only those properties of the class that are important to understanding the abstraction
in its context.

 Organize long lists of attributes and operations by grouping them according to their
category.

 Show the related classes in same class diagrams.

2.3 Relationships:

 In object-oriented modeling, there are three kinds of relationships that are especially
important: dependencies, generalization and association.

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
5

Dependency

 A dependency is a using relationship that states that a change in specification of one thing
may affect another thing that uses, but not necessarily the reverse.

 Graphically, a dependency is rendered as a dashed directed line, directed to the thing being
depended on.

 Use dependencies when you want to show one thing using another.

Generalization

 A generalization is a relationship between a general thing ( superclass or parent)and a more


specific kind of that thing ( subclass or child).

 Generalization is sometimes called an "is-a-kind-of" relationship: one thing is-a-kind-of a


more general thing.

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
6

 A class can 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.
 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.
Association
 Associations and dependencies (but not generalization relationships) may be reflective.
 An association is a structural relationship that specifies that objects of one thing are
connected to objects of another.
 An association connecting two classes, you can navigate from an object of one class to an
object of the other class, and vice versa.
Name: An association can have a name, and you use that name to describe the nature of the
relationship.

Role: Roles are related to the semantics of interfaces, 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

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
7

Multiplicity: An association represents a structural relationship among objects. In many modeling


situations, it's important for you to state how many objects may be connected across an instance of
an association.

 You can show a multiplicity of exactly one (1), zero or one ( 0..1), many (0..*), or one or
more (1..*).

Aggregation: A plain association between two classes to represents a "has-a" relationship,


meaning that an object of the whole has objects of the part
 To model a "whole/part" relationship, in which one class represents a larger thing (the
"whole"), which consists of smaller things (the "parts"). This kind of relationship is called
aggregation

Realization:

 A realization is a semantic relationship between classifiers in which one


classifier specifies a contract that another classifier guarantees to carry
out.

 A realization is a semantic relationship between classifiers in which one


classifier specifies a contract that another classifier guarantees to carry
out.

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
8

 Use realization in two circumstances: in the context of interfaces and in the


context of collaborations.

Realization of Interface

Realization of Usecase

III YEAR-II SEMESTER A.Y.2024-25 CSE


UML
9

III YEAR-II SEMESTER A.Y.2024-25 CSE

You might also like