+ All Categories
Home > Documents > Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F....

Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F....

Date post: 17-Jan-2018
Category:
Upload: godfrey-obrien
View: 232 times
Download: 0 times
Share this document with a friend
Description:
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
28
Chapter 2: Chapter 2: Introduction to Object Introduction to Object Orientation Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer
Transcript
Page 1: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Chapter 2:Chapter 2:Introduction to Object OrientationIntroduction to Object Orientation

Object-Oriented Systems Analysis and Design

Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A. Hoffer

Page 2: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Chapter ObjectivesChapter 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.

Page 3: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is an Object?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

Page 4: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is a Class?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

Page 5: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is Encapsulation?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)

Page 6: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Name

Attributes

Operations

Page 7: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is an Attribute?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

Page 8: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Attributes are properties containing values

Minus sign indicates these are private (hidden)

Page 9: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is an Operation?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

Page 10: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

A method signature identifies the interface to the method

A method implements the behavior

Page 11: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Method signatures

Plus sign indicates these are public (accessible)

Page 12: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is Generalization?What is Generalization?A relationship between

a parent class (more general) classand a child class (more specific)

The more specific the class is, the more additional attributes and operations it has

A parent class Vehicle is more generalA child class Car is more specific

Page 13: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is Inheritance?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

Page 14: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

A generalization relationship is represented by an arrow from the subclass to the superclassSubclasses

inherit all attributes and operations of superclasses

Page 15: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is a Message?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)

Page 16: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is Polymorphism?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

Page 17: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

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

Page 18: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is a Component?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

Page 19: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is an Interface?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

Page 20: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is a Package?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

Page 21: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

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

Page 22: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is an Association?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)

Page 23: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

What is Association Multiplicity?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”

Page 24: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

This is a association, showing roles and multiplicities

Page 25: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

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

Page 26: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

Sample UML

Diagram

Page 27: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

UML DiagramsUML 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.

Page 28: Chapter 2: Introduction to Object Orientation Object-Oriented Systems Analysis and Design Joey F. George, Dinesh Batra, Joseph S. Valacich, Jeffrey A.

RecapRecap 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.


Recommended