实现模型 徐迎晓 xuyingxiao@126.com 复旦大学软件学院
实现模型 徐迎晓 xuyingxiao@126.com 复旦大学软件学院
实现模型 输入:设计过程的制品/交互图,设计类 可边设计边编程 对2周的迭代,考虑靠近迭代开始的半天 做可视化建模设计工作,再进入编程 ●设计得到的是不完整的结果,编程和测 试时会有大量修改,并发现和解决大量 细节问题
实现模型 输入:设计过程的制品(交互图,设计类 图) 可边设计边编程 对2周的迭代,考虑靠近迭代开始的半天 做可视化建模设计工作,再进入编程 设计得到的是不完整的结果,编程和测 试时会有大量修改,并发现和解决大量 细节问题
实现模型 MAPPING DESIGNS TO CODE Testing Refactoring 9 Component Diagram e Deployment Diagram
实现模型 MAPPING DESIGNS TO CODE Testing & Refactoring Component Diagram Deployment Diagram
MAPPING DESIGNS TO CODE public class Sales Lineltem private int quantity public SalsLineltem(ProductSpecification spec, int qty)(.3 public Money get([.J Productspecification Sales lineltem description: Text quantity: Integer Described-by price: Money itemID: ItemID get Subtotal: Money o
MAPPING DESIGNS TO CODE
public class Sales Linelter Simple attribute ..,.*.o private int quantity Reference attribute\ ...,..o private Product Specification product Spec, public Sales Lineltem(ProductSpecification spec, int qty)i public Money get Subtotal..) Product Specification Sales lineltem description: Text quantity: Integer Described-bt price: Money 1 itemID: ItemID get Subtotal: Money Figure 20.3 Adding reference attributes
public class SalesLineltem private int quantity private Product specification product Spec Productspecification SalesLineltem description: Text quantity: Integer Described-bt price: Money productSpec itemID: ItemID get Subtotal(: Money Role name used in attribute name Figure 20. 4 Role names may be used to generate instance variable names
Sale public class Sale date: Date private Date date Time= new Date…}…… is Complete: Boolean time: Time become ompleteO makeLineltemo makePaymentO In Java, the java util. Date class combines both date arpd l getTtotalo timestamp information. Therefore, the separate attributes in the design can be collapsed when mapping Figure 20.5 Mapping date and time to Java
ProductSpecification spec catalog get Specification(id) ale. makeLineltem(spec, gty) enterltem(id, qty+ 2: makeLineltem(spec, gtyt e Registe Sale 1: spec: get Specification(id Produc Figure 20.8 The enterltem method
Sale public class Sale date: Date is Complete: Boolean SalesLineltem time: Time Contains private List lineltems =new Array List O quantity: Integer become Complete make Lineltemo I getSubtotalO make Payment( getT total A collection class is necessary to\. maintain attribute vis ibility to all the SalesLineltems Figure 20. Adding a collection
●实现的顺序
实现的顺序