This preview shows page 1. Sign up to view the full content.
Unformatted text preview: e for pattern Usually C++, sometimes Smalltalk or Java 11. Known uses Often systems that inspired pattern (typically from Smalltalk world) 12. References - See also Related patterns that may be applied in similar cases Go4 Taxonomy Go4 Taxonomy Principles underlying Go4 patterns 1. Rely on abstract classes to hide away differences between subclasses from clients Object class vs. object type Class deGines how an object is implemented Type deGines an object s interface (protocol) Program to an interface, not an implementation Principles (cont d) 2. Black-box vs. white-box reuse Black-box relies on object references, usually through instance variables White-box reuse by inheritance Black-box reuse preferred for information hiding, run-time Glexibility, elimination of implementation dependencies Disadvantages: Run-time efGiciency (high number of instances, communication by message sending) Favor composition over class inheritance 27 28 Go4 Taxonomy Case study Principles (cont 3. Delegation d) Lexi: A simple GUI-based editor Lexi is a WYSIWYG editor supporting the display of documents that contain general textual and graphical objects. Scroll bars help users select portions of the document to be displayed. Lexi should be easy to port from a platform to another and support multiple look-and-feel interfaces. Design of Lexi highlights many issues in OO design Study design patterns as they arise in the design of Lexi Powerful technique when coupled with black-box reuse Allow delegation to different instances at run-time, as long as instances respond to similar messages Disadvantages: Sometimes code harder to read and understand + efGiciency (because of black-box reuse) 29 30 Case study Case study Issues in the design of Lexi 1. Representation and manipulation of document 2. Formatting a document 3. Adding scroll bars and borders to Lexi windows 4. Support multiple look-and-feel standards 5. Handle multiple windowing systems 6. Support user operations 7. Advanced features (spell-checking and hyphen...
View Full Document
- Spring '12