上游充通大学 SHANGHAI JIAO TONG UNIVERSITY 2.Reuse http://www.roughlydrafted.com/2007/12/17/advancing- software-reuse-of-linux-windows-code-on-the-mac/ Software Engineering
Software Engineering 2. Reuse http://www.roughlydrafted.com/2007/12/17/advancing- software-reuse-of-linux-windows-code-on-the-mac/
上游充通大兽 2.1 Introduction SHANGHAI JIAO TONG UNIVERSITY Main goal: Reuse knowledge from previous experience to current problem Reuse functionality already available Composition (also called Black Box Reuse) New functionality is obtained by aggregation The new object with more functionality is an aggregation of existing components © Inheritance (also called White-box Reuse) New functionality is obtained by inheritance. Three ways to get new functionality: Implementation inheritance Interface inheritance 。Delegation Software Engineering
Software Engineering 2.1 Introduction Main goal: • Reuse knowledge from previous experience to current problem • Reuse functionality already available Composition (also called Black Box Reuse) • New functionality is obtained by aggregation • The new object with more functionality is an aggregation of existing components Inheritance (also called White-box Reuse) • New functionality is obtained by inheritance. Three ways to get new functionality: • Implementation inheritance • Interface inheritance • Delegation
上游充通大兽 2.2 Reuse Heuristics SHANGHAI JIAO TONG UNIVERSITY Look for existing classes in class libraries JSAPI(Java Speech API),JTAPI(Java Telephony AP),… Select data structures appropriate to the algorithms ·Container classes Arrays,lists,queues,stacks,sets,trees,.. Define new internal classes and operations only if necessary Complex operations defined in terms of lower-level operations might need new classes and operations Software Engineering
Software Engineering 2.2 Reuse Heuristics Look for existing classes in class libraries • JSAPI(Java Speech API), JTAPI(Java Telephony API), .... Select data structures appropriate to the algorithms • Container classes • Arrays, lists, queues, stacks, sets, trees, ... Define new internal classes and operations only if necessary • Complex operations defined in terms of lower-level operations might need new classes and operations
上游充通大兽 2.3 Reuse Concepts SHANGHAI JIAO TONG UNIVERSITY Application objects versus solution objects Specification inheritance and implementation inheritance The Liskov Substitution Principle Delegation © Delegation and inheritance in design patterns Software Engineering
Software Engineering 2.3 Reuse Concepts Application objects versus solution objects Specification inheritance and implementation inheritance The Liskov Substitution Principle Delegation Delegation and inheritance in design patterns
上游究通大学 (1)Application Domain vs Solution Domain SHANGHAI JIAO TONG UNIVERSITY Objects Requirements Analysis Object Design (Language of Application (Language of Solution Domain) Domain) Incident Report Incident Report Text box Menu Scrollbar Do the two Incident Reports have the same meaning? Software Engineering
Software Engineering (1) Application Domain vs Solution Domain Objects Incident Report Requirements Analysis (Language of Application Domain) Incident Report Object Design (Language of Solution Domain) Text box Menu Scrollbar Do the two Incident Reports have the same meaning?