+ All Categories
Home > Documents > Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Date post: 05-Jan-2016
Category:
Upload: linette-ball
View: 215 times
Download: 1 times
Share this document with a friend
34
Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer
Transcript
Page 1: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Classes

Author: Hans v Leunen

Editors: Henk de Vries & William Ringer

Page 2: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Classification

• Classification simplifies handling• Class-wide items need only to be handled once• Features that are special to the individual must be

treated separately for each member of the class.• The implementation becomes smaller and simpler

when the class-wide part is implemented separately

• If that is done systematically, it has sense to use the same principle for singletons

Page 3: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Choose your trail

• A managers view onto the subject

• An in depth treatise for the technically interested

Page 4: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Programming is modeling

• Programming is a creative occupation

• Programming is a way of modeling a natural or an artificial item in program code

Page 5: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Modeling elements

• Where painters use colors and forms to generate an abstraction of their subject, programmers will use properties, aspects of behavior, relations, communication, encapsulation and coordination as ingredients for their model

• It is smarter to use mutually independent descriptors

• The original, more natural modeling ingredients can be converted into a new set of mutually independent categories of modeling ingredients.

Page 6: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Modeling ElementsAttributes

Trigger

Protocol

Operations

Envelop

Properties

Aspects of behavior

Relations

Communication

Encapsulation

Coordination Task management& synchronization

Page 7: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

How programmers implement modeling elements

• The original, more natural modeling ingredients can be converted in a new set of mutually independent categories of modeling ingredients.

• Programmers have straightforward implementations for each of these new ingredients.

Page 8: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Modeling => Implementation in SW

Attributes

Trigger

Protocol

Operations

Datastructs

Routines

Documents

Call

Envelop ADT

(RTKOS)

Properties

Aspects of behavior

Relations

Communication

Encapsulation

Coordination Task management& synchronization

Page 9: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Grouping Design Elements 1

• The design elements can be divided in two groups:– A group that describes a class of similar items– A group that describes the individuals of that

class– A group can be classified according to its

behavior and the kind of its assets

Page 10: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Wider Scope of ElementsAttributes

Trigger

Protocol

Operations

Envelop

Properties

Aspects of behavior

Relations

Communication

Encapsulation

Coordination

C

C+

Task management& synchronization

I C&

I C&

I C&

I C&

Page 11: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Best practices

Architecture Scope

rules

methods

requirements

view target

Model

Creative andcombinatorialtalents of the

architect

Page 12: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

model

model

model

model

model

model

Architecture Dynamics

View1.0View1.0

View1.1View1.1

View1.2 target

Page 13: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Grouping Design Elements 2

• The design elements can be divided in two groups:– A group that describes the passive relational

part of the architecture– A group that describes the active part of the

architecture

Page 14: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Architecture Split up

Passiverelational

Active

Simple, publishable,

specifies usage

Complex,contains IP,

specifies co-ordination

View1.2

Services

Page 15: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Modeling => DivisionAttributes

Trigger

Protocol

Operations

Envelop

Properties

Aspects of behavior

Relations

Communication

Encapsulation

Coordination

Passive

Active

Task management& synchronization

Page 16: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Exploiting the Division

Passiverelational

Active

Skeleton

Incrementalsteps

Implement

RepositoryRepository

Open-Repository

View1.2

Interactiveprototyping

target

Publishable,specifies

usageServices

IP-Repository

Page 17: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Implementation

• The implementation of an item has a class related part and a part that sets the individual apart

• The result is a binary representation of an abstract data type

Page 18: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

n1

Redirected

Class data

Object data

ADTobject Orientation

Attribute

Attribute

Routine 1

Routine 2

Routine 4

Routine 5

Routine 3

Routine 6

Class ref

Attribute

Attribute

Attribute

Individual

Environment

Routine 6 Routine 6a

Routine 3 Routine 3a

Object data

Class data

Method

Method

Routine 7

Routine 8

Attribute

Attribute

Class wide

Method

Method

Method

Method

Method

Method

Page 19: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Object Orientation, Deficiencies

n1

Redirected

Class data

Object data

Attribute

Attribute

Routine 1

Routine 2

Routine 4

Routine 5

Routine 3

Routine 6

Class ref

Attribute

Attribute

Attribute

Individual

Environment

Routine 6 Routine 6a

Routine 3 Routine 3a

Object data

Class data

Method

Method

Routine 7

Routine 8

Attribute

Attribute

Class wide

Method

Method

Method

Method

Method

Method

Page 20: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Encapsulation

Individual

(State)

Class(Operations)

associationassociationas

socia

tion

EnvironmentGenerate new

individual

Communicate with individual

Pass call tooperation

asso

ciat

ion

Page 21: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

base

base

Class Libraries

Class libraries are structured sets of class modulesClass modules contain differences with respect to parent class

Base class modules contain the full class

Page 22: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Application children

Shell

library

Applications From Class Libraries

child unchanged

library

unused

Page 23: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Application children

Shell

Implementing Distributed Services

child unchanged

unused

services

Page 24: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Application children

Shell

libraries

Distributed Services Conflict

child unchanged

unused

services

services

Page 25: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

OO Component Orientation

n1

Redirected

Class data

Object data

Attribute

Attribute

Routine 1

Routine 2

Routine 4

Routine 5

Routine 3

Routine 6

Class ref

Attribute

Attribute

Attribute

Individual

Environment

Routine 6 Routine 6a

Routine 3 Routine 3a

Object data

Class data

Method

Method

Routine 7

Routine 8

Attribute

Attribute

Class wide

Method

Method

Method

Method

Method

Method

Environment One uniform access way

Class data

Effective IPR hiding

Class ref

Method

Method

Method

Method

Method

Method

Method

Method

Page 26: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

The COM object model

• In short the COM object model is an abstract data type that supports multiple vtbl data structures.

• Each vtbl represents an interface• Each interface includes the base interface

IUnknown• The COM object model is independent of

the programming language

Page 27: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Object Interface (COM)

hidden

hiddenhiddenhiddenhidden

hidden

hidden

hidden

hidden

hidden

hidden

hidden

hiddenQueryInterfaceAddRefReleaseFuncB4FuncB5

QueryInterfaceAddRefRelease

FuncA6

FuncA4FuncA5

Instancedata

Vtbl AVtbl A

Vtbl BVtbl BClass dataClass data

AA

BB

hidden

IUnknown

BB

FuncB4

Page 28: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

COM deficiencies

• The decision to let the clients of the component manage the reference counting appeared to be a design fault.

• The result is, that a COM component is not robust

• It can be abused by its clients

Page 29: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Robust Component Object Model

• In RCOM the reference counting support is deferred to the supporting infrastructure

• The base interface contains a ‘ResetInstance’ method that brings the instance to its initial condition. This function may also include a cleanup task.

• Cleanup and reset are required when a task that passed the instance is halted.

Page 30: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Robust Component Object Model

hidden

hiddenreqItf2conReqreqItf1

hidden

hidden

hidden

hidden

hidden

hidden

hidden

hiddenQueryAccessPoint

ResetInstance

FuncB3FuncB4FuncB5

QueryAccessPointResetInstanceFuncA3

FuncA6

FuncA4FuncA5

Instancedata

Vtbl AVtbl A

VtblVtbl B BClass dataClass data

AA

BB

hidden

IAccessor

BB

FuncB4

Under the control of the infrastructure

Page 31: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Adding HW interfaces

hidden

hiddenreqItf2conReqreqItf1

hidden

hidden

hidden

hidden

hidden

hidden

hidden

hidden QueryAccessPointResetInstanceFuncB5FuncB4FuncB5

QueryAccessPointResetInstanceFuncA3

FuncA6

FuncA4FuncA5

Instancedata

Vtbl A

Vtbl B B

Class dataAA

BB

hidden

Accessor

BB

FuncB4

Hardware

Register

Variable

Register

Variable

Variable to register map

Page 32: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Adding Streaming Interfaces

hidden

hiddenreqItf2conReqreqItf1

hidden

hidden

hidden

hidden

hidden

hidden

hidden

hidden QueryAccessPointResetInstanceFuncB5FuncB4FuncB5

QueryAccessPointResetInstanceFuncA3

FuncA6

FuncA4FuncA5

Instancedata

Vtbl A

Vtbl B B

Class dataAA

BB

hidden

Accessor

BB

FuncB4

Hardware

Register

Variable

Register

Variable

Variable to register map

HWStream

SWStream

stream

Page 33: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Equipped for embedding

• The HW interfaces, the streaming interfaces and the features of the component model render RCOM components particularly suitable for real-time embedded applications.

Page 34: Classes Author: Hans v Leunen Editors: Henk de Vries & William Ringer.

Inheritance in Component Technology

• Interfaces are in fact abstract component classes.• With respect to interfaces, component classes

feature multiple specification inheritance • Via the CLSID components feature single

specification inheritance• Via the IID interfaces feature single specification

inheritance• Other forms of inheritance are not supported


Recommended