These days, companies both big and small use some kind of software framework to build their websites.
And if you want to get into coding, it's important to learn and understand some of the popular frameworks – regardless of the field you choose in the industry. But why?
Frameworks help you easily create new apps and ideas without having to write as much code yourself.
They also help eliminate a lot of headaches, so you can spend your time on what really counts.
Basically, they can be a real time saver.
In this article, we will explore:
- What is a framework?
- What is a software framework?
- Examples of software frameworks
- The difference between a library and a framework
So let's get started!
What is a Framework?
Imagine, if you will, a guy called John.
John needs to cut down a tree to light his fireplace up to make his family warm.
He goes into the woods, some time passes, and he finally chops down a tree.
Then, he needs to cut the tree into small pieces that can fit in his fireplace.
Finally, John has successfully cut all the wood needed in the right size to warm his family.
But, what if John had a chainsaw instead?
If he had a chainsaw, the work would be done much more quickly and he would lose less time and energy cutting the wood for the fireplace.
Especially if he needed to chop down many trees.
But John likes to use his axe because he says it allows him more control over every bit of wood he chops off.
And with an axe he is able to cut small tree branches and it is better to chop up the wood.
So, with an axe, he can take care of minor things more easily. We don't need a tool like a chainsaw to do it. But when we're cutting down many big trees, it is a good idea to use a chainsaw, because it saves time and effort.
The same applies to coding. When we're programming and we just need to do simple stuff, it is better to just write our own code from scratch and/or get some libraries to help us with that.
But when we need to tackle many big projects, it is better to use a framework, because the project is big and frameworks can save us time.
According to the analogy:
- Cutting the tree with an axe = programming from scratch
- Cutting trees with a chainsaw = Programming with a framework
A chainsaw allows people to more easily cut trees.
A framework allows people to more easily develop programs.
What is a Software Framework?
Just as the chainsaw is a tool to work faster and more efficiently, a software framework is also a “tool” that helps a programmer work faster and achieve more in less time.
Just as there are many types of chainsaws, there are also many types of software frameworks.
Examples of software frameworks
Now I'll share how and where you can use different frameworks in different areas of programming.
Web development frameworks
Web development frameworks make it easier to interact with the website database.
Frameworks automate functions and boring processes used to record and retrieve user-input data.
These frameworks can also make it easier to arrange and organize elements when you're designing the front-end of the site.
Vue is an example of a front-end web development framework.
Front-end means it is only the part the user sees – in other words, the presentation layer or OSI layer 6.
As a web development framework, Vue:
The following organizations use Vue:
Normally, developers choose which framework they are going to use based on their team experience, the type of project their working on, or the complexity of their projects.
It really depends on your circumstances.
You can check out Vue's official site for more information.
Machine learning frameworks
Machine learning frameworks help programmers by making it easy to implement complex ML algorithms in their programs.
You don't have to create these complex algorithms by yourself. Someone has already done it for you.
This makes your life easier as you just have to get your dataset, optimize the data to be used in the machine learning model, save the model, and run your analysis.
- Open Neural Network Exchange support
- Hybrid Front-End
- Dynamic Computational Graph Support
- Data Parallelism
PyTorch has been used in some cool projects, like:
- Amazon has reduce inference costs by 71% and drive scale out using PyTorch, TorchServe, and AWS Inferentia.
- Stanford PyTorch’s flexibility to efficiently research new algorithmic approaches.
- Used in tesla cars to detect traffic lights, crosswalks, roadsigns...
Many GitHub projects use this framework, from computer vision to natural language processing applications.
I recommending PyTorch because it is easy to learn compared to other machine learning frameworks, it's written in Python, it has a big community around it, and so much more!
Just keep in mind that TensorFlow and sci-kit-learn are both libraries, not frameworks. We'll discuss the difference more below.
In general, companies use TensorFlow, while machine learning researchers use PyTorch.
This is mainly for three reasons:
- Python's API hasn't changed much over the years compared to TensorFlow, so the code from some months back is almost the same in PyTorch. In Tensofrlow, it may be different or even not run at all.
- The Tensorflow API has changed, but the documentation has not changed much, making it difficult for researchers to find online help.
- Most research done by big companies is in PyTorch.
So, if you are reading research in advanced stages, most of the code you see will be in PyTorch.
There are many more reasons for this, but these are just some examples.
Here is the website for PyTorch:
Mobile development frameworks
Mobile development frameworks help programmers a lot by automating many tasks that would otherwise make maintaining projects a hassle.
For example, instead of using 50 lines of code to create a button or to better navigate the space in a screen, frameworks let you drop some button code in, ready to apply to your app.
With a framework a lot of that work is already done for you.
This framework comes from the web version of React.
This mobile framework was one of the most popular in the world from 2019 to 2021.
Its main features are:
- Seamless Cross-Platform Development
- Fast Refresh
- Code Reusability
- Improved UI/UX
- Hot Reload
Just as with PyTorch, React Native has also been used to develop many projects:
I recommending React Native because it's based on React.
With all of these frameworks, the best choice comes down to what knowledge you already have and the constraints placed on you by your company or team.
For example, if you already know how to use Python and want to develop a small personal project, maybe the best choice is Kivy.
If you join a company and work on the front end with React, is best choice is probably React Native.
Since there are many choices, it really come down to your requirements and projects.
Here is the website for React Native:
These are just three types of frameworks you can look into. Also, keep in mind that there are many frameworks. I just showed you some of them here.
What's the Difference Between a Library and a Framework?
If you're new to coding, you might not know the differences between a library and a framework. But they're not the same thing.
A library is code from a collection of files that someone wrote pre-made for your project.
Like using a shovel. You can use it to dig whatever you want.
A framework is like using an excavator. While you can dig more dirt with an excavator, you only use it for specific (big) construction projects.
With a library, you are in control of the code. You use the library to add new features to help your project
With a framework, you are limited by it. You can only work with the "space" the framework gives you. There are also technical reasons for this, which you can read more about in this article.
Should I use a framework or library for my project?
It depends on the complexity of your project, who or what teams will maintain it, and so on.
By analogy, imagine that one of John's hobbies is wood carving.
To do that, he needs to use a simple set of tools to cut wood. He cannot use his axe.
While it can help in some phase of his project, it can also, by accident, destroy the project. It can't work in fine enough detail.
So in this case, the best thing to do is to do everything from scratch. The same applies to programming.
If you want to do a simple project, but need to use function you don't know how to create, you should use libraries.
If you want to work on a complex project where there are a lot of things you don't currently understand, a framework might help you get going.
Also keep in mind that if you work at a big company you might write the code without using any frameworks at all. This way, there is more space for programmers and engineers to develop projects without any limitations.
In many cases, simple programming projects are better the fewer library dependencies they have.
And in general, I believe that the more you code your projects yourself, the better the project is. At least in most cases. :)
Great! In this article you have learned:
- What a software framework is
- 3 different software frameworks and how to learn more about them
- The differences between a software framework and software library