CIS 644 Thurs. Sept. 30, 1999 W6B … assignment: 2ed object model … patterns … Java … assignment: Java … patterns
viewing lecture files: detached view can be resized detached browser can be resized works OK for me
oops.. correction.. getAutos method in Agency Agency.getAutos(…) -> myAutos.getAutos(…) easier to find primary UI ops
status, directions: chap 1 design.. more examples chap 2 composition chap 3 interfaces patterns … chap 4 threads
Assignment:
Video Store … rents videos video.. key = index, name rent for fixed price for N days. late fee is $1 customer … key = name address, phone cannot check if owes $$ max 10 out
interfaces for: addVideo addCustomer rent … a video return.. a video payFee … towards late fee getCustomerInfo getVideo Info (by name)
scenarios for: add video rent video return video
missing:..will do later log of transactions load & store data backup recover from log
work in pairs …
BadarpuraHubka BhaktaCarlson BodapatlaGardner Boina FengBohra ForgieSun JakherPallack LaneRubio LiuHorn ParanjpeTyree Terrazas WuSpriegel Zhang Ali
composite pattern: transparency vs safety
public interface IComponent { void operation( ) ; boolean isLeaf(); void add( Component C) throws IComponentException; void remove( IComponent C); IComponent[ ] getComponents(); }
public class Leaf implements IComponent { // class definition here boolean isLeaf () { return true;} IComponent [ ] getComponents() { return null } ; }
public class Composite implements IComponent { // class definition here IComponent [ ] children; boolean isLeaf () { return false;} }
assignment: build Java code “snippet” for one pattern … with some comments and for typical operation build single web page ( or provide url) open assignment: select specific pattern.
Iterator: also called a cursor external iterator: client requests next, get Item internal iterator: client passes passes on operation, iterator applies op to all items p. 258
Proxie … Coad, p. 101 Gamma, p. 207 an object with a single association with “actual” object provides interface of “actual” why: p. 109 … reuse UI remote proxie virtual proxie protection proxie
Visitor: an operation to be performed on elements of a structure... allows new operations to be defined without changing elements of the structure.. p. 331
END