cs6359 introduction to oo an introduction to object-oriented analysis and design

26
CS6359 Introduction to OO An Introduction to Object-oriented Analysis and Design

Upload: buddy-joseph

Post on 29-Dec-2015

220 views

Category:

Documents


2 download

TRANSCRIPT

CS6359Introduction to OO

An Introduction to Object-oriented Analysis and Design

CS6359Summer 2001

Slide 2

References

• Object-Oriented Modeling and Design; Rumbaugh, et.al.; Prentice Hall

• The Unified Modeling Language User Guide; Booch, et.al.

• Design Patterns; Elements of Reusable Object-oriented Software; Gamma, et.al.

CS6359Summer 2001

Slide 3

Questions

• What is an object?

• What is OOA&D?

• How should objects interact?

• What is UML?

• What is a design pattern?

• What process do I follow?

CS6359Summer 2001

Slide 4

Software Engineering Evolution

• Procedure

• Subroutines

• Structured Programming

• CASE

• 4GL

• Object Oriented

• Component Ware

CS6359Summer 2001

Slide 5

Language Perspective

• First Generation (1954 – 1958)– Fortran I

• Second Generation (1959 – 1961)– Fortran II, Algol, Cobol

• Third Generation (1962 – 1970)– PL/I, Pascal

• Object Oriented Languages– Smalltalk, C++, Java

CS6359Summer 2001

Slide 6

OO Languages• Simula

– Developed for discrete event simulation (1967)– Simulation modeling is a hard problem for conventional languages– Simulated objects must interact and change state in many different and often

unpredictable ways– Simulation can solve problems that are too complex for mathematical equations– Simulation objects are usually easy to identify and communicate via message

passing

• Smalltalk– Origins at Xerox PARC with the work of Alan Kay and Adele Goldberg– The idea was to develop a small language that could be used by everyone on

their own personal computers– Influenced by Simula: objects and classes– The WIMP interface is tied closely to Smalltalk

• Windows, Icons, Mice and Pointers– Apple picked this up in Lisa and Macintosh

CS6359Summer 2001

Slide 7

OO Languages (cont’d)

• C++– AT&T Bell Labs – Bjorne Stroustrup– Adds object-oriented features to the C language– Classes correspond to types in the language

• Ada– DOD support for embedded systems language– Large and complex language– Enforces Abstract Data Types (ADTs)

• Specify data structures via the operations that can be performed on them

– Support for multitasking and exceptions– Ada95 provides OO extensions

CS6359Summer 2001

Slide 8

OO Languages (cont’d)• Java

– The newest OO language– Syntax resembles C++– Structure and design reflects Smalltalk– Java overcomes the two drawbacks to C++ and Smalltalk

• Frees the programmer from having to manage memory (accidental complexity)

• Small footprint (memory requirement)– Eliminates: pointers, pointer arithmetic, structs, typedefs,

preprocessor directives (#define), malloc and free– But has: extensive type checking, true arrays with array

bounds checking, null pointer checking, automatic garbage collection

CS6359Summer 2001

Slide 9

Evolution of Object Technology

• OOP: Object-Oriented Programming– Simula (1967) and Smalltalk (70’s)– C++ (mid 80’s)

• OOD: Object-Oriented Design– Grady Booch (1980)

• OOA: Object-Oriented Requirements– James Rumbaugh (late 80’s)

• OO-Databases (OODBs): 1990’s• CORBA, Java, UML: mid 90’s

CS6359Summer 2001

Slide 10

General Definitions

• Objects—things, concepts, or entities• Characteristics of Objects:

– Identity: data is quantized into discrete, distinguishable entities called objects.

– Classification: objects with the same data structure (attributes) and behavior (operations) are grouped into a class.

– Polymorphism: the same operation may behave differently on different classes.

– Inheritance: the sharing of attributes and operations among classes based on a hierarchical relationship.

CS6359Summer 2001

Slide 11

General Definitions (cont’d)

• OOA&D—software development approach that emphasizes a logical solution based on objects

• Analysis—finding and describing concepts in the problem domain.

• Design—defining software objects that represent the analysis concepts and will eventually be implemented in code.

CS6359Summer 2001

Slide 12

Fundamental Terminology• Abstract Class.

– An incomplete superclass that defines common parts.– Not instantiated.

• Attribute.– Information or state associated with a component.

• Class.– A blueprint or definition of objects.– A factory for instantiating objects.– The description of a collection of related components.

CS6359Summer 2001

Slide 13

Fundamental Terminology

• Containment.– Building a component out of other components.– Objects that contain other objects.

• Concrete class.– Is a complete class.– Describes a concept completely.– Is intended to be instantiated.

• Inheritance.– The automatic acquisition of superclass attribute

and behavior definitions in subclass.

CS6359Summer 2001

Slide 14

Fundamental Terminology

• Instance.– An object created by a class.

• Instantiation.– The act of creating an instance.

• Message.– A request sent to an object to invoke a method.– A message is similar to a function call, but

different in that an object only responds to a predetermined set of messages defined by its class.

CS6359Summer 2001

Slide 15

Fundamental Terminology• Method.

– The implementation of a message.• Sending a message invokes a method.

• Object.– A software component.– An instance of a class.– A structure that bundles together attributes and behavior.

• Polymorphism.– Objects of different classes responding to the same

message.• The response of each object may vary depending on its class.

CS6359Summer 2001

Slide 16

Fundamental Terminology

• Specialization.– The act of defining one class as a refinement of

another.

• Subclass.– A class defined in terms of a superclass using

inheritance.

• Superclass.– A class serving as a base for inheritance in a

hierarchy.

CS6359Summer 2001

Slide 17

Object-Oriented Methodology

• OMT – Object Modeling Technique by James Rumbaugh

• Four Stages of OMT:– Analysis– System Design– Object Design– Implementation

CS6359Summer 2001

Slide 18

OO Methodology (cont’d)

• Three Models in OMT– Object Model: describes the objects in the

system and their relationships.– Dynamic Model: describes the interactions

among objects in the system.– Functional Model: describes the data

transformation of the system.

CS6359Summer 2001

Slide 19

Object-Oriented Themes

• Abstraction

• Encapsulation

• Combining Data and Behavior

• Sharing

• Emphasis on Object Structure, Not Procedure Structure

• Synergy

CS6359Summer 2001

Slide 20

UML

• Unified Modeling Language

• “a graphical language for visualizing, specifying, constructing, and documenting the artifacts of a software intensive system.” [Booch]

• UML does not – Guide a developer in how to do OOA&D.– Identify what development process to follow.

CS6359Summer 2001

Slide 21

UML History

• OO languages appear mid 70’s to late 80’s• Between ’89 and ’94, OO methods increased

from 10 to 50.• Prominent methodologies

– Booch– Jacobson’s Object-oriented software engineering

(OOSE)– Rumbaugh’s Object Modeling Technique (OMT)

CS6359Summer 2001

Slide 22

UML History (cont’d)• Unification of ideas began in mid 90’s.

– Rumbaugh joins Booch at Rational ’94– v0.8 draft Unified Method ’95– Jacobson joins Rational ’95– UML v0.9 in June ’96– UML 1.0 offered to OMG in January ’97– UML 1.1 offered to OMG in July ’97– Maintenance through OMG RTF– UML 1.2 in June ’98– UML 1.3 in fall ‘99

CS6359Summer 2001

Slide 23

Design Patterns

• Design Pattern—reusable solution to typical problems.

• “Each design pattern systematically names, explains, and evaluates an important and recurring design in object-oriented systems.” [Gamma]

CS6359Summer 2001

Slide 24

Design Patternessential elements

• Pattern name—handle to identify a particular pattern; creates a vocabulary.

• Problem—identifies context when pattern should be applied.

• Solution—an abstract description of a design problem along with a template object design that solves the problem.

• Consequences—results and trade-offs of applying the pattern.

CS6359Summer 2001

Slide 25

OO Development Processes

• Fusion– Hewlett Packard

• Recommended Process and Models– ObjectSpace best practices– Larman’s experiences

• The Unified Process– Rational; Booch, Jacobson, and

Rumbaugh

CS6359Summer 2001

Slide 26

Summary

• Primary references• General definitions• Fundamental Terminology• Object-Oriented methodology• Object-Oriented themes• Unified Modeling Language• Design patterns• Object-oriented development processes