1 / 62

Part 1: Introduction to OOAD

Part 1: Introduction to OOAD. Objectives. What we will learn: Introduce OO concepts. Compare and contrast analysis and design. Define object-oriented analysis and design (OOA/D). Illustrate a brief example. What Is Object Technology?.

kapila
Download Presentation

Part 1: Introduction to OOAD

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Part 1: Introduction to OOAD

  2. Objectives What we will learn: • Introduce OO concepts. • Compare and contrast analysis and design. • Define object-oriented analysis and design (OOA/D). • Illustrate a brief example.

  3. What Is Object Technology? • A set of principles (abstraction, encapsulation, polymorphism) guiding software construction, together with languages, databases, and other tools that support those principles. (Object Technology - A Manager’s Guide, Taylor, 1997.)

  4. The Strengths of Object Technology • Reflects a single paradigm • Facilitates architectural and code reuse • Reflects real world models more closely • Encourages stability • Is adaptive to change

  5. Simula C ++ The UML Late 1980s 1996 1967 1991 2004 1972 Smalltalk Java UML 2 The History of Object Technology • Major object technology milestones

  6. Where Is Object Technology Used? • Client/Server Systems and Web Development • Object technology allows companies to encapsulate business information in objects and helps to distribute processing across the Internet or a network.

  7. Where Is Object Technology Used? (continued) • Real-time systems • Object technology enables real-time systems to be developed with higher quality and flexibility.

  8. Differences Between OO and Structured Design • Object-orientation (OO) • Melds the data and data flow process together early in the lifecycle • Has a high level of encapsulation • Promotes reuse of code differently • Permits more software extensibility

  9. Concepts of Object Orientation

  10. Objectives • Describe abstraction, encapsulation, modularity, and hierarchy. • Describe the physical structure of a class. • Describe the relationship between a class and an object. • Define polymorphism and generalization.

  11. Where Are We? • What is an object? • Four principles of OO • What is a class? • Polymorphism and generalization • Organizing model elements

  12. Truck What Is an Object? • Informally, an object represents an entity, either physical, conceptual, or software. • Physical entity • Conceptual entity • Software entity Chemical Process Linked List

  13. A More Formal Definition Attributes • An object is an entity with a well-defined boundary and identity that encapsulates state and behavior. • State is represented by attributes and relationships. • Behavior is represented by operations, methods, and state machines. Object Operations

  14. An Object Has Identity • Each object has a unique identity, even if the state is identical to that of another object. Professor “M Zheng” teaches Java Professor “M Zheng” teaches Java

  15. Where Are We? • What is an object? • Four principles of OO • What is a class? • Polymorphism and generalization • Organizing model elements

  16. Basic Principles of Object Orientation Object Orientation Encapsulation Modularity Hierarchy Abstraction

  17. What Is Abstraction? • The essential characteristics of an entity that distinguishes it from all other kinds of entities. • Defines a boundary relative to the perspective of the viewer. • Is not a concrete manifestation, denotes the ideal essence of something.

  18. Example: Abstraction Student Professor Course Offering (9:00 a.m., Monday-Wednesday-Friday) Course (e.g. Algebra)

  19. What Is Encapsulation? • Hides implementation from clients. • Clients depend on interface. Improves Resiliency

  20. Encapsulation Illustrated Professor Clark • Professor Clark needs to be able to teach four classes in the next semester. AcceptCourseOffering() SubmitFinalGrades() Name: Michael Zheng Employee ID: 567138 HireDate: 07/25/1991 Status: Tenured Discipline: Finance MaxLoad:4 SetMaxLoad(4) SetMaxLoad() TakeSabbatical()

  21. What Is Modularity? • Breaks up something complex into manageable pieces. • Helps people understand complex systems.

  22. Billing System Course Catalog System Course Registration System Student Management System Example: Modularity • For example, break complex systems into smaller modules.

  23. What Is Hierarchy? Increasing abstraction Asset BankAccount Security RealEstate Savings Checking Stock Bond Decreasing abstraction Elements at the same level of the hierarchy should be at the same level of abstraction.

  24. Where Are We? • What is an object? • Four principles of OO • What is a class? • Polymorphism and generalization • Organizing model elements

  25. What Is a Class? • A class is a description of a set of objects that share the same attributes,operations,relationships, and semantics. • An object is an instance of a class. • A class is an abstraction in that it • Emphasizes relevant characteristics. • Suppresses other characteristics.

  26. A Sample Class Class Course Properties Name Location Days offered Credit hours Start time End time Behavior Add a student Delete a student Get course roster Determine if it is full

  27. Professor - name - employeeID : UniqueId - hireDate - status - discipline - maxLoad + submitFinalGrade() + acceptCourseOffering() + setMaxLoad() + takeSabbatical() + teachClass() Representing Classes in the UML • A class is represented using a rectangle with three compartments: • The class name • The structure (attributes) • The behavior (operations)

  28. Student - name - address - studentID - dateOfBirth What Is an Attribute? • An attribute is a named property of a class that describes the range of values that instances of the property may hold. • A class may have any number of attributes or no attributes at all. Attributes

  29. :Student - name = “Lei Wang” - address = “123 Main St.” Student - studentID = 9 - dateOfBirth = “03/10/1987” - name - address - studentID - dateOfBirth :Student - name = “Ning Li” - address = “456 People St.” - studentID = 2 - dateOfBirth = “12/11/1989” Attributes in Classes and Objects Class Objects

  30. class: Furniture object: theChair cost dimensions weight location color cost dimensions weight location color buy sell weigh move buy sell weigh move Object-Oriented Basics: Class • E.g. A chair is a member of (instance of) a set of similar objects (class) that we call furniture.

  31. What Is an Operation? • A service that can be requested from an object to effect behavior. An operation has a signature, which may restrict the actual parameters that are possible. • A class may have any number of operations or none at all. Student + get tuition() + add schedule() Operations + get schedule() + delete schedule() + has prerequisites()

  32. object: sender object: receiver attributes: attributes: message: [sender, return value(s)] operations: operations: message: [receiver, operation, parameters] Object-Oriented Basics: Messages • Messages are the mechanism by which objects (classes) interact.

  33. Where Are We? • What is an object? • Four principles of OO • What is a class? • Polymorphism and generalization • Organizing model elements

  34. What Is Polymorphism? • The ability to hide many different implementations behind a single interface. Manufacturer B Manufacturer C Manufacturer A OO Principle:Encapsulation Remote Control

  35. Example: Polymorphism financialInstrument.getCurrentValue() getCurrentValue() getCurrentValue() getCurrentValue() Stock Bond Mutual Fund

  36. What Is Generalization? • A relationship among classes where one class shares the structure and/or behavior of one or more classes. • Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses. • Single inheritance. • Multiple inheritance. • Is an “is a kind of” relationship.

  37. Example: Single Inheritance • One class inherits from another. Ancestor Account - balance Superclass (parent) - name - number + withdraw() + createStatement() Generalization Relationship Subclasses (children) Savings Checking Descendents

  38. class: Furniture object: theChair cost dimensions weight location color cost dimensions weight location color object: theTable cost dimensions weight location color buy sell weigh move buy sell weigh move buy sell weigh move Object-Oriented Basics: Inheritance • Objects inherit from the class all attributes and operations.

  39. FlyingThing Animal Multiple Inheritance Airplane Helicopter Bird Wolf Horse Use multiple inheritance only when needed and always with caution! Example: Multiple Inheritance • A class can inherit from several other classes.

  40. What Is Inherited? • A subclass inherits its parent’s attributes, operations, and relationships. • A subclass may: • Add additional attributes, operations, relationships. • Redefine inherited operations. (Use caution!) • Common attributes, operations, and/or relationships are shown at the highest applicable level in the hierarchy. Inheritance leverages the similarities among classes.

  41. Where Are We? • What is an object? • Four principles of OO • What is a class? • Polymorphism and generalization • Organizing model elements

  42. What Is a Package? • A general purpose mechanism for organizing elements into groups. • A model element that can contain other model elements. • A package can be used: • To organize the model under development. • As a unit of configuration management. University Artifacts

  43. University Student Professor Artifacts Artifacts Course Schedule Student CourseOffering A Package Can Contain Classes • The package, University Artifacts, contains one package and five classes.

  44. <heading> <contents area> Diagram Depiction • Each diagram has a frame, a heading compartment in the upper left corner, and a contents area. • If the frame provides no additional value, it may be omitted and the border of the diagram area provided by the tool will be the implied frame.

  45. Review • What is an object? • What are the four principles of object orientation? Describe each. • What is a class? How are classes and objects related? • What is an attribute? An operation? • Define polymorphism. Provide an example of polymorphism. • What is generalization? • Why use packages?

  46. Applying UML and Patterns in OOA/D • Skills in object-oriented analysis and design (OOA/D) are essential for the creation of well-designed, robust, and maintainable software using object technologies and languages such as Java, C++ What these skills are: • Design Patterns - named problem-solution formulas that codify exemplary design principles. • They are best-practice principles to help us answer design questions: • Class Design - How to Assign Responsibilities to Classes? How should classes interact? What classes should do what? • UML - The UML is not OOA/D or a method, it is simply notation.

  47. Assign Responsibilities • Fundamental ability in OOA/D is to skillfully assign responsibilities to software components - classes • Nine fundamental principles in object design and responsibility assignment will be introduced later. • OK, wait until we see them…

  48. What Is Analysis and Design? • Analysis emphasizes an investigation of the problem and requirements, rather than a solution "Analysis" is a broad term, best qualified, as in requirements analysis(an investigation of the requirements) or object analysis(an investigation of the domain objects). • Design emphasizes a conceptual solutionthat fulfillsthe requirements, rather than its implementation.

  49. Object-Oriented Processes: Analysis • Define all classes (and relationships and behavior associated with them) that are relevant to the problem to be solved. • Tasks: • Communicate basic user requirements to SWE • Identify classes (attributes & methods defined) • Specify class hierarchy • Represent object-to-object relationships • Model object behavior

More Related