You are on page 1of 44

Introduction to OOP

SEC4207

Introduction to OOP SEC4207 1


Lineup for today..
• UML diagrams

Introduction to OOP SEC4207 2


Module
• Module Name : Introduction to OOP
• Module Code : SEC4207
• Credits : 20
• Learning Hours : 200
Teaching – 72
Student centered learning – 128

Teaching : Lecture and lab session


Assessment : 100% assessments
Introduction to OOP SEC4207 3
Learning Outcomes
• LO2: Design Object-Oriented based applications

Introduction to OOP SEC4207 4


Unified Modeling Language (UML)

• The accepted, standard object oriented (OO) modeling language in


the industry.
• The standard was created & managed by, the Object Management
Group (OMG) established in 1989.
• It is an association of more than 800 software vendors, developers &
organizations to have uniformity in OO systems.

Introduction to OOP SEC4207 5


UML
• A tool which gives detailed design for code generation.
• Helps to decompose a complex system into understandable
components.
• Allows to build a piece at a time.

Introduction to OOP SEC4207 6


UML Models
State
State
State
Diagrams
State
Diagrams
Class
Diagrams
Class
Use Case Diagrams
Diagrams
Use
Use Case
Case Diagrams State
Diagrams
Use Case
Diagrams
Use Case State
Use Case Diagrams
Use Case State
Diagrams
State
Use
Use Case
Case Diagrams
Diagrams Diagrams
Object
Diagrams
Diagrams
Use Case Diagrams Object
Diagrams
Diagrams
Activity
Diagrams
Activity Diagrams
Diagrams Diagrams
Diagrams
Diagrams

Scenario
Scenario State
State
Scenario
Diagrams
Scenario State
Diagrams
State
Diagrams
Sequence
Diagrams Diagrams
State
Diagrams
State
Sequence
Diagrams Diagrams
Diagrams Model Diagrams
Diagrams Diagrams

Scenario
Scenario
Component
Component
Scenario
Diagrams
Scenario
Diagrams
Component
Diagrams
Component
Diagrams
Collaboration Deployment Component
Diagrams
Component
Diagrams
Collaboration
Diagrams Deployment Diagrams
Diagrams Diagram Diagrams
Diagrams
Diagrams Diagram

Introduction to OOP SEC4207 7


Model View of the system
Use case How the system interacts with its users.
Class The data elements in the system and the relationships between
them.
Interaction How a use case affects all the objects that are involved in it.
(sequence &
collaboration)
State How the different objects of a single class behave through all
the use cases in which the class in involved.

Activity The sequence of activities that make up a process.


Component The different components of the system and the dependencies
between them.
Deployment The software and hardware elements of the system and the
physical relationships between them.

Introduction to OOP SEC4207 8


Object Oriented Analysis & Design
Using UML to model:
• Use Case Diagrams
• Class Diagrams
• Sequence Diagrams
• Activity Diagrams
• State Chart Diagrams

Introduction to OOP SEC4207 9


Structured (Traditional) vs. Object Oriented
Functional Model versus Data Model

Introduction to OOP SEC4207 10


Problems with Structured Approach
• Functional Decomposition
– Functions and data separated
– Data accessible by several processes
– Data is not protected

• Function vs. Data


– System functionality is more likely to change than the data
– Over time the functionality is more unstable than the data

Introduction to OOP SEC4207 11


Problems with Structured Approach
• Poor Modularity
– Interdependency between modules
– Modules should be independent, self-contained and well defined
purpose

• Difficulty in Analysis to Design Transition

• Difficulty in Maintaining Source Code

Introduction to OOP SEC4207 12


Use Case Diagram
• It summarizes the relationships between use cases (functions),
actors, and systems.
• Provide a graphical representation of services the system will
provide.
• Helps to establish project boundaries.
• It does not show the order in which steps are performed to achieve
the goals of each use case. 
• Use cases deal only with the functional requirements for a system.

Introduction to OOP SEC4207 13


Use Case Diagram - Components
1. Actor
– Anything that interacts with a system
– person, organization, device, external software

Introduction to OOP SEC4207 14


Use Case Diagram - Components
• When one system is the actor of another system, represent the actor
system with the actor label.
• A rectangle is used to represent an actor which is not a person.
– Eg: Inventory System

Introduction to OOP SEC4207 15


Use Case Diagram - Components
2. Use Case 
– The actions that are performed by one or more actors.
– Use Case Names Begin With a Strong Verb.

Introduction to OOP SEC4207 16


Use Case Diagram - Components
3. Connecting Line
– Indicate which actor utilize which use case

Introduction to OOP SEC4207 17


Use Case Diagram - Components
• A rectangle is drawn around the
automation boundary (around use
cases).
• Place actors outside the system
boundary.
• The use cases inside the rectangle
represent the functionality that you
intend to implement.

Introduction to OOP SEC4207 18


Example – Food Ordering

Introduction to OOP SEC4207 19


Example – Call Management

Introduction to OOP SEC4207 20


Example – Video Rental Shop

Introduction to OOP SEC4207 21


Example – Vending Machine

Introduction to OOP SEC4207 22


Example – Sales Ordering System

Introduction to OOP SEC4207 23


Release Scope with a System Boundary

Online Shopping

Three system boundary boxes are included, each of which has a label
indicating which release the various use cases have been assigned to.
Introduction to OOP SEC4207 24
Relationship

• Some use cases use other use cases as a part of them.


• This is denoted by the dashed connecting line with an
arrow.
• The direction of the arrow indicates which use case is
included as a part of the major use case.

Introduction to OOP SEC4207 25


<<includes>> or <<uses>> relationship

• One use case is needed by another in order to perform a


task.
• Include relationship – a standard case linked to a mandatory use case.
• Standard use case can NOT execute without the include case
• tight coupling .
• Example: to Authorize Car Loan (standard use case), a clerk must run
Check Client’s Credit History (include use case).

Introduction to OOP SEC4207 26


Example – Includes: Checkout

Introduction to OOP SEC4207 27


Example – Includes: Order Meal

Introduction to OOP SEC4207 28


Example – Includes: ATM

Introduction to OOP SEC4207 29


Introduction to OOP SEC4207 30
<<extends>> relationship

• An alternative options under a certain use case.


• Extend relationship – linking an optional use case to a standard use
case
• Standard use case can execute without the extend case  loose
coupling.
• Example: Register Course (standard use case) may have Register for
Special Class (extend use case) – class for non-standard students, in
unusual time, with special topics, requiring extra fees…).

Introduction to OOP SEC4207 31


Example – Extends: Upgrade Seat

Introduction to OOP SEC4207 32


Example – Extends: Order Food

Introduction to OOP SEC4207 33


Introduction to OOP SEC4207 34
Introduction to OOP SEC4207 35
Introduction to OOP SEC4207 36
Generalization
• One element (child) "is based on" another element (parent)
• The child use case inherits the behavior and meaning of the parent
use case.
• •The child may add to or override the behavior of its parent.

Introduction to OOP SEC4207 37


• Generalization with use cases

Introduction to OOP SEC4207 38


Inheritance in Use Case Diagrams

• Generalization with Actors

Introduction to OOP SEC4207 39


Generalization - Example

Introduction to OOP SEC4207 40


Library System
• Actors
– Member (Student, Staff)
– Liberian
– Cashier
– Library Assistant
– Supplier (Book Shop, Donator)

Introduction to OOP SEC4207 41


Use Cases
• Register Member • Borrow a book
– Issue an application form – Check library card
– Verify the application – Check library fine
– Take membership fee – Check borrow limit
– Issue the library card – Print the loan receipt

• Search for a book • Return a book


– Search by title – Check return date
– Search by author – Check library fine
– Search by category – Check for damages
– Return library card

Introduction to OOP SEC4207 42


• Pay fine
– Cash Payment
– Credit Card
– Cheque Payment

• Provide Books
– Check book list

Introduction to OOP SEC4207 43


Example
• Food Ordering System
• ATM
• Library System
• Student Management System

Introduction to OOP SEC4207 44

You might also like