2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented...

19
2-1 © Prentice Hall, 2004 Chapter 2: Chapter 2: Introduction to Introduction to Object Orientation Object Orientation (Adapted) (Adapted) Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer
  • date post

    22-Dec-2015
  • Category

    Documents

  • view

    217
  • download

    0

Transcript of 2-1 © Prentice Hall, 2004 Chapter 2: Introduction to Object Orientation (Adapted) Object-Oriented...

2-1 © Prentice Hall, 2004

Chapter 2:Chapter 2:Introduction to Introduction to

Object OrientationObject Orientation(Adapted)(Adapted)

Object-Oriented Systems Analysis and Design

Joey F. George, Dinesh Batra,

Joseph S. Valacich, Jeffrey A. Hoffer

2-2Chapter 2 © Prentice Hall, 2004

OutlineOutline

OO Terminology:

-- Object, Encapsulation.

– Class, Attribute, and Methods (processes, operations).

– Generalization, Inheritance, Polymorphism.

– Association.

– Modeling and the Unified Modeling Language (UML).

2-3Chapter 2 © Prentice Hall, 2004

ObjectObject 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

2-4Chapter 2 © Prentice Hall, 2004

EncapsulationEncapsulation

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

2-5Chapter 2 © Prentice Hall, 2004

Objects & ClassesObjects & 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)

1200509/10/2003

16/10/2003

Class

2-6Chapter 2 © Prentice Hall, 2004

AttributesAttributes

• 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

2-7Chapter 2 © Prentice Hall, 2004

Operation/Method 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

2-8Chapter 2 © Prentice Hall, 2004

Signature identifies and invokes the behavior

Method implements the behavior

2-9Chapter 2 © Prentice Hall, 2004

• Minus sign indicates private domain.

• Plus sign indicates public domain(accessible).

Inaccessible toother objects

Only object’s methods can access that object’s data

2-10Chapter 2 © 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 & GeneralizationInheritance & Generalization

2-11Chapter 2 © 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.

2-12Chapter 2 © Prentice Hall, 2004

AssociationAssociation

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)

2-13Chapter 2 © 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 >

2-14Chapter 2 © Prentice Hall, 2004

Each type of vehicle has its own version of calcPrice()

Message: Calculate price

PolymorphismPolymorphismThe ability of different classes to respond to same messages in different ways. (Polymorphism = “many forms”.)

2-15Chapter 2 © Prentice Hall, 2004

ComponentComponent

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

2-16Chapter 2 © Prentice Hall, 2004

InterfaceInterface

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

2-17Chapter 2 © Prentice Hall, 2004

Interfaces are represented as small rectangles

2-18Chapter 2 © Prentice Hall, 2004

PackagePackage

Group of classes sharing similar characteristics or

purposes (e.g., Sales package, Accounting package)

2-19Chapter 2 © Prentice Hall, 2004

Unified Modeling Language™ (UML)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