25
Fall, 2002 SJSU -- CMPE Enterprise & Application Frameworks Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San José State University One Washington Square San José, CA 95192-0180 URL: http://www.cmpe.sjsu.edu/~fayad

Fall, 2002 SJSU -- CMPE Enterprise & Application Frameworks Dr. M.E. Fayad, Professor Computer Engineering Department – RM# College of Engineering San

Embed Size (px)

Citation preview

Fall, 2002 SJSU -- CMPE

Enterprise & Application Frameworks

Dr. M.E. Fayad, ProfessorComputer Engineering Department – RM#

College of Engineering

San José State University

One Washington Square

San José, CA 95192-0180

URL: http://www.cmpe.sjsu.edu/~fayad

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S2 OO Concepts

2

Lesson 3:Object-Oriented Concepts

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S3 OO Concepts

Lesson Objectives

Objectives

3

Understand OO concepts

Using UML concepts

Explore OO models

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S4 OO Concepts

Model building is a well established human tradition, e.g.

Ancient Egyptian built models for their pyramids and temples

Early ship builders produced physical models for the British Admiralty

Building plans

Electronic schematics

Physics

4

Modeling

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S5 OO Concepts

5

More on Modeling All models

Are description of something (i.e., a representation

that is not the real thing)

Allow us to answer questions about the real thing,

before we build it

Capture only those features deemed “essential” by

model builders for their goals

Any single thing can be represented by a large number of models

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S6 OO Concepts

6

More on ModelingModels can be validated (How?)

Experimenting with physical things

Quizzing experts, in a field of endeavor, about a conceptual entity.

We will focus on a model building approach to system development allowing:

An early explicit representation of the system to be built

Functionality

Data

Engineers to reason about implicit properties of the system

Deadlock

Response time

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S7 OO Concepts

7

More on Modeling

In particular, we will focus on graphical modeling notations to utilize

“The parallel processing” capabilities of the human visual system in perceiving relationships

A picture is worth a thousand words

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S8 OO Concepts

In this course, we will focus on the job of modelers:

How they collect facts/requirements about the application domain from different sources

How they prepare models of the application domain

How they limit their modeling activities

How they create one or more models of the target system

How they use models to create blueprints and architect software

How they test and validate their models 8

Modeling in this Course

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S9 OO Concepts

9 Reading: Norman, D.A., Some Observations on Mental Models, In Dedre Gentner and Albert L. Stevens (Eds.), Mental Model. Hillsdale, NJ: Lawrence Erlbaum Associates, Inc. 1983.

Target System

ConceptualModel

MentalModel

ScientificModel

Mental Model

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S10 OO Concepts

10

Mental Model Properties

Incomplete

Limited

Unstable

Unscientific

Complicated

Parsimonious

Unreliable

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S11 OO Concepts

11

Modeling Concepts

Logical Forms

Structure

Abstraction

Concepts

Objects

Classes

Roles

Actors

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S12 OO Concepts

12

Logical FormsThe same substance often take several forms.

ice, steam, water, snow, frost, fog are different forms of H2O

Some substances can be transformed from one form to

another.

Not all of our studies are of material substances.

Speech, Writing, Geometry, Physics, etc.

But each area of human study acknowledges the existence of

“good form”.

“Form” is thus equated with the existence of a

pattern/order/consistency/regularity

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S13 OO Concepts

13

Structure “Structure” is the way a thing/construct/form is built up from its

parts.

Changing the structure’s content can lead to new forms.

Musical notes, part of a house, etc.

A given content may exist in several different forms.

But each area of human study acknowledges the existence of

“good form”.

Conversely, a form may also appear in several different

contents

In fashion, dresses can be made from different materials.

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S14 OO Concepts

14

Abstraction“Abstraction” is the consideration of a form apart from its contents. Examples:

“roundness” is a property of a golf ball, a snow ball, a baseball, etc.

“hardness’ is a property of diamond, wood, steel, etc.

Abstraction can be improved upon by practice and study.

Abstract forms are discovered, and named, in the investigation of analogous forms.

A song ==> piano, guitar, etc.

A sphere ==> gold, steel, etc.

We teach abstraction by presenting a set of different things (physical or conceptual) and pointing out the common features that called formal properties.

formal properties are those properties that allow us to express the form of a thing.

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S15 OO Concepts

15

Concept“A concept” is an abstract form or an abstraction.

There is a set corresponding to each concept.

“The dress is white” means the dress is a member of the set of white things.

These sets need not to be disjoint (i.e., the same member may appear in several sets.

The white dress is short and charming.

These set are called classes or categories.

Concepts are formal properties we use to describe things.

The primitive notions of a factual scientific theory are its concepts

Biology ==> cells, bacteria, virus, animal, plant, etc.

Adjectives & adverbs usually are the names of concepts in English

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S16 OO Concepts

16

Roles A “role” is the part of a person or thing plays in a specific situation, operation, etc..

Many different object can play the same role.

Many roles can be played by the same object.

The white dress is short and charming.

A description of a role involves descriptions of:

Activities to be performed

Sequences or processes

Commands to be given and received

Roles are, therefore, abstractions (i.e., abstract forms or concepts).

In fact, roles are abstract temporal forms (i.e., a certain behavior at relative points in time).

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S17 OO Concepts

17

Actors

Roles are defined independently of the things used to play that role.

Conversely, Actors are classes that are capable of playing different roles.

They are often classes of physical things.

Man, Woman, Car, etc.

They are often capable of playing different roles in the same time

Woman ==> Doctor, Mother, Pilot

They often take-on and lose roles over time

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S18 OO Concepts

18

System Development is a Model Building

A model is any description of a system that captures some essential aspect while disregarding or ignoring others.

System development is the gradual transformation of a sequence of models.

Each model is an abstraction of the system which enables the designer to make the necessary decisions at this level in order to move closer to the final model, the tested source code.

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S19 OO Concepts

19

Models Serve Several Purposes

Testing a physical entity before building it

Communication with customers

Visualization

Reduction of complexity

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S20 OO Concepts

20

Modeling Notation

Notation

Notation Again !

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S21 OO Concepts

21

Objects/Classes• Real-world systems can be decomposed into discrete entities called

objects.

• Objects represent some things, concepts, or abstraction with definable

boundaries and behaviors.

• An object is specific instance of a class to which it belongs.

• Classes have attributes and behaviors.

• Individual objects have their own specific values for each attribute and

share the same behaviors.

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S22 OO Concepts

22

More on Objects/Classes

Examples: Objects Classes Attributes

A computer screen Screen Resolution, # of colorsA window Window Size, location

IBM Company Name, location, total revenue

Chris Jones Employee Name, department, salary

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S23 OO Concepts

23

More on Objects/Classes

• Objects with the same attributes, behaviors, and

relationships are grouped together into classes.

• A class describes general attributes and behaviors for a

group of objects.

• An object is a single instance of its class (e.g., IBM is an

instance of the Company class).

• A Class diagram is used to describe the attributes and

behaviors of a class.

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S24 OO Concepts

24

More on Objects/Classes

ClassName

Attributes

Behaviors

Class Diagram

Employee

namesalarydept

calculatePaypayAdjustment

Examples

Window

sizelocationbackground

showWindowhidWindow

Fall 2002 SJSU -- CmpE M.E. Fayad L3-S25 OO Concepts

• What is mental model? What are their properties?

• What are the properties of an essential model?

• What are the differences between tangible and intangible modeling?

• Identify examples of tangible modeling in system development

• Identify examples of intangible modeling in system development

• “System development is model building.” Please describe.

• “Models serve several purposes.” Please describe.

• Define: logical forms, abstraction, concepts, roles, actors, and objects 17

Discussion Questions