软件工程原理与实践 04 软件开发方法.ppt
**********************************************
**************aspectauthentication//thisistheaspect{
before:call(publicvoidTransfer(..))//thisisapointcut
{ //thisistheadvice
inttries=0; stringuserPassword=Password.Get(tries);
while(tries3userPassword!=thisUser.password())
{
//allow3triestogetthepasswordright
tries=tries+1;
userPassword=Password.Get(tries);
}
if(userPassword!=thisUser.password())then
//ifpasswordwrong,assumeuserhasforgottentologout
System.Logout(thisUser.uid);
}}//authenticationAspect编码示例*编程语言:AspectJ,JAsCo,CaesarJ,AspectS,ObjectTeams,HyperJ,JBOSSAOP,Compose*,DemeterJ,AspectC++,...*AspectWeaving*面向方面软件开发的原理RequirementBusinessLogicPersistenceSecurityLogging*02-面向对象方法01-结构化方法03-基于构件的开发方法*04-面向服务方法06-模型驱动开发方法05-面向方面方法08-产品线开发方法和领域工程07-形式化方法模型驱动开发将软件的开发集中于模型而不是程序(代码)的一种开发方法从模型自动产生程序(代码)主要用来提高开发生产率和代码的可靠性OMG定义模型驱动的体系结构(Model-DrivenArchitecture,简称MDA)的初衷定义一组标准来支持模型驱动的开发UML是MDA的基础之一*模型和元模型*MDA中的三种模型Computation-
IndependentModel(CIM)Platform-
IndependentModel(PIM)Platform-
SpecificModel(PSM)MoreAbstractMoreSpecific*计算无关模型(CIM)举例*Usesthevocabularyofthedomain.Noinformationinthemodelindicatesthatacomputer-basedsolutionwillbeused.平台无关模型(PIM)举例*LessabstractthanCIMClosertoimplementationbutnottiedtoaplatform.平台有关模型(PSM)举例*LessabstractthanPIMClosertoimplementationJ2EEelementscapturedinmodel模型间的转换*测试系统工程需求设计编码计算无关模型CIM业务模型平台无关模型PIM分析模型平台有关模型PSM设计模型代码实现模型测试模型模型驱动的软件开发(MDD)以模型为中心(相对于以代码为中心)的软件开发方法基于以下两种久经考验的技术*SC_MODULE(producer){sc_inslaveintin1;intsum;//voidaccumulate(){sum+=in1;cout“Sum=“sumendl;}?sc_module?
producerstartout1(1)抽象(2)自动化?sc_module?
producerstartout1SC_MODULE(producer){sc_inslaveintin1;int