Download presentation
Presentation is loading. Please wait.
1
UML & Programming Martin Fowler
2
Content Class Diagrams to Java Code Interaction Diagrams
3
Class diagrams for Order
4
Specification Perspective
class Order{ public Order (Customer customer); public Date getReceived(); public void setReceived(Date arg); public String getNumber(); public Customer getCustmoer(); public void setCustomer(Customer arg); public Enumeration getOrderLines(); public void addOrderLines(OrderLine arg); public void removeOrderLine(OrderLine arg); public void price(); } class OrderLine{ public OrderLine(int quantity, Product product); public int getQuantity(); public Money getPrice(); public Product getProduct();
5
Implementation Perspective
class Order{ public Order(Customer customer); private Customer _customer; private Vector _orderLines; private Date _recevied; private String _number; public void price(); } class OrderLine{ public OrderLine(int quantity, Product product); private int _quantity; private Money _price; private Product _product;
6
Constraints
7
Implementing a Constraint
class Order{ boolean isValid{ if (getCustomer.getCreditRating.equals(CreditRating.poor())) return isPrepaid(); else return true; } void assertInvariant(){ if(IS_DEBUGGING) if(!isValid()) throw new RuntimeExcetption( “Order Object not valid”);
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.