Development · English usage comparison
Library vs Framework: English Usage Guide for IT Professionals
The key distinction is control: a library is code you call; a framework calls your code. Libraries solve specific problems you choose to use; frameworks provide a structure that constrains how you build the application. The principle is called "inversion of control".
Side-by-side comparison
| Aspect | Library | Framework |
|---|---|---|
| Who controls the flow? | You — you call the library | Framework — it calls your code |
| Opinionated? | No — use it as you like | Yes — dictates structure |
| Example | Lodash, Axios, Moment.js | React, Django, Spring, Rails |
| Replace easily? | Usually — swap one library for another | Hard — framework shapes the whole app |
Example sentences
Library
- "We use Axios as our HTTP client library — we call it when we need to make requests."
- "I imported the date library and called its format() function."
Framework
- "Django is a framework — it dictates how you structure your project, routing, and ORM."
- "The framework calls your view functions when a matching route is hit."
Exercises: choose the correct English usage
Select the best answer for each question, then check your reasoning.
1. "You call it when you need it; it doesn't control your app's structure." This describes a ___.
Explanation: A library is code you call on demand. You control the flow.
2. "The ___ calls your functions — you write hooks to plug in." Which word?
Explanation: Frameworks call your code (inversion of control). You fill in the blanks they provide.
3. Django, Rails, and Spring are ___.
Explanation: All three are opinionated frameworks — they provide the full structure for building web applications.
4. Which sentence uses the words correctly?
Explanation: React is a UI library (you control when components render); Next.js adds routing and structure — making it a framework.
5. What is "inversion of control"?
Explanation: IoC is the defining difference: the framework controls execution flow and inverts the normal call relationship.
Frequently asked questions
What is "inversion of control"?
The framework owns the main event loop and calls your code at the right moments (e.g. when a route is matched, when a component renders). In contrast, you call a library explicitly.
Is React a library or a framework?
React is a library for building UIs. It doesn't provide routing, state management, or build tooling — you compose those from other libraries. Next.js (built on React) is a framework.
What is "opinionated"?
A framework is opinionated when it has strong conventions about how you should structure your project. Rails is highly opinionated; Express is unopinionated (called a "minimalist framework" or micro-framework).
What is a "micro-framework"?
A minimal framework that provides routing and basic request/response handling but leaves everything else to you. Flask (Python) and Express (Node.js) are examples.
Can a framework include libraries?
Yes — frameworks often bundle libraries. Django includes an ORM, a templating engine, and an admin interface.
What does "npm package" mean?
A reusable piece of code published to the npm registry. Packages can be libraries, frameworks, CLI tools, or configuration presets.
What is "vendor lock-in"?
Becoming so dependent on a specific framework that switching is prohibitively expensive. It's a common concern when choosing a framework.
What is a "plugin"?
An extension that adds functionality to a framework or tool. Frameworks like Webpack, Vite, and WordPress are built around plugin ecosystems.
What is "convention over configuration"?
A design philosophy (popularised by Rails) where sensible defaults mean less configuration is needed. Follow the conventions and things just work.
What does "built on top of" mean?
"Next.js is built on top of React" means Next.js uses React internally and extends its capabilities — it's a higher-level abstraction.