Framework
What is Framework?
Framework means a frame. The folders of a program, the path of an address, and the order of a job are set beforehand. You write your own rule in the empty place in the middle. It calls you. A library is not like that. A library is one ready piece. You call it to fix a date, measure an image, or write a number. It does not give you the frame. Django is for Python and builds the back of a site. Laravel is for PHP. React looks at the face of a page. People call that a framework too, but it is a library: it splits the face into parts and does not force the folder and server rule. npm and pip are not frameworks. They are the tool that brings a package. What they bring can be a library or a framework.
What is Framework used for?
A framework is used so you do not start from an empty project. A library is so you do not write one job again.
- Taking the folder and address rule of a site ready-made
- Calling one function and doing only that job
- Splitting the face into small parts
- Not writing the same job from zero in every project
What can you do with Framework?
When you open a new project with a framework, the folders are already there. You write your own page or your own rule inside. If you do not write the function in the name it wants, the work does not go. With a library you decide. When you need it, you call one line and write the rest yourself. A framework takes you quickly, but it also chooses the path. For a small page a large framework can be heavy. On a large site, gathering everything by hand without a frame also falls apart. First know that the job is small, then take a frame.
Is Framework hard to learn?
Calling one line is easy. The difficulty is learning the frame's own rule. When a name is wrong by one letter, the page does not open, and the reason is not in your work but in what the frame expected. An old lesson may not work in a new version. Putting a framework on everything is also a mistake. For a page of one button a large frame only brings a mess. You should not gather libraries blindly either. A package you bring may ask for another package.
Advantages and limits
A framework shortens the path and puts everyone in the same structure. It also reduces freedom. A library keeps you free, but you think of the structure. For a small job a library, or neither, is enough. For a large site a frame reduces the falling apart. Thinking React is a framework and waiting for a server rule confuses a person.
Basic ideas
A frame calls you. You call a library. A package tool is neither.
- Django and Laravel are frameworks
- React is mainly a library
- Your code calls a library
- npm and pip only bring the package
A short example
The first line calls a library. The second is the name the frame expects. The frame looks for this name itself.
# kitabxana: sən çağırırsan
yaz(tarix)
# framework: o bu adı axtarır
def index():
return "salam"Common questions
- Are a framework and a library the same? No. You call a library. A framework calls you and sets the structure itself.
- Is React a framework? Many people say so. In fact it is a library that splits the face of a page into parts. It does not force the folder and server rule.
- Is npm a framework? No. npm brings a package. What it brings can be a library or a framework.