1 / 28

Chapter 2: Introduction to Object Orientation

Chapter 2: Introduction to Object Orientation. Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer. Chapter Objectives. Af ter studying this chapter you should be able to: Define an object.

rbuggs
Download Presentation

Chapter 2: Introduction to Object Orientation

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. Chapter 2:Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer

  2. Chapter Objectives • After studying this chapter you should be able to: • Define an object. • Understand the terms class, attribute, and operations. • Explain generalization, polymorphism, and inheritance. • Define association. • Describe modeling and the Unified Modeling Language.

  3. What is an Object? • An entity that encapsulates data/attributes and behavior/operations • - Objects are categorized into classes • - Each individual object is an instance of a class

  4. What is a Class? • A category of objects that share the same data attributes, and operational behavior • All objects are instances of classes • Classes are like templates, or blueprints, or types for objects

  5. What is Encapsulation? • The characteristic of object-orientation in which data and behavior are bundled into a class and hidden from the outside world • Access to the data and behavior is provided and controlled through an object’s interface,aka. API (application programming interface)

  6. Name Attributes Operations

  7. What is an Attribute? • Attribute – is a named property of a class that describes the various characteristics that objects within the class will have • Attributes are the way classes encapsulate data • Attributes are mostly nouns

  8. Minus sign indicates these are private (hidden) Attributes are properties containing values

  9. What is an Operation? • A behavior for an object • Implemented in OO classes as methods • A method is where the program code resides • Methods are identified and invoked by their signatures, including their names and parameters • Methods are mostly verbs

  10. A method signature identifies the interface to the method A method implements the behavior

  11. Plus sign indicates these are public (accessible) Method signatures

  12. What is Generalization? • A relationship betweena parent class (more general) classand a child class (morespecific) • The more specific the class is, the more additionalattributes and operations it has • A parent class Vehicle is more general • A child class Car is more specific

  13. What is Inheritance? • The mechanism by which the more specific (child) class in a generalization relationship includes the attributes and operations of the more general (parent) class

  14. A generalization relationship is represented by an arrow from the subclass to the superclass Subclasses inherit all attributes and operations of superclasses

  15. What is a Message? • A message is the way one method or process invokes (calls) another method or process • The message will include the name of the method, and the value of parameters the method expects in parenthesis • Example: add_order(123456)

  16. What is Polymorphism? • The ability for different subclasses to respond to identical messages in different ways • Polymorphism = “having many forms” • Different behaviors for the same message • Each subclass (e.g. FullTimeEmp, PartTimeEmp) will implement the same method (e.g. calcSalary) differently

  17. Here, each type of vehicle has its own version of calcPrice( )

  18. What is a Component? • A replaceable part of a system providing a clearly defined function through a set of interfaces • Group of classes working together toward a common end; a subsystem

  19. What is an Interface? • The mechanism by which users of a component invoke its behaviors and manipulate its properties • The interface is implemented by method signatures

  20. What is a Package? • A general-purpose mechanism for organizing elements into groups • Group of classes sharing similar characteristics or purposes • A Package is akin to a folder on your operating system

  21. The Sales package might include: a product, inventory and customer classes

  22. What is an Association? • A relationship or a link between two or more classes • Three types: • Simple associations: no ownership (e.g. people, places) • Aggregations: whole-part relationships where the part can exist independently of the whole (e.g. team, player) • Compositions: whole-part relationships where the part is fully dependent on whole, and cannot exist without it(e.g. sales_order and sales_order_line items)

  23. What is Association Multiplicity? • Identifies the number of associated entities that can exist for an entity • Three types: • One to One: one entity is associated with a single entity • One to Many: one entity is associated with zero or more entities • Many to Many: one entity “A” is associated with zero or more entities “B” , and one entity “B” is associated with zero or more entities “A”

  24. This is a association, showing roles and multiplicities

  25. Unified Modeling Language (UML) • A standard notation for representing object-oriented systems created by Grady Booch, James Rumbaugh, and Ivar Jacobson • Boxes represent classes, components, packages, objects • Containing attributes and operations • Provide interfaces to external entities • Lines represent relationships, (either generalization and association)

  26. Sample UML Diagram

  27. UML Diagrams • Class Diagram – shows classes and relationships. • Use Case Diagram – describes sequences of action involving actors. • Sequence Diagram – shows interaction with objects in a time-ordered manner. • Collaboration Diagram – interaction with objects without time relevance. • Activity Diagram – shows data flow from one activity to another. Similar to flow chart diagrams • Statechart Diagram – shows transition of an object from one state to another as a response to an event • Package Diagram – shows components in packages.

  28. Recap • After studying this chapter we learned to: • Define an object. • Understand the terms class, attribute, and operations. • Explain generalization, polymorphism, and inheritance. • Define association. • Describe modeling and the Unified Modeling Language.

More Related