1 / 54

Object Oriented Analysis and Design Using the UML

Object Oriented Analysis and Design Using the UML. Introduction to Object Orientation. Objectives: Introduction to Object Orientation. Understand the basic principles of object orientation Understand the basic concepts and terms of object orientation and the associated UML notation

allan
Download Presentation

Object Oriented Analysis and Design Using the UML

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. Object Oriented Analysis and Design Using the UML Introduction to Object Orientation

  2. Objectives: Introduction to Object Orientation • Understand the basic principles of object orientation • Understand the basic concepts and terms of object orientation and the associated UML notation • Appreciate the strengths of object orientation • Understand some basic UML modeling mechanisms

  3. Introduction to Object Orientation Topics • 1. Basic Principles of Object Orientation • 2. Basic Concepts of Object Orientation • 3. Strengths of Object Orientation • 4. General UML Modeling Mechanisms

  4. Object Orientation Abstraction Encapsulation Modularity Hierarchy 1. Basic Principles of Object Orientation

  5. Salesperson Not saying which salesperson – just a salesperson in general!!! Product Customer What is Abstraction? Manages Complexity

  6. What is Encapsulation? • Hide implementation from clients • Clients depend on interface – only! • Clients do not need to know ‘how’ the server operates or provides the services! How does an object encapsulate? What does it encapsulate? DISCUSS!!!!! Improves Resiliency

  7. What is Modularity? • The breaking up of something complex into manageable pieces Order Entry Order Processing System Order Fulfillment Billing Manages Complexity

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

  9. Introduction to Object Orientation Topics • Basic Principles of Object Orientation • Basic Concepts of Object Orientation • Strengths of Object Orientation • General UML Modeling Mechanisms

  10. 2. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  11. A More Formal Definition • An object is a concept, abstraction, or thing with sharp boundaries and meaning for an application • An object is something that has: • State • Behavior • Identity

  12. Professor Clark Representing Objects • An object is represented as rectangles with underlined names : Professor a + b = 10 ProfessorClark Class Name Only ProfessorClark : Professor Object Name Only Class and Object Name (stay tuned for classes)

  13. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  14. What is a Class? • A class is a description of a group of objects with common properties (attributes), behavior (operations), relationships, and semantics • A class is an ‘abstraction’ of objects…. • An object is an instance of a class • A class is an abstraction in that it: • Emphasizes relevant characteristics • Suppresses other characteristics OO Principle: Abstraction

  15. Representing Classes • A class is represented using a compartmented rectangle a + b = 10 Professor Professor Clark

  16. Class Name Professor name Attributes empID Operations create( ) save( ) delete( ) change( ) Class Compartments • A class is comprised of three sections • The first section contains the class name • The second section shows the structure (attributes) • The third section shows the behavior (operations)

  17. Professor Smith Professor Mellon Professor Jones The Relationship Between Classes and Objects • A class is an abstract definition of an object • It defines the structure and behavior of each object in the class • It serves as a template for creating objects Objects Class Professor

  18. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  19. CourseOffering :CourseOffering :CourseOffering number = 101 startTime = 900 endTime = 1100 number = 104 startTime = 1300 endTime = 1500 number startTime endTime What is an Attribute? Object Class Attribute Attribute Value

  20. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  21. CourseOffering addStudent deleteStudent getStartTime getEndTime What is an Operation? Class Operation

  22. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

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

  24. Pyramid Cube Tube <<interface>> Shape Draw Move Scale Rotate What is an Interface? • Interfaces formalize polymorphism • Interfaces support “plug-and-play” architectures abstract methods Realization relationship. Tube, Pyramid, and Cube ‘implement’ the interface! (stay tuned for realization relationships)

  25. Pyramid Pyramid Cube Cube Tube Tube <<interface>> Shape Draw Move Scale Rotate Interface Representations Elided/Iconic Representation(“lollipop”) Shape Canonical (Class/Stereotype) Representation (stay tuned for realization relationships)

  26. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  27. <<DLL>> Component Name Component Interface What is a Component? • A non-trivial, nearly independent, and replaceable part of a system that fulfills a clear function in the context of a well-defined architecture • A component may be • A source code component • A run time component or • An executable component OO Principle:Encapsulation Source File Name <<EXE>> Executable Name

  28. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  29. What is a Package? • A package is a general purpose mechanism for organizing like elements into groups • A model element which can contain other model elements • Uses • Organize the model under development • A unit of configuration management OO Principle:Modularity Package Name

  30. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  31. Realization <<subsystem>> Subsystem Name Subsystem Interface Interface What is a Subsystem? • A combination of a package (can contain other model elements) and a class (has behavior) • Realizes one or more interfaces which define its behavior • Interface is an abstract class. Subsystem implements (realizes) the interface (interfaces)… OO Principles: Encapsulation and Modularity (stay tuned for realization relationship)

  32. <<subsystem>> Component Name Component Interface Subsystems and Components • Components are the physical realization of an abstraction in the design • Subsystems can be used to represent the component in the design Design Model Implementation Model Component Name Component Interface OO Principles: Encapsulation and Modularity

  33. Basic Concepts of Object Orientation • Object • Class • Attribute • Operation • Interface (Polymorphism) • Component • Package • Subsystem • Relationships

  34. Relationships • Association • Aggregation • Composition • Dependency • Generalization • Realization

  35. Association Name Works for Professor University Professor University Association Class  Relationships: Association • Models a semantic connection among classes Add these descriptions via Open Specification in Rose Role Names Employee Employer

  36. Student Schedule Relationships: Aggregation • A specialform of association that models a whole-part relationship between an aggregate (the whole) and its parts Whole Part Aggregation This is sometimes called a ‘has_a’ relationship

  37. Student Schedule Relationships: Composition • A form of aggregation with strong ownership and coincident lifetimes • The parts cannot survive the whole/aggregate Part Whole Aggregation

  38. Association: Multiplicity and Navigation • Multiplicity defines how many objects participate in a relationships • The number of instances (that is, ‘objects’) of one class related to ONE instance of another class • Specified for each end of the association • Associations and aggregations are bi-directional by default, but it is often desirable to restrict navigation to one direction • If navigation is restricted, an arrowhead is added to indicate the direction of the navigation

  39. 0..* * 1..* 0..1 2..4 2, 4..6 Association: Multiplicity • Unspecified • Exactly one • Zero or more (many, unlimited) • One or more • Zero or one • Specified range • Multiple, disjoint ranges 1

  40. Student Schedule Example: Multiplicity and Navigation Multiplicity 1 0..* Navigation A student has zero or more schedules. (Multiplicity) Note: Aggregation: ‘has_a’ and whole-part relationship. (type of Association)

  41.  Relationships: Dependency • A relationship between two model elements where a change in one may cause a change in the other • Non-structural, “using” relationship • Can actually say the Client ‘uses’ the Supplier. Client Supplier Component Class Supplier Client Package Dependency relationship ClientPackage SupplierPackage Dependency relationship

  42.  Relationships: Generalization • A relationship among classes where one class shares the structureand/orbehavior of one or more classes • Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses • Single inheritance • Multiple inheritance • Generalization is an “is-a-kind of” relationship, or simply, “is_a” relationship.

  43. Account balance name number Withdraw() CreateStatement() Savings Checking GetInterest() Withdraw() Withdraw() Example: Single Inheritance • One class inherits from another Ancestor Superclass (parent) Generalization Relationship Subclasses inherit both attributes and methods from base (parent) class. Subclasses Descendents

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

  45. What Gets Inherited? • A subclass inherits its parent’s attributes, operations, and relationships • A subclass may: • Addadditional 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

  46. Person Trailer Example: What Gets Inherited GroundVehicle owner weight Superclass (parent) 0..* 1 licenseNumber register( ) generalization Truck Car Subclass tonnage size getTax( )

  47. Subsystem Interface Use Case Use-Case Realization Relationships: Realization • One classifier serves as the contract that the other classifier agrees to carry out • Found between: •  Interfaces and the classifiers that realize them Elided form Canonical form

  48. Introduction to Object Orientation Topics • Basic Principles of Object Orientation • Basic Concepts of Object Orientation • Strengths of Object Orientation • General UML Modeling Mechanisms

  49. <<boundary>> MyBoundaryClass MyBoundaryClass 4. Stereotypes • Classify and extend the UML notational elements • Define a new model element in terms of another model element • May be applied to all modeling elements • Represented with name in guillemets or as a different icon

  50. Notes • A Note can be added to any UML element • Notes may be added to add more information to the diagram • It is a ‘dog eared’ rectangle • The note may be anchored to an element with a dashed line There can be up to one MaintainScheduleForm per MaintainScheduleForm user session.

More Related