---
title: "Reuse framework versus program generator"
subject: "Software Engineering"
chapter: 5
key: "semester_5/software_engineering:framework-vs-generator"
source: https://www.bctengineer.com/q/semester_5/software_engineering/framework-vs-generator
site: BCT Engineering
---

# Reuse framework versus program generator

Software Engineering · Chapter 5: Software Reuse

- Asked in: year not given, 4 marks
- Answer checked by Claude Sonnet 5.5 on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_5/software_engineering/framework-vs-generator
- Whole chapter: https://www.bctengineer.com/md/semester_5/software_engineering/chapter-5

## Question

Compare reuse framework and pattern 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.

## Answer

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.

| Point | Application framework | Program generator |
|---|---|---|
| What is reused | Design and code of an application skeleton | Domain knowledge built into the generator |
| How it is used | Subclass and add code at "hot spots" | Write a specification or use an interactive tool |
| Output | Running system = framework + developer's code | Generated source code (sometimes edited further) |
| Control flow | Inversion of control: framework calls developer code | Generated program has its own normal control flow |
| Skill needed | Good OO programming and knowledge of framework internals | Knowledge of the domain and the description language |
| Range of use | Fairly wide (web apps, GUIs, middleware) | Narrow, well-understood domains only |
| Flexibility | High: any behaviour can be coded in subclasses | Limited to what the generator supports |
| Examples | Spring, Django, .NET, Java Swing | yacc/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.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. How do developers use a program generator?
   A. Subclass abstract classes
   B. Write a short description in a domain-oriented language
   C. Call its components via interfaces
   D. Edit the OS kernel
   Answer: B. They describe what they need and the generator produces the code. (Key point: How used)

2. Which has inversion of control?
   A. Program generator
   B. Both equally
   C. Application framework
   D. Neither
   Answer: C. The framework calls developer code; generated programs have normal control flow. (Key point: Control flow)

3. Which is true?
   A. Generators are more flexible than frameworks
   B. Frameworks have narrower use than generators
   C. Both only work for one domain
   D. Frameworks are more flexible and wider; generators suit narrow domains
   Answer: D. Generators give high productivity in narrow domains; frameworks give flexibility across wider applications. (Key point: Range and flexibility)

## Related in Software Engineering

- [Application framework versus component reuse](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Aframework-vs-component-reuse) — Software Engineering, chapter 5
- [Short note: generator-based reuse](https://www.bctengineer.com/question.md?key=semester_5%2Fsoftware_engineering%3Agenerator-based-reuse) — Software Engineering, chapter 5

## Related in other subjects

- [Framework and design pattern with example](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Aframework-design-pattern-example) — Object Oriented Analysis and Design, chapter 3
- [Pattern vs framework; GRASP patterns](https://www.bctengineer.com/question.md?key=semester_6%2Fobject_oriented_analysis_and_design%3Apattern-vs-framework-grasp) — Object Oriented Analysis and Design, chapter 3
- [Pyramid pattern output program](https://www.bctengineer.com/question.md?key=semester_3%2Fobject_oriented_programming%3Apyramid-program) — Object Oriented Programming, chapter 8
- [Numerical: co-channel distance for 7-cell reuse](https://www.bctengineer.com/question.md?key=semester_7%2Fwireless_communication%3Acochannel-distance-seven-cell) — Wireless Communication, chapter 2
