Patterns for Evolving Frameworks

By: D. Roberts, R. E. Johnson
Published in: PLoPD3
Pages: 471-486
Category: Frameworks

Summary: A common path that frameworks take.


Pattern: Three Examples

Pages: 472-474

To start designing a framework for a particular domain, develop three applications the framework should support.

Pattern: White-Box Frameworks

Pages: 474-476

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.

Pattern: Component Library

Pages: 476-477

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.

Pattern: Hot Spots

Pages: 478-479

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.

Pattern: Pluggable Objects

Pages: 479-480

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.

Pattern: Fine-Grained Objects

Pages: 481-482

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.

Pattern: Black-Box Framework

Pages: 482-483

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.

Pattern: Visual Builder

Pages: 483-485

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.

Pattern: Language Tools

Pages: 485-486

You're using Visual Builder. The program creates complex composite objects. To inspect and debug these, create specialized inspecting and debugging tools.