教程說(shuō)明案例basictraining_第1頁(yè)
教程說(shuō)明案例basictraining_第2頁(yè)
教程說(shuō)明案例basictraining_第3頁(yè)
教程說(shuō)明案例basictraining_第4頁(yè)
教程說(shuō)明案例basictraining_第5頁(yè)
已閱讀5頁(yè),還剩29頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

CAA

V5

Object

ModelerC++?

C++的三個(gè)特征EncapsulationInheritancePolymorphismInterface/Implementation

Definition(1/2)?

An

interface

is

an object

with

a

set

of

pure

virtual

methods

that?

defines

a

behavior

that

implementation

objects

must

support.?

An

interface

does

not

know

which

objects

implement

it.?

An

interfacesets

a

contract

between

a

client

and

provider’s

codeFunction

prototypes(函數(shù)原型)Designintent(設(shè)計(jì)目的)CAA

V5

Object

ModelerInterface/Implementation

Definition(2/2)?

An

implementation

is

an

object

thatdefines

a

specific

way

to

fulfill

the

contract

set

by

aninterface.?

An

implementation

has

to

explicitly

state

which

interface(s)

itadheres

to.?

Animplementation

must

provide

code

for

all

the methods

defined

in

theinterfaces

it

adheres

to.?

The

client

application

deals

with

the

implementation

onlythrough

the

interface.CAA

V5

Object

ModelerInterface/Implementation

Rules?

An

interface’s

name

gets

always

an

?

I

?

as

the

4thcharacter.?

DS

interface

names

begin

by

CATI.(建議:GWS的接口名前綴用GWSI)?

An

interface

can

be

implemented

by

several

objectsin

different

ways.CAA

V5

Object

ModelerInterface

at

work:the

GUID?

The

GlobalUnique

Identifier(GUID)

of

an

Interfaceis

stored

in

a

specific

module

:?

Module’s

default

name

generated

by

the

CAA

wizard:MyFrameworkInterfacesUUID.m?

Name

of

thefile

:

TSTIMyInterface.cpp?

The

MyFrameworkInterfacesUUID

and

MyFrameworkInterfacesItf

(orMyFrameworkInterfacesItfCPP)

modules

has

to

be

included

in

the

Imakefile.mk

files

inother

Frameworks

for

accessing

the

TSTIMyInterface

interface.CAA

V5

Object

ModelerInterface

at

workCAA

V5

Object

ModelerImplementation

at

work(1/2)CAA

V5

Object

ModelerImplementation

at

work(2/2)CAA

V5

Object

ModelerThe

CATImplementClass

MacroCAA

V5

Object

ModelerUsing

Interface(1/4)?

Getting

anInterface

from

anImplementationCAA

V5

Object

ModelerUsing

Interface(2/4)?

Using

an

Interface

methodCAA

V5

Object

ModelerUsing

Interface(3/4)?

Gettingan

Interface

from

another

InterfaceCAA

V5

Object

ModelerUsing

Interface(4/4)?

Manage

errorCAA

V5

Object

ModelerCreate

an

Interface

with

CAA

V5

wizards

in

Visual

C++?

Create

TSTIMyInterfaceinterfaceCAA

V5

Object

ModelerCreate

an

Implementation

with

CAA

V5

wizards

in

Visual

C++?

Create

an

implementation

thatadheres

to

the

TSTIMyInterface

interfaceCAA

V5

Object

ModelerCoding

Rules黃金法則(1/3)?

Adopt

a

consistent

naming

scheme

采取一致

名方案?

Manipulating

the

same

object

through

many

different

interface

pointers

quickly

getsconfusing

操作同一個(gè)對(duì)象,通過(guò)多種不同的接口指針?

Using

the

same

interface

to

manipulate

different

objectsquickly

gets

confusing使用相同的接口,操作不同對(duì)象CAA

V5

Object

ModelerCoding

Rules黃金法則(2/3)?

Always

test

the

return

value

of

the

QueryInterface

method

beforeusing

the

returnedpointer?

Use

variable

naming

conventionArgument

prefix:

i

for

input,

o

for

outputVariable

prefix:p

pointerpp

pointer

onpointerspsmart

pointerpi

pointer

on

interfacea

arrayCAA

V5

Object

ModelerCoding

Rules黃金法則(3/3)?

Apply

following

rules

for

the

signature

methodsCAA

V5

Object

ModelerInterface

Limitation?

Interface

/

Implementation

pattern

:Application

uses

interfaces

instead

ofimplementation

objects.The

application

remains

isolated

from

the

implementation.?

Clients

should

not

deal

withimplementations

to

avoid

coupling(耦合).So

we

need

to

encapsulate

theimplementation

instantiationCAA

V5

Object

ModelerFactory?

A

factoryis

a

special

object

that

contains

methods

dedicated

to

object

creation.工廠是一個(gè)特殊的對(duì)象,其中包含對(duì)象的方法,主要用于新建一個(gè)對(duì)象?

The

factory

creates

an

implementation

object

and

returns

an

interface

object

on

it.工廠創(chuàng)建一個(gè)實(shí)現(xiàn)對(duì)象并返回對(duì)象的接口指針?

The

factory

minimizes

the

coupling

since

theclient

application

doesn't

manipulate

anyimplementation

instance.工廠最小耦合,因?yàn)榭蛻舳藨?yīng)用程序不執(zhí)行任何操作實(shí)例?

The

object

creation

is

centralized

which

enables

a

better

object

management.創(chuàng)建的對(duì)象集中,以便很好地管理對(duì)象?

The

factory

object

is

instantiated

when

the

application

( ,container…)

isinitialized

and

implementation

object

is

retrieved

through

methods

in

it.CAA

V5

Object

ModelerFactory

at

workCAA

V5

Object

Modeler:Extension

MechanismInterface/Implementation

limits?

How

to

add

new

capabilities

(behaviors)

on

an

existing

object

withoutmodifying

theimplementation

object

?CAA

V5

Object

Modeler:Extension

MechanismExtension

ExampleCAA

V5

Object

Modeler:Extension

MechanismExtension

at

workCAA

V5

Object

Modeler:Extension

MechanismExtension

Types?

Data

ExtensionCan

contain

methods

and

data

membersOne

extension

object

for

each

extended

object

instanceExtension

deleted

with

the

implementation

object?

Code

ExtensionCan

only

contain

methodsOnly

one

extension

object

for

all

extended

object

instances

but

for

each

implemented

interfaceExtension

deleted

at of

sessionCAA

V5

Object

Modeler:Extension

MechanismDictionary?

A

dictionary

is

required

tolocate

all

other

interfacesbound

t

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論