Skip to main content

Reuse framework versus program generator

Short answer

An application framework is a reusable skeleton extended by subclassing, giving high flexibility but needing knowledge of internals. A program generator produces code from a domain description, giving high productivity in narrow domains but limited flexibility. Frameworks use inversion of control; generators create programs with normal control flow.

Compare reuse framework and pattern generator.

Both are reuse approaches that reuse more than single components. An application (reuse) framework is a set of abstract and concrete classes and interfaces that forms the skeleton of an application; developers reuse it by extending it with their own subclasses. A program generator captures domain knowledge in a tool: developers write a short description in a domain-oriented language, and the generator produces the code automatically.

PointApplication frameworkProgram generator
What is reusedDesign and code of an application skeletonDomain knowledge built into the generator
How it is usedSubclass and add code at "hot spots"Write a specification or use an interactive tool
OutputRunning system = framework + developer's codeGenerated source code (sometimes edited further)
Control flowInversion of control: framework calls developer codeGenerated program has its own normal control flow
Skill neededGood OO programming and knowledge of framework internalsKnowledge of the domain and the description language
Range of useFairly wide (web apps, GUIs, middleware)Narrow, well-understood domains only
FlexibilityHigh: any behaviour can be coded in subclassesLimited to what the generator supports
ExamplesSpring, Django, .NET, Java Swingyacc/lex, report generators, CASE code generators, GUI builders

In short: a framework gives a partly built program that developers complete by programming, while a generator lets developers describe what they want and builds the program for them. Generators give higher productivity in a narrow domain; frameworks give more flexibility across a wider range of applications.

✓ Answer checked by Claude Sonnet 5.5

All Software Engineering chapter 5 questions →