Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004
Feb. 23, 2004CS WPI2 §Term Project Administration §Changes to Course Material §Questions §Quiz #3 §Review of Chapters 8 & 9: §In-class Exercise: l Requirements for new design project Class Format for Today
Feb. 23, 2004CS WPI3 Term Project Administration §Return Phase 2 – Functional Specifications l And Journals §Return Quiz #2 §About Phase 3: l How is the project progressing? l Can we continue as planned? System & Object Design for CTS due next week l Have you started object design, or do you prefer to just focus on system design?
Feb. 23, 2004CS WPI4 Changes to Course Material §Next week start on a new project to design l Home Inventory System (thanks to Michael) l Discuss requirements later tonight §Presentations or 2 phases for last month? §Readings & lecture topics: l Read Chapter 10 for next week l New assignments will be posted to web site §Discuss possible topics for CS562
Feb. 23, 2004CS WPI5 Questions? §About what was covered last time §From the reading §About the Term Project §Anything else?
Feb. 23, 2004CS WPI6 Quiz #3 Chapters 7, 8, 9 You have 15 minutes
Feb. 23, 2004CS WPI7 Chapter 8 Object Design: Reusing Pattern Solutions
Feb. 23, 2004CS WPI8 Overview of Activities §Reuse (Chapter 8) l Pick off-the-shelf components & design patterns §Service specification (Chapter 9) l Precisely describe each class interface §Object model restructuring (Chapter 10) l Improve understandability & extensibility l Optimizations to address performance criteria (time, memory, etc.)
Feb. 23, 2004CS WPI9 Purpose of Object Design §Close the gap between application objects and selected hardware/software platforms §Identify missing functionality not covered by system design §Construct precise specifications of classes, attributes and operations §Produce a model from which a set of classes can be implemented by individual developers
Feb. 23, 2004CS WPI10 Reuse §Off-the-shelf components identified during system design need to be integrated l Class libraries & 3 rd party components selected for basic data structures & services l Wrapping components with custom objects l Refining them using inheritance §Design patterns selected for solving common problems & isolating the effects of change
Feb. 23, 2004CS WPI11 Interface Specifications §Subsystem services identified during system design specified in terms of class interfaces l Operations & Arguments l Type signatures l Constraints & Exceptions §Identify operations & objects needed to transfer data among subsystems
Feb. 23, 2004CS WPI12 Restructuring §Transforming & optimizing the object model should occur after classes & objects have been designed & interfaces fully specified l Often design activities can get side-tracked by optimization concerns l Focusing on interfaces, components & design patterns results in a more flexible design model l Focusing on optimizations first tends to produce design model that is rigid & difficult to modify
Feb. 23, 2004CS WPI13 Reuse Concepts §Application Objects vs. Solution Objects §Inheritance vs. Delegation §The Liskov Substitution Principle §Design Patterns §Application Frameworks
Feb. 23, 2004CS WPI14 Application & Solution Objects §Application domain objects come from the requirements & analysis l Boundary, Control, Entity l Represent concepts in the problem domain §Solution objects developed during design l Represent concepts with no counterparts in the problem domain
Feb. 23, 2004CS WPI15 Inheritance vs. Delegation §Review Set/Hashtable example on pgs §Discuss distinction between inheritance and delegation §Which one is better? Why? §Is it a general rule, or better only in this case? §Are there cases where the other is better? §How does inheritance relate to taxonomy?
Feb. 23, 2004CS WPI16 Liskov Substitution Principle “If an object of type S can be substituted in all the places where an object of type T is expected, then S is a subtype of T. §Who can interpret what this means? §Examples?
Feb. 23, 2004CS WPI17 Intro to Design Patterns §Purpose: l Template solutions to recurring problems §History: l Patterns evolve over time l Refined for maximizing reuse & flexibility §Capture Knowledge: l Document context & trade-offs l Provide guidance about when to use inheritance vs. delegation
Feb. 23, 2004CS WPI18 Design Pattern Participants §Client Class l Accesses the pattern §Pattern Interface l Part of pattern that is visible to the client §Implementor Class(es) l Provides low-level behavior (may be > 1) §Extender Class l Provides a specialized implementation or extended behavior
Feb. 23, 2004CS WPI19 Design Patterns §Adapter §Bridge §Strategy §Abstract Factory §Command §Composite
Feb. 23, 2004CS WPI20 Application Frameworks §Terminology: l Hook Method l Infrastructure Framework l Middleware Framework l Enterprise Application Framework l White Box Framework l Black Box Framework
Feb. 23, 2004CS WPI21 Chapter 9 Object Design: Specifying Interfaces
Feb. 23, 2004CS WPI22 Activities Overview §Identify missing attributes & operations §Specify type signatures & visibility §Specify contracts on classes & methods
Feb. 23, 2004CS WPI23 Interface Spec. Concepts §Participants: l Class implementor l Class extender l Class user (client) §Types, signatures & visibility §Contracts on classes and methods: l Invariants, pre- and post-conditions
Feb. 23, 2004CS WPI24 Participants §Class Implementor l Realizes the class §Class User (Client) l Invokes operations provided by the class §Class Extender l Develops specializations of the class
Feb. 23, 2004CS WPI25 Types, Signatures & Visibility §Type specifies range of valid values: l For attribute, parameters & method return l Examples? §Signature specifies method: l Name, param types, return type §Visibility specifies who can see what l Private, protected, public l What does each mean?
Feb. 23, 2004CS WPI26 Contracts on Classes, Methods §Invariants l Predicate true for all instances of a class §Pre-conditions l Predicate true before an operation is invoked §Post-conditions l Predicate true after an operation has completed §Purpose? §Examples?
Feb. 23, 2004CS WPI27 Object Constraint Language §Formal language for specifying contracts §Constraints should be specified in design document, but may be done more informally §Contracts should also be documented in code, using comments. §See example code on page 358
Feb. 23, 2004CS WPI28 In-class Exercise Requirements for Home Inventory System
Feb. 23, 2004CS WPI29 For Next Time §Phase 3 due (Design Documents) §Read Chapter 10 – Mapping Models to Code §Check course web site for updates l Syllabus l Reading material l Term project §I will send to the class when updated