Docsity

Object Oriented Design-Object Oriented Design and Analysis-Lecture Slides, Slides of Object Oriented Analysis and Design

Toggle sidebar
bg1
Ch. 4 1
Object-oriented design
• One kind of module, ADT, called
class
• A class exports operations (procedures)
to manipulate instance objects
– often called
methods
• Instance objects accessible via
references
docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Object Oriented Design-Object Oriented Design and Analysis-Lecture Slides and more Slides Object Oriented Analysis and Design in PDF only on Docsity!

Ch. 4

Object-oriented design

• One kind of module, ADT, called

class

• A class exports operations (procedures)

to manipulate instance objects

– often called

methods

• Instance objects accessible via

references

Ch. 4

Syntactic changes in TDN

• No need to export opaque types

– class name used to declare objects

• If a is a reference to an object

– a.op (params);

Ch. 4

An example

class

EMPLOYEE

exports

function

FIRST_NAME(): string_of_char;

function

LAST_NAME(): string_of_char;

function

AGE(): natural;

function

WHERE(): SITE;

function

SALARY: MONEY;

procedure

HIRE (FIRST_N: string_of_char;

LAST_N: string_of_char;INIT_SALARY: MONEY);

Initializes a new EMPLOYEE, assigning a new identifier. procedure

FIRE();

procedure

ASSIGN (S: SITE);

An employee cannot be assigned to a SITE if already assigned to it (i.e., WHEREmust be different from S). It is the client’s responsibility to ensure this. The effect is todelete the employee from those in WHERE, add the employee to those in S, generatea new id card with security code to access the site overnight, and update WHERE.

end

EMPLOYEE

Ch. 4

class ADMINISTRATIVE_STAFF inherits EMPLOYEE exports procedure DO_THIS (F: FOLDER); This is an additional operation that is specific toadministrators; other operations may also be added. end ADMINISTRATIVE_STAFF class TECHNICAL_STAFF inherits EMPLOYEE exports function GET_SKILL(): SKILL; procedure DEF_SKILL (SK: SKILL); These are additional operations that are specific totechnicians; other operations may also be added. end TECHNICAL_STAFF

Ch. 4

How can inheritance be

represented?

• We start introducing the UML notation• UML (Unified Modeling Language) is a

widely adopted standard notation forrepresenting OO designs

• We introduce the UML class diagram

– classes are described by boxes

Ch. 4

UML representation of

inheritance

EMPLOYEE TECHNICAL_STAFF ADMINISTRATIVE_STAFF

Ch. 4

Aggregation

• Defines a PART_OF relation

Differs from IS_COMPOSED_OFHere TRANGLE has its own methodsIt implicitly uses POINT to defineits data attributes

TRIANGLE 1 3 POINT

Ch. 4

More on UML

• Representation of IS_COMPONENT_OF

via the

package notation

package_name

Class 1Class 2

Class 3

Ch. 4

Standard architectures

pipeline

event based

blackboard

Ch. 4

Domain specific

architectures

"model–view–controller" architecture for softwarethat has a significant amount of user interaction

Model (store

data e.g. text)

Controller

(interact with user;perform commands)

View (display model

for user)

Ch. 4

Component integration

• The CORBA (

Common Object Request Broker

Architecture) Middleware

• Clients and servers connected via an Object

Request Broker (ORB)

• Interfaces provided by servers defined by an

Interface Definition Language (IDL)

• In the Microsoft world: DCOM (

Distributed

Component Object Model)

Ch. 4

The CORBA architecture

Object Request Broker CORBA Services Application Objects Domain Interfaces CORBAFacilities