Download - 7. Object Oriented Modeling
![Page 1: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/1.jpg)
7. Object Oriented Modeling
1
Abdus SattarAssistant Professor
Department of Computer Science and EngineeringDaffodil International University Email: [email protected]
CSE333:Software Engineering
![Page 2: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/2.jpg)
Learning Goals
2
Understand what object-oriented systems analysis and design is and
appreciate its usefulness.
Comprehend the concepts of unified modeling language (UML), the
standard approach for modeling a system in the object-oriented world.
Apply the steps used in UML to break down the system into a use case
model and then a class model.
Diagram systems with the UML toolset so they can be described and
properly designed.
Document and communicate the newly modeled object-oriented system to
users and other analysts.
![Page 3: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/3.jpg)
UML Diagram Types
3
UML (Unified Modeling Language)
![Page 4: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/4.jpg)
Diagram Types
4
A class diagram represents a static view of
the system. It describes the attributes and
operations of classes.
Class diagrams are the most widely used
modeling diagram for object-oriented
systems because they can be directly
mapped with object-oriented languages.
User, Customer, Administrator, Order,
OrderDetails are classes. Each class consist
of attributes and methods. Attributes
describe the properties while methods
describe the behaviors or operations.
![Page 5: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/5.jpg)
Diagram Types(Cont..)
5
Another structural diagram is an object
diagram. It is similar to a class diagram, but it
focuses on objects.
The basic concepts of object diagram are
similar to a class diagram. These diagrams help
to understand object behavior and their
relationships at a particular moment.
The s1, s2, and s3 are student objects, and they
enroll to c1 course object. The l1 lecturer object
teaches the course c1. The lecturer object l2
teaches the special course c2. The Student s3
enrolls to c1 course as well as c2 special course.
This diagram illustrates how a set of objects
relates to each other.
![Page 6: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/6.jpg)
Essential elements Class
Diagram
6
Class Name
Attributes
Operations
![Page 7: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/7.jpg)
Class Names
7
The name of the class is the only required tag
in the graphical representation of a class. It
always appears in the top-most compartment.
![Page 8: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/8.jpg)
Class Attributes
8
An attribute is a named property of a class
that describes the object being modeled.
In the class diagram, attributes appear in the
second compartment just below the name-
compartment.
![Page 9: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/9.jpg)
Class Attributes (Cont’d)
9
Attributes are usually listed in the form:
attributeName : Type
A derived attribute is one that can be
computed from other attributes, but
doesn’t actually exist. For example, a
Person’s age can be computed from
his birth date. A derived attribute is
designated by a preceding ‘/’ as in:
/ age : Date
![Page 10: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/10.jpg)
Class Attributes (Cont’d)
10
Attributes can be:
+ public
# protected
- private
/ derived
![Page 11: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/11.jpg)
Class Operations
11
Operations describe the class behavior and
appear in the third compartment.
![Page 12: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/12.jpg)
Relationships
12
In UML, object interconnections
(logical or physical), are
modeled as relationships.
There are three kinds of
relationships in UML:
Dependencies
Generalizations
Associations
![Page 13: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/13.jpg)
Dependency Relationships
13
A dependency indicates a semantic/notational
relationship between two or more elements.
CourseSchedule has dependency on Course
![Page 14: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/14.jpg)
Generalization Relationships
14
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.
![Page 15: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/15.jpg)
Generalization Relationships (Cont’d)
15
UML permits a class to inherit from multiple super-
classes, although some programming languages
(e.g., Java) do not permit multiple inheritance.
![Page 16: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/16.jpg)
Association Relationships
16
If two classes in a model need to communicate with
each other, there must be link between them.
An association denotes that link.
![Page 17: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/17.jpg)
Association Relationships (Cont’d)
17
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:
![Page 18: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/18.jpg)
Association Relationships (Cont’d)
18
The example indicates that every Instructor has one
or more
Students:
![Page 19: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/19.jpg)
Association Relationships (Cont’d)
19
We can also indicate the behavior of an object in an
association
(i.e., the role of an object) using role names.
![Page 20: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/20.jpg)
Association Relationships (Cont’d)
20
We can also name the association.
![Page 21: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/21.jpg)
Association Relationships (Cont’d)
21
We can specify dual associations.
![Page 22: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/22.jpg)
Association Relationships (Cont’d)
22
Associations can also be objects themselves, called
link classes or an association classes.
![Page 23: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/23.jpg)
Relationships (Aggregation)
23
Aggregation is a special type of association that models a whole- part
relationship between aggregate and its parts.
For example, the class college is made up of one or more student. In
aggregation, the contained classes are never totally dependent on the
lifecycle of the container.
Here, the college class will remain even if the student is not available.
![Page 24: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/24.jpg)
Relationships (Composition)
24
Compositions are denoted by a filled-diamond adornment on the association.
The composition is a special type of aggregation which denotes strong ownership
between two classes when one class is a part of another class.
For example, if college is composed of classes student. The college could contain
many students, while each student belongs to only one college. So, if college is not
functioning all the students also removed.
![Page 25: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/25.jpg)
Interfaces
25
An interface is a named set of operations
that specifies the behavior of objects
without showing their inner structure.
It can be rendered in the model by a one-
or two-compartment rectangle, with the
stereotype <<interface>> above the
interface name.
![Page 26: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/26.jpg)
Interface Services
26
Interfaces do not get
instantiated. They have no
attributes or state. Rather, they
specify the services offered by
a related class.
![Page 27: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/27.jpg)
Enumeration
27
An enumeration is a user-
defined data type that consists
of a name and an ordered list of
enumeration literals.
![Page 28: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/28.jpg)
Exceptions
28
![Page 29: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/29.jpg)
Object Diagrams
29
Model the instances of things described by a class.
Each object diagram shows a set of objects and their
interrelationships at a point in time.
Used to model a snapshot of the application.
Each object has an optional name and set of classes it is an
instance of, also values for attributes of these classes.
![Page 30: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/30.jpg)
Multi objects
30
A multi object is a set of objects, with an undefined
number of elements
![Page 31: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/31.jpg)
Restaurant
example:
Initial classes
31
![Page 32: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/32.jpg)
Restaurant
example:
Initial
classes
32
![Page 33: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/33.jpg)
Example of UML
Class Diagram
33
ATMs system is very simple as
customers need to press some
buttons to receive cash. However,
there are multiple security layers
that any ATM system needs to pass.
This helps to prevent fraud and
provide cash or need details to
banking customers
![Page 34: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/34.jpg)
A class
diagram
for course
offerings
34
![Page 35: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/35.jpg)
Class Diagram:
Online Shopping
35
![Page 36: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/36.jpg)
Class Diagram: Order Process
36
![Page 37: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/37.jpg)
Ship & Cargo Object Model
37
![Page 38: 7. Object Oriented Modeling](https://reader031.vdocument.in/reader031/viewer/2022012423/61783699154830172675b18c/html5/thumbnails/38.jpg)
1. Software Engineering A practitioner’s Approach by
Roger S. Pressman, 7th edition, McGraw Hill, 2010.
2. Software Engineering by Ian Sommerville, 9th edition,
Addison-Wesley, 2011
3. Systems Analysis and Design, Kendall and Kendall, Fifth
Edition
References