introduction to object oriented design
play

Introduction to Object Oriented Design Dumitru Radoiu Dumitru - PowerPoint PPT Presentation

Introduction to Object Oriented Design Dumitru Radoiu Dumitru Radoiu Spring 2009 PETRU MAIOR UNIVERSITY Agenda The Characteristics of Object Oriented Design (OOD) The Characteristics of Object Oriented Design (OOD) The Use


  1. Introduction to Object ‐ Oriented Design Dumitru Radoiu Dumitru Radoiu Spring 2009 PETRU MAIOR UNIVERSITY

  2. Agenda • • The Characteristics of Object Oriented Design (OOD) The Characteristics of Object ‐ Oriented Design (OOD) • The Use of Classes in OOD • The use of Inheritance in OOD • The Use of Polymorphism in OOD • Creating a Class Diagram: Case Study

  3. Software development activities Customer time Design Implementation Analysis = attempt to = model the = implement understand behavior the model Exclusions Deliverables Baseline Baseline Implementation Implementation Needs Needs Requirements Requirements Specifications

  4. Procedural approach = multiple procedures modify global data time Design Implementation Analysis = attempt to = model the = implement understand behavior the model Edit Data Load Data Deliverables Needs Needs Requirements Requirements P i t D t Print Data Save Data View Data Everything is exposed; Everything is exposed; updating business rules does not update the entire application.

  5. Object-Oriented approach: objects talk to other objects to complete a task time Design Implementation Analysis = attempt to = model the = implement understand behavior the model Deliverables Data Needs Needs Requirements Requirements Functionality Functionalities are Functionalities are encapsulated; only some are exposed (Interfaces)

  6. Object-Oriented Analysis (OOA) time Design Implementation OO Analysis = what abstract = model the = implement entities/objects are behavior the model required to future system? Deliverables Data Needs Needs Requirements Requirements Functionality Functionalities are Functionalities are encapsulated; only some are exposed (Interfaces) Object

  7. Object-Oriented Design (OOD) time OO Design Implementation OO Analysis = what abstract = model the = implement entities/objects are behavior for the model required to future the system to system? exist Deliverables Data Needs Needs Requirements Requirements Functionality Object

  8. Object-Oriented Programming (OOP) time OO Design OO Programming OO Analysis = what abstract = model the = implement the model in an entities/objects are behavior for Object Oriented Language required to future the system to (OOL) system? exist Deliverables Data Needs Needs Requirements Requirements Functionality

  9. Object-Oriented World time OO Design OO Programming OO Analysis Give Program the Create the vocabulary ocabu a y model ode vocabulary vocabulary behavior (model the system) Deliverables Requirements

  10. Object-Oriented Design time OO Design OO Programming OO Analysis Give Program the Create the vocabulary ocabu a y model ode vocabulary vocabulary behavior (model the system) Deliverables Requirements Principles: 1. Classes (abstraction and encapsulation) 2. Inheritance 3. Polymorphism

  11. Agenda • • The Characteristics of Object Oriented Design (OOD) The Characteristics of Object ‐ Oriented Design (OOD) • The Use of Classes in OOD • The use of Inheritance in OOD • The Use of Polymorphism in OOD • Creating a Class Diagram: Case Study

  12. What makes a class: abstraction (= create a general term for an item) transportation ship automobile plane truck car SUV “A ____ is a type of ____.”

  13. What makes a class: encapsulation ( = stuff the item with data and functionality) name data functionality functionality black box name name data input input output output functionality Interface = restricted access to functionality = lower maintenance & problem prevention

  14. Object-Oriented Programming (OOP) time OO Design OO Programming OO Analysis = what abstract = model the = implement the model in an entities/objects are behavior for Object Oriented Language required to future the system to (OOL) system? exist Deliverables Data Needs Needs Requirements Requirements Functionality

  15. Object-Oriented Programming (OOP) time OO Design OO Programming OO Analysis = what abstract = model the = implement the model in an entities/objects are behavior for Object Oriented Language required to future the system to (OOL) system? exist Di Display l -Data Deliverables +Print() Data Needs Needs Requirements Requirements +View() -Data +Save() Menu +Load() Load() -Data +Create() +Edit()

  16. Agenda • • The Characteristics of Object Oriented Design (OOD) The Characteristics of Object ‐ Oriented Design (OOD) • The Use of Classes in OOD • The use of Inheritance in OOD • The Use of Polymorphism in OOD • Creating a Class Diagram: Case Study

  17. The use of Inheritance in OOD transportation transportation ship automobile plane truck car SUV

  18. The use of Inheritance in OOD Superclass Subclass B Subclass C Subclass A Subclass C1 Subclass C2 Subclass C3

  19. The use of Inheritance in OOD automobile - Nr OfWheels Nr.OfWheels +Drive() +Reverse() +Park() Park() truck car SUV -Nr.OfGears -TrunkSize -4WD - Nr.OfTanks -SafetyWindows -BullBar + Tow() + Trolley() +Load() +Unload()

  20. Multiple Inheritance Weapon Vehicle -ArtileryCapacity -FuelType - ArtileryType - SeatingCapacity +Drive() +Load() +Reverse() +Fire() +Park() +Aim() +Start() +Start() +Stop() Tank -Model + Ram() +Radio()

  21. Agenda • • The Characteristics of Object Oriented Design (OOD) The Characteristics of Object ‐ Oriented Design (OOD) • The Use of Classes in OOD • The use of Inheritance in OOD • The Use of Polymorphism in OOD • Creating a Class Diagram: Case Study

  22. The use of Polymorphism in OOD Animal -Nr.OfEyes - Nr.OfLegs + Eat() +Sleep() Lion Bird + Run() + Fly() +Sleep() +Sleep() Polymorphism = classes with the same interface operate on their data differently

  23. Agenda • • The Characteristics of Object Oriented Design (OOD) The Characteristics of Object ‐ Oriented Design (OOD) • The Use of Classes in OOD • The use of Inheritance in OOD • The Use of Polymorphism in OOD • Creating a Class Diagram: Case Study

  24. Creating a Class Diagram: Case study Information to build the class diagram: A student can be an undergraduate student or a graduate student g g • • An undergraduate student can be a type of tutor • A tutor tutors a student • A teacher and a professor are two types of instructors eac e a d a p o esso a e o ypes o s uc o s • A teacher assistant can assist a professor and a teacher; a teacher can be assisted by one assistant, while a professor can be assisted by up to five assistants • A teacher assistant is a type of graduate student

  25. A student can be an undergraduate student or a graduate student A student can be an undergraduate student or a graduate student • • Student U d Undergraduate d t G Graduate d t

  26. An undergraduate student can be a type of tutor An undergraduate student can be a type of tutor Student T t Tutor U d Undergraduate d t G Graduate d t

  27. A tutor tutors a student A tutor tutors a student Student tutors> T t Tutor U d Undergraduate d t G Graduate d t

  28. A teacher and a professor are two types of instructors A teacher and a professor are two types of instructors Student tutors> Tutor T t Instructor U d Undergraduate d t G Graduate d t Teacher Professor

  29. A teacher assistant can assist a professor and a teacher; a teacher can be assisted by one assistant, while a professor can be assisted by up b i d b i hil f b i d b to five assistants Student tutors> T t Tutor Instructor Undergraduate U d d t G Graduate d t Teacher Professor 1 1 0..1 0..4 TeacherAssistant

  30. A teacher assistant is a type of graduate student Student tutors> tutors> Instructor Tutor Undergraduate Graduate Teacher Professor 1 1 0..1 0..4 TeacherAssistant

  31. Project Read the following scenario and perform the required activities: The assigned project requires to build an on ‐ line store with the following characteristics: ‐ Customers can buy different physical objects which will be delivered f ll following payment i t ‐ Payment can be made via credit card (arrangements with a third party are already made) Activities: 1. Using BPMN (Business Process Modeling Notation) model the business 2. Draw the Use Case Diagram of a software system which supports the business 2 D th U C Di f ft t hi h t th b i 3. Draw the Sequence Diagram for each Use Cases 4. Draw the Activity Diagram for each Use Case 5. Draw the Class Diagrams for the system

Recommend


More recommend