Q1Is the Next.js you meet in beginners' books a language, a library, or a framework?
How Programming Languages Differ, and What Frameworks and Libraries Are
This article is part of the IT Foundations course, which builds up from scratch the practical IT knowledge you need at a minimum for programming and vibe coding.
Python and JavaScript differ in how you write, not in what you do. Diagrams take you as far as telling a library from a framework by the direction of the call.
This article covers how programming languages differ, and what frameworks and libraries are.
You will be able to tell whether a name such as React or Next.js is a language or something written in a language.
It covers Python and JavaScript, plus four names: React, Next.js, Django, and Flutter.
What a programming language is — different syntax, the same content
A programming language (the vocabulary and writing rules for source code) is paired with a runtime.
What differs is the syntax (the rules for which symbols and word order you write an instruction in).
| Same role | Python | JavaScript |
|---|---|---|
| Give a value a name | a = 3 | let a = 3; |
| Branch on a condition | if a > 2: | if (a > 2) { |
| Print to the screen | print(a) | console.log(a) |
Python marks a block with a colon at the end of the line and indentation, and JavaScript marks it with ; and { }.
Of the next four lines, the first three are written the JavaScript way and the last one the Python way.
let a = 3;
let b = 4;
console.log(a + b);
console.log(len([a, b]))
After the third line prints 7, it stops at the last line.
Even when you want the same thing, the runtime cannot read it if the way you write it is different.
Languages differ in how you write, not in what you do
A programming language is the set of rules for the symbols and word order you use when writing code.
Giving a value a name, branching on a condition, and repeating exist in every language, and what differs is only how you write them and the runtime that reads them.
Libraries and frameworks — the call runs in opposite directions
A library and a framework are both collections of programs other people wrote, and you use them to write less yourself.
Naming a feature of another program and having it run is what calling it means.
The difference between the two is the direction of that call.
| What to look at | Library | Framework |
|---|---|---|
| English term | library | framework |
| What it holds | Programs with a specific feature | The processing flow of the whole app |
| Relation to your own code | You call it from your own code | You add code in set places |
| Direction of the call | Your own code → library | Framework → your own code |
| What decides the flow | Your own code | Framework |
- What the runtime runs is your own code (app.js)
- Decides the flow of the whole program
- Calls the library where it needs to
- Runs only when it is called
- Returns to your own code when it finishes
- What the runtime runs is the framework
- The flow of the whole app is already written
- Calls your own code at set points
- Runs only when it is called
- Where you write it and what it is named are set
In the lower frame the inside and the outside swap, and the framework calls your own code.
Whichever is on the outside decides the overall flow.
Calling a library takes one line instead of the dozens you would write yourself.
The only difference is who wrote that processing.
A library that has to be installed before you call it will stop with an error if you call it without installing it.
Guides also call these "packages" and "modules," and how that works is covered in the article "What Package Management Is."
A web app framework holds the flow from receiving a request to returning a response.
- Receives the request that arrived from the browser
- Looks at the URL and finds the processing that matches
- Assembles the response from the result it gets back and returns it
- Runs only when it is called
- Reads and writes the database and produces a result
- Returns the result it produced to the framework
The three on the outside are done by the framework, so you do not write them.
The reason to use a framework is to avoid writing the outside yourself.
Your own code runs only in the third step, and the framework handles what comes before and after.
Which URL runs which piece of code is likewise just written in a set place.
Calling, or being called
A library and a framework are both programs other people wrote, and the difference is which one is on the outside.
A library is called from inside your own code, and a framework calls your own code from outside and decides the overall flow.
What React, Next.js, Django, and Flutter are — sorting names into three kinds
You read the names that come up in a course by sorting each one into language, library, or framework.
Next.js is not a language; it is a framework written in JavaScript.
- Code for screens that run in the browser
- Server-side code that runs on node
- Splits page files by URL
- You can write server-side processing too
- Builds the screen with React
- Builds the parts of a screen
- You can call it without using Next.js
- Code for data analysis and automation
- Code for server-side processing
- Maps URLs to processing
- Reading and writing the database
- How login works
- Code for phone apps
- The screens and the behavior of a phone app
- From one set of code to both iPhone and Android
React is a library that builds the parts of a screen, and Next.js is a framework that uses that React and goes as far as server-side processing.
Flutter is a framework for building phone apps, and you write it in a language called Dart.
Being able to build an app that runs on several operating systems from one set of code is called cross-platform.
None of these names is a language; each is something you use together with your own code.
The same name, Next.js, appears on both the device side and the server side.
That is because what it covers changes with whether it only builds the screen or also holds the server-side processing.
Even from a phone app built with Flutter, what it connects to is the same public server.
Is the name a language, or something written in a language
Next.js, React, Django, and Flutter are not languages; each is written in some language.
Looking up which language you write it in tells you whether it is a language itself, and looking up the direction of the call tells you whether it is a library or a framework.
Which language to learn first — decide by whether what you want to build needs a screen in the browser
The language a browser can read is JavaScript, so the screen side (the frontend) is JavaScript.
The processing side (the backend) runs on the server, so you can write it in either.
If you need a screen in the browser, that part is settled as JavaScript.
If you do not need a screen, start with Python, which has many external libraries for data analysis and automation.
The frameworks and libraries in the bottom row come after you choose a language; they are not what you choose first.
Whichever you start with, the mechanisms you learn are the same.
The two paths meet at the same place in the end.
What you relearn is the way of writing and the names of the libraries used in that language.
Choose the one closer to what you want to build, and move ahead with it.
Once what you want to build is decided, the language is decided
You can settle the language by what you want to build, not by preference.
If you need a screen that runs in the browser, that part is JavaScript, and if you do not, you can start with Python, and for a second language what you relearn is only the way of writing and the names of the libraries.
Knowledge Check
Answer each question one by one.
Q2Which statement about the difference between a library and a framework is correct?
Q3Why is the screen-side code of a web app written in JavaScript?