Download presentation
Presentation is loading. Please wait.
1
Object Oriented Modeling and Design
Agenda Object Oriented Philosophy Developing an Object-Oriented application How do you organize a business & OOAD? Example Flight booking system An Object-Oriented Approach A Payroll Program Structured Approach
2
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : When developing an Object-Oriented application, two basic questions always arise: What objects does the application need? What functionality should those objects have? OOAD can be illustrated by analogy to how to organize a business
3
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : How do you organize a business & OOAD? Business Analogy OOAD What are the business processes? Requirements analysis What are the employee roles? Domain analysis Who is responsible for what? How do they interact? Responsibility assignment, interaction design
4
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What objects does the application need? Identifying Objects: Example Flight booking system Assume that the following sentences are summarized by domain experts Airline companies offer various flights A flight is open to booking and close again by order of the company A customer can book one or more flights and for different passengers
5
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What objects does the application need? A booking concerns with a single passenger and a single flight. A booking can be cancelled or confirmed. A flight has a departure airport and an arrival airport. A flight has a departure day and time and an arrival day and time. A flight may involve stopovers in airports. A stopover has an arrival time and a departure time. Each airport serves one or more cities.
6
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What objects does the application need? Objects : Sentence 1 Airline companies offer various flights Airline company, Flight (real world entities) Objects : Sentence 2 A flight is open to booking and close again by order of the company Airline company, Flight (real world entities), Booking Objects : Sentence 3 A customer can book one or more flights and for different passengers Booking, Flight ,Customer Distinction between customer and passenger?
7
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What objects does the application need? Objects : Sentence 4 A booking concerns with a single passenger and a single flight Booking, Flight , Passenger Objects : Sentence 5 A booking can be cancelled or confirmed Booking Objects : Sentence 6 A flight has a departure airport and an arrival airport Airport, Flight
8
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What objects does the application need? Objects : Sentence 7 A flight has a departure day and time and an arrival day and time Flight Objects : Sentence 8 A flight may involve stopovers in airports Flight , Airport, Stopover Objects : Sentence 9 A stopover has an arrival time and a departure time Stopover Objects : Sentence 10 Each airport serves one or more cities Airport, City
9
Object Oriented Philosophy :
Object basics: Object Oriented Philosophy : What functionality should those objects have? OPERATIONS : Sentence 2 A flight is open to booking and close again by order of the company Flight: openBooking closedBooking OPERATIONS : Sentence 5 A booking can be cancelled or confirmed Booking: cancel confirm Similarly we find all operations
10
A Case Study - A Payroll Program:
Object basics: A Case Study - A Payroll Program: Consider a payroll program that processes employee records at a small manufacturing firm. This company has three types of employees: Managers: Receive a regular salary. Office Workers: Receive an hourly wage and are eligible for overtime after 40 hours. Production Workers: Are paid according to a piece rate.
11
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : Structured Approach: FOR EVERY EMPLOYEE DO BEGIN IF employee = manager THEN CALL computeManagerSalary IF employee = office worker THEN CALL computeOfficeWorkerSalary IF employee = production worker THEN CALL computeProductionWorkerSalary END
12
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : Structured Approach: What if we add two new types of employees? Temporary office workers ineligible for overtime Junior production workers who receive an hourly wage plus a lower piece rate.
13
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : Structured Approach: FOR EVERY EMPLOYEE DO BEGIN IF employee = manager THEN CALL computeManagerSalary IF employee = office worker THEN CALL computeOfficeWorker_salary IF employee = production worker THEN CALL computeProductionWorker_salary IF employee = temporary office worker THEN CALL computeTemporaryOfficeWorkerSalary IF employee = junior production worker THEN CALL computeJuniorProductionWorkerSalary END
14
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : An Object-Oriented Approach : What objects does the application need? The goal of OO analysis is to identify objects and classes that support the problem domain and system's requirements. Some general candidate classes are: Persons Places Things
15
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : An Object-Oriented Approach : What are some of the application’s classes? Employee Manager Office Workers Production Workers Identify class hierarchy Identify commonality among the classes Draw the general-specific class hierarchy
16
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : An Object-Oriented Approach : FOR EVERY EMPLOYEE DO BEGIN employee computePayroll() END
17
A Case Study - A Payroll Program :
Object basics: A Case Study - A Payroll Program : An Object-Oriented Approach : If a new class of employee were added FOR EVERY EMPLOYEE DO BEGIN employee computePayroll() END
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.