Unformatted text preview:

How to Develop FrameworksWhat is a Framework?Slide 3How to Use a FrameworkParts of a systemReasons to Use FrameworksDisadvantages of FrameworksSlide 8First Rule of Framework DesignFrameworks and XPTheme for Designing FrameworksRelevant PrinciplesGeneralize from Concrete CasesFrameworks are GeneralizationsFinding Abstract ClassesEliminating Refused BequestApplying the Composite PatternFrameworks Require IterationFrameworks Encode Domain KnowledgeCustomers are Application ProgrammersUp-front Design of FrameworkTypical Way to Develop FrameworkMy Way to Develop FrameworkNine Steps in Developing FrameworksSlide 25White-box vs. Black-boxExamplesFinding ExamplesAdvantages of Black-box FrameworksDisadvantages of Black-box FrameworkVisual BuilderLanguage ToolsHints for Framework DesignSize MattersStrategic ConcernsCustomers are CrucialReuse ScenariosDealing with IterationDocumentation and TrainingSlide 401How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonHow to Develop FrameworksRalph E. JohnsonDept. of Computer Science1304 W. Springfield Ave.Urbana, IL 61801http://st-www.cs.uiuc.edu/users/johnson/[email protected](217) 244-00932How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonWhat is a Framework?Framework:• is reusable design of an application or subsystem • is represented by a set of abstract classes and the way objects in those classes collaborate.• is overly simple program that can be extended to make real program.• tells how to decompose a problem into objects.• is not just the classes, but the way instances of the classes collaborate.3How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonWhat is a Framework?Just a program - but one that can be easily extended.Complex pattern - made up of several simpler design patterns.Inversion of control -- "don't call us, we'll call you".4How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonHow to Use a FrameworkUse framework to build application by:• Creating new subclasses• Configuring objects together• Modifying working examples (editing scripts).5How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonParts of a systemFramework•Framework (abstract classes)•LibraryApplication•Concrete subclasses•Other classes•Script (in programming language or in XML)6How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonReasons to Use FrameworksFramework used•to simplify existing code•to build applications quickly•to make applications more consistent•to meet standard•to make maintenance easier7How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonDisadvantages of FrameworksMore complex (powerful) than necessary.Slower and larger than necessary.Takes time to learn.Difficult to develop8How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonHow to Develop FrameworksStart with applications.Refactor to simplify designs and share code.Build more applications.Refactor to simplify designs and share code.Build more applications.…When new applications no longer require refactoring shared code, the framework is done.9How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFirst Rule of Framework DesignDon't. You don’t really need it.Don't. Use an existing one.or10How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFrameworks and XPIs framework the simplest thing that could possibly work?•Yes - if you already know it.•No - if you have to design it.•Yes - if you are building 20 similar applications.•No - if it doesn’t quite do what you want and it is not clear how to change it.Only use a framework when it is cost effective.•Never know for sure•Include learning, documentation11How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonTheme for Designing FrameworksFramework design is derived from application design.Design frameworks to be overly simple and concrete, and refactor to be more reusable.Refactoring: Improving the Design of Existing Code, Martin Fowler, Addison-Wesley 1999.Design Patterns: Elements of Reusable Object-Oriented Software, Gamma, Helms, Johnson, Vlissides, Addison-Wesley 1995.12How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonRelevant PrinciplesFrameworks are abstractions: people generalize from concrete examplesDesigning reusable code requires iterationFrameworks encode domain knowledgeCustomer of framework is application programmer13How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonGeneralize from Concrete CasesPeople think concretely, not abstractly.Abstractions are found bottom-up, by examining concrete examples. Generalization proceeds by • finding things that are given different names but are really the same, • parameterizing to eliminate differences, • breaking large things into small things so that similar components can be found, and • categorizing things that are similar.14How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFrameworks are GeneralizationsFrameworks are OO programs generalized to fit many examples.Common ideas become abstract classes.Objects parameterized to make them reusable.Ad-hoc systems broken down into smaller parts.Use inheritance to organize class library.15How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFinding Abstract ClassesAbstract classes are discovered by generalizing from concrete classes.To give two classes a common superclass:• give them common interface+ rename operations so classes use same names+ reorder arguments, change types of arguments, etc.+ refactor (split or combine) operations • if operations have same interface but different implementation, make them abstract• if operations have same implementation, move to superclass16How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonEliminating Refused BequestSdoBXdoAdoBdoCClients never use doCXdoAdoCYdoAdoDYdoAdoD17How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonApplying the Composite PatternWholePart*WholePart*ComponentWP PPWP PPWP P18How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFrameworks Require IterationReusable code requires many iterations.Basic law of software engineering If it hasn't been tested, it doesn't work.Corollary: software that hasn't been reused is not reusable.19How to Design Frameworks -- Copyright 2005 by Ralph E. JohnsonFrameworks Encode Domain KnowledgeFrameworks solve a particular set of problems.Not necessarily application-domain specific, but domain specific. (GUI,


View Full Document

UIUC CS 598 - How to Develop Frameworks

Download How to Develop Frameworks
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view How to Develop Frameworks and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view How to Develop Frameworks 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?