Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
23 views

2023 - CHAP 2 Object Oriented Design Using UML

The document discusses object-oriented design using the Unified Modeling Language (UML). It introduces the software development process and explains what UML is. It describes UML modeling, specifically use case diagrams and class diagrams. Use case diagrams show actors and use cases of a system, while class diagrams depict classes and relationships among classes.

Uploaded by

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

2023 - CHAP 2 Object Oriented Design Using UML

The document discusses object-oriented design using the Unified Modeling Language (UML). It introduces the software development process and explains what UML is. It describes UML modeling, specifically use case diagrams and class diagrams. Use case diagrams show actors and use cases of a system, while class diagrams depict classes and relationships among classes.

Uploaded by

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

Chap 2 Object

Oriented Design Using

UTM KUALA LUMPUR


 2. 0 Object Oriented Design Using UML
 21. Introduction to Software
Development Process
 2.2 What is UML?
 2.3 UML Modelling : Use Case and
Class Diagram
 2.4 Relationship among classes

7/27/2023 2
 Also known as Software
Development Lifecycle(SDLC)
 A step taken in developing a
software

7/27/2023 3
 Waterfallmodel
 Agile model
 Rational Unified Process(RUP)
 ..

 Many models but all with generic process


such as specification, design, implementation
and testing

4
A linear sequential model

Project timeline
5
A incremental model

6
A incremental model

7
8
Standard language for software blueprint
The UML was adopted in 1997 as the
standard for modeling object ‐oriented
systems by the OMG (Object Management
Group, an industry standards body)
A specification defining a graphical
language for visualizing, specifying,
constructing, and documenting the artifacts
of distributed object systems.(Object
Management Group)
https://www.omg.org/spec/UML/2.5.1/PDF

9
Visual language
can be used in developing software
system
Modeling language
a standard language for software
blueprints
has vocabulary and rules for the
purpose of communication.
Models the system as a set of
graphical representation

10
UML is not Programming Language
but a visual modeling language.
UML is not a CASE Tool but a
modeling language specification
UML is not a method, methodology
or software development process but
enable process

11
The UML is a language for:
Visualizing
 Visually depict a system
Specifying
 Communicate what is required of a
system and how a system may be realize
Constructing
 Mapping UML model into programming
language
Documenting
 Documenting the artifact of the system,
where artifact include requirement,
design, source code, test etc 12
There are 4 reasons why we use UML
specifically
 UML has become the de facto industry
standard
UML unifies the approaches of different
authors in a single notation.
UML can be extended to apply to specific
domains
It is supported by supported by the Unified
Unified Software Software Development
Development Process, which provides a
process model for how it can be applied.

13
static model – use case, class, package,
object, component and deployment
Dynamic model –Sequence,
collaboration, statechart and activity

Why build model?


Language is not enough
Visual help to understand problem
better
Help user and developer communicate

14
Use Case Diagram
Show a set of use case and actor of a
system
Depict the main function of the
system and different kinds of users
that interact with it

15
16
 The actors that the system you are
describing interacts with:
 The system itself (system boundary -
the rectangle)
 The use cases, or services, that the
system knows how to perform, and
 The lines (link) that represent
relationships between these elements.

17
Actor
Is a person or system that interacts
with and derives value from the
system
Is label with its role
Can be associated with other actors
using a generalization relationship.
Are place outside the system
boundary

18
Use Case
Represents a major piece of system
functionality
Can extend another use case
Can use another use case
Is placed inside system boundary
Is labeled with a descriptive verb
‐noun phrase

19
Association
◦ Link an actor with use case
Extends relationship
◦ One use case extends the functionality
of another use case
Includes relationship
◦ One use case will use functionality of
another use case
System boundary
◦ One use case will use functionality of
another use case

20
21
actor Boundary
& system name

Use case
22
23
24
◦ Draw a use case model for a movie
ticketing system where customer can
buy online movie ticket
◦ Identify actor
◦ Identify use case for each actor

25
Class Diagram
is a diagram that shows the classes
and the relationships among
classes that remain constant in the
system over time.
depicts classes, which include
attributes, behaviors and states.
is very similar to the entity
relationship diagram (ERD)

26
27
 Class
◦ Represents a kind of person, or thing
◦ Has a name typed centered in its top compartment
◦ Has a list of attributes attributes in its middle
compartment
◦ Has a list of operations in its bottom compartment

28
 Class : Account
 Attribute : properties that describes the state
of an object
 Methods: actions or functions that a class can
perform

Name
Account
- customer_Name
Attributes
- balance
+addFunds( ) Operations
+withDraw( )
+transfer( )

29
 Relationship between classes is one of
element in class diagram apart from class
itself.

30
 There are three kinds of Relationships
 Dependency
 Generalization (parent-child relationship)
 Association (student enrolls in course)

 Associations can be further classified as


 Aggregation
 Composition

31
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)

UML Class Diagram


Supertype Example: Customer

Regular Loyalty
Customer Customer

Subtype1 Subtype2
-Inheritance is a required feature of object orientation
-Generalization expresses a parent/child relationship among related classes.
-Used for abstracting details in several layers
7/27/202
3

UML Class Diagram 33


A generalization connects a subclass
Person 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.

public Class Person {


Student …
}

public Class Student


extends Person {
…..
}
UML Class Diagram
Association Relationships

 Represent relationship between instances of classes


 Student enrolls in a course
 Courses have students
 Courses have exams
 Etc.

 Association has two ends


 Role names (e.g. enrolls)
 Multiplicity (e.g. One course can have many students)
 Navigability (unidirectional, bidirectional)

7/27/202
3

UML Class Diagram 35


If two classes in a model need to communicate with each other, there
must be link between them.

An association denotes that link.

Student Instructor

UML Class Diagram


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

UML Class Diagram


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

Student Instructor
1..*

UML Class Diagram


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

UML Class Diagram


We can also name the association.

membership
Student Team
1..* 1..*

UML Class Diagram


We can specify dual associations.

member of

1..* 1..*
Student Team

1 president of 1..*

UML Class Diagram


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

Registration

modelNumber
serialNumber
warrantyCode

Product Warranty

UML Class Diagram


student
1 *
University Person

0..1 *
employer teacher

Multiplicity Role
Symbol Meaning
1 One and only one Role
0..1 Zero or one “A given university groups many people;
M..N From M to N (natural language)
some act as students, others as teachers.
A given student belongs to a single
* From zero to any positive integer university; a given teacher may or may not
0..* From zero to any positive integer be working for the university at a particular
1..* From one to any positive integer time.”
7/27/202
3

UML Class Diagram 43


* 4
Student Course
has enrolls

Class Student {
Course enrolls[4];
}

Class Course {
Student have[];
}
7/27/202
3

UML Class Diagram 44


 Aggregation implies a relationship where the
child can exist independently of the parent.
Example: Class (parent) and Student (child).
Delete the Class and the Students still exist.
 Composition implies a relationship where the
child cannot exist independent of the parent.
Example: House (parent) and Room (child).
Rooms don't exist separate to a House.
Company has department,
And each department has a
number of employee

University has department,


And each department has a number of professor
Association Relationships - composition
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 .. *

UML Class Diagram


How to design a class
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 .. *

UML Class Diagram


7/27/202
3

UML Class Diagram 50


 Identifyclasses for the system
 Describe attributes and methods
in each class
 Establish relationship among
classes
 Create classes

51
◦ From the use case model exercise:-
 Draw a use case model for a movie
ticketing system where customer can
buy online movie ticket
 Identify actor
 Identify use case for each actor
 Draw a class diagram for movie
ticketing system

52

You might also like