后置条件异常:
无
相关用例:
Generalization,Includes,Extends/ExtensionPoint:
无
基本场景/乐观场景:
Text(文本)-待定;Diagram(图)-见WithdrawFromCheckingAccount乐观场景顺序图
替代性可选场景/被动场景:
Text-待定;Diagram-见WithdrawFromCheckingAccount活动图
业务规则:
ValidAccountRule,AdequateBalanceRule
测试实例:
1-乐观的:
输入:
sAcctNum-BGates001,nWithdraw-100,nCurrentBalance-1000Conditions:
None,输出:
"BGates001withdraw$100OKandrecorded";2...待定
输入/输出表单:
WithdrawFromCheckingAccount用例的输入/输出表单
WithdrawRequestForm(取款需求表单)
CustomerAccountNumber(客户账号)__________
WithdrawAmount(取款数量)________
Button-Submit(提交按钮)Button-Clear(清除按钮)
WithdrawResponseForm(取款响应窗体)
CustomerAccountNumber__________
WithdrawAmount__________
Status(状态)________________________
Button-OK(OK按钮)
需求-顺序图WithdrawFromCheckingAccount-乐观场景
注:
getApp的第一笔事务需要达到应用程序的最高级别
Rose顺序图:
在浏览器窗口,选择UseCaseView;选择UseCaseDiagram;选择一个用例;选择Browse-InteractionDiagram-UseCaseView-;选择SequenceDiagram;键入图名,例如WithdrawFromCheckingAccount-OptiminticScenario;在图上放置对象以表示参与者;双击每个对象,然后从下拉列表中选择参与者名;
在图的中央放置一个对象以表示系统;双击对象,从下拉列表中键入系统名;选择RoseObjectLink(对象连接符),在参与者和系统之间拖曳;选择Tools-CheckModel;选择File-Save.
4-WithdrawFromCheckingAccount用例-所有场景的需求活动图
注:
getApp的第一笔事务需要达到应用程序的最高级别
Rose状态-活动图:
在浏览器窗口,选择UseCaseView;
选择UseCaseDiagram显示图;
选择一个用例;选择Browse-StateDiagram;
如果"StateDiagram"是灰色,则返回到用例图并重新选择一个用例;
在图上放置活动状态(activitystates);通过在两个状态之间拖曳,放置转移;
选择Tools-CheckModel;
选择File-Save。
需求-产品性能:
高可靠性,10个并发的用户,2秒响应时间。
需求/分析-高阶概念模型(HOCM--HighOrderConceptModel)
外部参与者:
TellerGUI,BankDB.内部实体(InternalEntities):
BankApp,Account,CheckingAccount,SavingsAccount
Rose高级别概念模型图:
推荐使用铅笔和纸做HOCM。
作为替代,创建不含属性和操作的Rose类图。
分析模型-草图
分析类图-最简结构
Rose类图:
见〈使用RationalRose〉
分析包图
Rose包图:
在浏览器窗口选择LogicalView;选择Browse-ClassDiagram-LogicalView-。
输入包图名;在图上放置包;从工具条中选择依赖箭头然后从源包到目的包拖曳,放置依赖关系。
在浏览器中,拖动每个类到适当的包;选择Tools-CheckModel;选择File-Save。
分析WithdrawFromCheckingAccount顺序图-乐观场景
注:
getApp的第一笔事务需要达到应用程序的最高级别
Rose顺序图:
见〈使用RationalRose〉
8-分析Account类的状态图
Rose状态-活动图:
在浏览器窗口,选择UseCaseView;选择UseCaseDiagram显示;选择一个用例;选择Browse-StateDiagram;如果"StateDiagram"是灰色,则返回到用例图并重新选择一个用例;在图上放置活动状态(activitystates);通过在两个状态之间拖曳,放置转移;选择Tools-CheckModel;选择File-Save.
分析-复杂操作:
待定的-每一个操作的活动图和/或操作规约:
名称,输入,前置条件/异常,转换,后置条件/异常,业务规则,描述。
Rose规约:
显示类图;选择一个类;按鼠标右键显示SpecificationDialogBox;选择一个标签,例如Operations;双击一个操作;填写操作信息;选择Tools-CheckModel;选择File-Save.
设计模型-编码的基础
设计过程环境:
Linux6.2版,GNUC++6.2版,C++标准库,CORBA3。
设计潜在模式
企业级:
基于分布式CORBA,具有公共接口的组件
系统(组件到组件):
分层,会话-实体(Session-Entity),回调(Callbacks),发行者-订阅者(Publisher-Subscriber)
组件:
应用-文档,控制器-实体-边界,虚包(Facade)
类设计:
UML,Factory(工厂),事务
JAVA语言:
JavaBean,EnterpriseJavaBean,Servlet,RMI
设计包图
设计类图说明类型和参数-目标是完成编码
注:
CheckingAccount和SavingsAccount提供多态操作的实现。
设计顺序图WithdrawFromCheckingAccount-乐观场景
注:
getApp的第一笔事务需要达到应用程序的最高级别
设计协作图WithdrawFromCheckingAccount-乐观场景
在RationalRose中打开顺序图,按F5自动创建协作图。
设计CheckingAccount类withdraw()操作的操作规约
用例名:
withdraw
触发:
withdraw
输入参数:
nWithdraw:
int
输出返回值:
boolean
前置条件:
nWithdraw<=nCurrentBalance
出现的前置条件/异常:
exInsuffientFunds
描述/转换:
nCurrentBalance=nCurrentBalance-nWithdraw
后置条件:
nCurrentBalance后置条件异常:
exIncorrectBalance
基本/乐观场景:
见WithdrawFromCheckingAccount顺序图
替代性场景/悲观场景:
见WithdrawFromCheckingAccount活动图
业务规则:
ValidAccountRule,AdequateBalanceRule
设计异常类(exceptionclasses)异常超类(操作:
Exception()/Exception(string);异常子类:
exInsufiicientFunds[操作:
exInsufiicientFunds()、exInsufiicientFunds(string)];exIncorrectBalance[操作:
exIncorrectBalance()、exIncorrectBalance(string)]。
设计CheckingAccount类的状态图
实施模型(ImplementationModels)
实施模型
设计过程环境
实施组件图
实施文件(ImplementationFiles):
TellerGUI.exe,BankApp.exe,BankDB.exe
组件接口选择:
1)BankApp具有单接口IbankApp,其所有操作都是公有的(exposed)
2)BankApp暴露(exposes)IBankApp,ICheckingAccount,&ISavingAccount接口
3)BankApp暴露(exposes)IBankApp,IWithdraw,IDeposit,ICheckingAccount,&ISavingAccount接口
CORBAIDL/C++需要对接口进行描述
Rose组件图:
在浏览器窗口,选择ComponentView;,将"Main"重命名为"ComponentView";双击图名显示该图;在图上放置组件和依赖关系(从client组件到supplier组件拖曳);在浏览器中把每个类拖到相应的组件中;选择Tools-CheckModel;选择File-Save.
实施部署图
Rose部署图:
在浏览器窗口选择DeploymentView;双击以显示该图;在图上放置节点和关系;选择Tools-CheckModel;选择File-Save.
//使用CORBA的BankApp系统的接口
//SampleIDLInterfaceCode(IDL接口代码样本)
moduleBankApp{
interfaceIBankApp{
exceptionexInsuffientFunds;
IBankAppgetApp();
booleandepositToCheckingAccount(instringsAcctNum,inintnDeposit);
booleandepositToSavingAccount(instringsAcctNum,inintnDeposit);
booleanwithdrawFromCheckingAccount(instringsAcctNum,inintnWithdraw)raises
(exInsuffientFunds);
booleanwithdrawFromSavingAccount(instringsAcctNum,inintnWithdraw)raises
(exInsuffientFunds);
};};
//SampleJavaInterfaceCodeUsingRemoteMethodInvocation
//(使用RMI的Java接口样本)
importjava.rmi.*;
packageBankApp;
publicinterfaceIBankAppextendsjava.rmi.Remote{
booleandepositToCheckingAccount(StringsAcctNum,intnDeposit)throws
java.rmi.RemoteException;
booleandepositToSavingAccount(StringsAcctNum,intnDeposit)throws
java.rmi.RemoteException;
booleanwithdrawFromCheckingAccount(StringsAcctNum,intnWithdraw)throws
java.rmi.RemoteException;
booleanwithdrawFromSavingAccount(StringsAcctNum,intnWithdraw)throws
java.rmi.RemoteException;
}
//SampleMicrosoftIDLInterfaceCodeforCOM-Simplified
//(MicrosoftIDL的COM接口编码样本-简化版)
libraryBankAppLib{
dispinterfaceIBankApp{
IBankAppgetApp();
booleandepositToCheckingAccount(BSTRsAcctNum,intnDeposit);
booleandepositToSavingAccount(BSTRsAcctNum,intnDeposit);
booleanwithdrawFromCheckingAccount(BSTRsAcctNum,intnWithdraw);
booleanwithdrawFromSavingAccount(BSTRsAcctNum,intnWithdraw);
};
coclassBankApp{
dispinterfaceIBankApp;
};};
//SampleSOAP(SimpleObjectAccessProtocol)SDL(ServiceDescriptionLanguage)
withXML-Incomplete
//包含XML的SOAPSDL样本-不完全
xmlversion='1.0'?
>
xmlns='urn:
schemas-xmlsoap-org:
sdl.2000-01-25'
xmlns:
dt='http:
//www.w3.org/1999/XMLSchema'
xmlns:
IBankApp='IBankApp'>
schemas-xmlsoap-org:
soap-sdl-2000-01-25'>
WithdrawFromCheckingAccount'/>
WithdrawFromCheckingAccountResponse'/>
//myserver/IBankApp.asp'/>
schemaid='IBankApp'targetNamespace='IBankApp'
xmlns='http:
//www.w3.org/1999/XMLSchema'>
boolean'/>
schema>
构建
编码/命名标准;接口代码-CORBAIDL;C++代码;CASE工具脚本/定制报告的VBA/代码生成
Rose代码生成-需要Rose专业版或企业版.见HelpTopicCodeGeneration(帮助主题-CodeGeneration)。
步骤:
1-检查模型;
2-创建组件;
3-映射/分配类到组件;
4-设定代码生成特性;
5-选择一个类、组件或包
6-生成代码;
7-检查生成的代码。
Rose逆工程-需要Rose专业版或企业版.见HelpTopic-Reverse