该【《设计准则》 】是由【相惜】上传分享,文档一共【29】页,该文档可以免费在线阅读,需要了解更多关于【《设计准则》 】的内容,可以使用淘豆网的站内搜索功能,选择自己适合的文档,以下文字是截取该文章内的部分文字,如需要获得完整电子版,请下载此文档到您的设备,方便您编辑和打印。第三章设计准那么I:正确性和健壮性DesignPrinciplesICorrectnessandRobustness精选课件软件设计的目标:正确性、健壮性、灵活性、可重用性和高效性正确性、充分性灵活性、可重用性纯粹的极限程序设计XP(extremeprogramming):每个工程都要满足指定的需求,然后一起满足所有应用程序的需求。Goal:Thateachartifactsatisfiesdesignatedrequirements,andthattogethertheysatisfyalloftheapplication’,应该进行简单和模块化设计。一个设计足以实现需求设计必须完全可理解设计非常模块化一个正确设计有时称为…最小目标接下来……到达这个目标的常用方法是……。类不变式例:InvariantsforClassAutomobilemileage>=0mileage<1000000vehicleID至少为8个字符value>=-300(300美元是一辆报废车的处理价格)originalPrice>=0(type==“REGULAR〞&&value<=originalPrice)||(type==“VINTAGE〞&&value>=originalPrice)Automobile类的方法要考虑这些不变式,这正是我们经常将变量设为私有的原因。()perishable()getWidth()printRoute()describeType()getLength()getDuration()setType()getWeight()DimensionsgetWidth()getLength()getWeight()TransportationMeansgetDurationsetVehicle()printRoute()GoodsTypedescribeType()setType()perishable()ShipmentDimensionsTransportationMeansGoodsType通过接口使Shipment类的结构变清晰:两种表示方法精选课件Java局部实现代码:interfaceDimensions{publicdoublegetWidth();publicdoublegetLength();publicdoublegetWeight();}……classShipmentimplementsDimensions,TransportationMeans,GoodsType{publicdoublegetWidth(){……}……}<<singleton>>PurchasesIFPricingSelectionClothingTryout精选课件chatServerger聊天应用程序的模块,包含了效劳包及客户包接口chatClientConversation会话ConversationManager会话管理m效劳器通信Conversation-ServicesParticipant-ServicesDisplay显示m客户端通信Message-ReceptionputerConversationCharge()ConversationgetConversation(intaCoversationID)……:应用程序特有的类domainclass例如:BankCustomerBankTransactionTeller足以让所有需求清晰化非领域类:一般类nondonmainclass例如:抽象类实用类用于补充设计和实现精选课件
《设计准则》 来自淘豆网www.taodocs.com转载请标明出处.