




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(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ì)象,通過多種不同的接口指針?
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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 精準(zhǔn)備考2024年國際物流師試題及答案
- 2024年專業(yè)解析的注冊(cè)安全工程師試題及答案
- 國際市場(chǎng)趨勢(shì)與物流策略國際物流師試題及答案
- 深度復(fù)習(xí)國際物流師試題及答案
- 2025年光纖復(fù)合架空地線(OPGW)項(xiàng)目合作計(jì)劃書
- 保安疫情防控培訓(xùn)課件
- 2024年CPSM考試優(yōu)勝方案試題及答案
- 臨汾市重點(diǎn)中學(xué)2025屆高三適應(yīng)性調(diào)研考試化學(xué)試題含解析
- 電子數(shù)據(jù)交換在物流中的應(yīng)用及試題及答案
- 成功應(yīng)對(duì)2024年CPMM的試題及答案建議
- 2022年江蘇財(cái)會(huì)職業(yè)學(xué)院?jiǎn)握新殬I(yè)技能考試筆試試題及答案解析
- 《中國醫(yī)學(xué)大辭典》
- 植物生理教案
- 《前廳服務(wù)與管理》課程標(biāo)準(zhǔn)(中職)
- 異常停機(jī)記錄分析表
- 遙感原理與應(yīng)用:第三章 平臺(tái)及傳感器
- 公司壓力容器明細(xì)臺(tái)賬
- 廣西河池市隆友鋅銀鉛銻礦區(qū)
- GB_T 41377-2022菊粉質(zhì)量要求(高清-最新)
- VFS5210-4DB-06 SMC電磁閥
- 電廠鍋爐本體保溫施工方案完整
評(píng)論
0/150
提交評(píng)論