By: D. Roberts, R. E. Johnson
Published in: PLoPD3
Summary: A common path that frameworks take.
To start designing a framework for a particular domain, develop three applications the framework should support.
You're using Three Examples and have started to build your second application. Some frameworks rely heavily on inheritance, others on polymorphic composition. Use inheritance. Build a white-box framework by generalizing from classes in individual applications. Don't worry if the applications don't share any concrete classes.
You're using White-Box Frameworks and developing the second and subsequent examples. Similar objects must be implemented for each problem the framework solves. To avoid writing similar objects for each instantiation of the framework, start with a simple library of the obvious objects and add additional objects as you need them.
You're using Component Library. As you develop applications based on your framework, you will see similar code. Pree calls these "Hot Spots" [Pree94]. To eliminate this common code, separate code that changes from code that remains stable. The changing code should be encapsulated in objects. Variation can then be achieved by composing the desired objects rather than creating subclasses and writing methods.
You're using Component Library. Most of the subclasses you've written differ in trivial ways--for example, only one method is overridden. To avoid creating trivial subclasses when you use the framework, design adaptable subclasses to parameterize with messages to send, for example, indexes to access, blocks to evaluate, whatever distinguishes the subclasses.
You're using Component Library, and refactoring components to make them more reusable. Continue dividing objects until you would produce objects that have no meaning in the problem domain.
You're using Pluggable Objects, Hot Spots, and Fine-Grained Objects. Some frameworks rely heavily on inheritance, others on polymorphic composition. Use inheritance to organize your component library and composition to combine components in applications. When it isn't clear which is better, favor composition.
You're using Black-Box Framework and can make an application by connecting objects. A single application comprises two parts: (1) the script that connects the objects of the framework and turns them on and (2) the behavior of the objects. The connection script is usually similar for each application, but the specific objects are different. To simplify the creation of these scripts, create a graphical program that lets you specify the objects in your application and how they are connected. The program should generate code for an application from these specifications.
You're using Visual Builder. The program creates complex composite objects. To inspect and debug these, create specialized inspecting and debugging tools.