2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer
Chapter © Prentice Hall, 2004 Outline OO Terminology: -- Object, Encapsulation. – Class, Attribute, and Methods (processes, operations). – Generalization, Inheritance, Polymorphism. – Association. – Modeling and the Unified Modeling Language (UML).
Chapter © Prentice Hall, 2004 Object A business entity (person, agency in environment, thing, concept) important for business). An entity that encapsulates data and behavior - Objects are categorized into classes - Each individual object is an instance of a class
Chapter © Prentice Hall, 2004 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
Chapter © Prentice Hall, 2004 Objects & Classes Class: A category of objects that share attributes, operations, relationships, and semantics Object: An instance of a class Name Attributes Operations Object – An instance of class with specified Values of Attributes (specific data) /10/ /10/2003 Class
Chapter © Prentice Hall, 2004 Attributes Attribute - a named property of a class that describes a range of values that instances of the attribute might hold Attributes are the way classes encapsulate data
Chapter © Prentice Hall, 2004 Operation/Method A behavior of an object; what it can do We use operation and method interchangeably Methods are identified and invoked by their signatures, including name, parameters, and return type
Chapter © Prentice Hall, 2004 Signature identifies and invokes the behavior Method implements the behavior
Chapter © Prentice Hall, 2004 Minus sign indicates private domain. Plus sign indicates public domain (accessible). Inaccessible to other objects Only object’s methods can access that object’s data
Chapter © Prentice Hall, 2004 Inheritance: The technique by which the more specific class in a generalization relationship includes the attributes and methods of the more general class Generalization: The relationship between a more general (or parent) class and a more specific (or child) class The more specific class can have additional attributes and operations (methods) Inheritance & Generalization
Chapter © Prentice Hall, 2004 Subclasses inherit attributes & operations of the superclass, plus have some of their own. Generalization represented by arrows from subclasses to superclass. Class “generalizes” attributes & methods of subclasses.
Chapter © Prentice Hall, 2004 Association A relationship between objects or between classes (special associations). Types: (1) Special associations between classes: – Generalization (previous slide) – Part-Whole associations: Aggregation: part-whole relationships where the part can exist independently of the whole (e.g., Bill—Item) Composition: part-whole relationships where the part and the whole are fully dependent on each other (e.g., Building—Room)
Chapter © Prentice Hall, 2004 This is a binary association, showing roles (“places”) and multiplicities (one-to-many objects participating in association) Types of Associations: (2) Between objects places >
Chapter © Prentice Hall, 2004 Each type of vehicle has its own version of calcPrice() Message: Calculate pricePolymorphism The ability of different classes to respond to same messages in different ways. (Polymorphism = “many forms”.)
Chapter © Prentice Hall, 2004 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
Chapter © Prentice Hall, 2004 Interface The point of connection between different system parts (e.g., components). Technique by which users of a component invoke its behaviors and manipulate its properties The interface is implemented by method signatures
Chapter © Prentice Hall, 2004 Interfaces are represented as small rectangles
Chapter © Prentice Hall, 2004 Package Group of classes sharing similar characteristics or purposes (e.g., Sales package, Accounting package)
Chapter © Prentice Hall, 2004 Unified Modeling Language™ (UML) UML is a standard notation for representing object-oriented systems. Used with Rational Unified Process ™ various symbol used in various diagrams representing classes, objects, system behavior See pervious slides – all are in UML