Table of contents
Overview
If you're familiar with writing code in any of the programming languages then you will come across the word library once in a while and they are super easy to use by just importing with one line of code. As we even deep dive there is something called a framework that kicks you with confusion. People always face some sort of uncertainty while experiencing it.
But I promise you don't worry if you have a good idea about both of these or not in this article I will help you. So without further due let's start.
No Doubt ❌
Some people use these two terms interchange but it's quite wrong because let's think there is a twin in the family even though they look the same should we call both of them by the same name? No right!
The same applies here to people who are the inventors of libraries & frameworks using 2 different names to distinguish means they are different for sure.
This confusion rises mainly because of some weird behaviour of a few libraries & frameworks where they violate some conventional rules & regulations.
But Library != Framework
What is library
The technical definition ->"It is a set of code that was previously written that can be called upon when building your code".
But it was as simple as it was you will get more clarity through visualization. Just stick with me throughout the blog.
Imagine there is a problem 😥
Jack has a piece of code that he has to write in different projects so often and he was just really frustrated by the writing code again and again and wanted a solution for this.
One of his friends suggested, "separately writing that repeated code in one single file (module) and importing it whenever you want will save time, it even makes the entire more readable".
Steps
create a separate file & dump the code
The above is the customized wish with the user's name from the hashnode website.
save the file/module with the respected extension(.py as it was Python)
import and use
Output
That's as simple as it was.
In this way, only all the inbuilt modules, packages and libraries work. As the structure grows the name also changes.
structure something look like this👇
Till now we explored the most basic and fundamental part of the library from now on words let's understand the main aim of our blog.
The above picture is pretty self-explanatory we just wrap up the similar kind of modules into a single name as a package and all the similar kinds of packages into a single library.
Numpy library
Let's understand the Numpy which is a commonly used Machine Learning library that supports large matrices and multi-dimensional data.
In simple words, we can say that it is a collection of similar packages/modules which performs complex algorithmic operations, and scientific computations, which are more specific to machine learning.
Like this, every library has a specific area to focus on and make a difference. A few most famous Python libraries are listed below.
Pandas - used in Data Science
Matplotlib - Responsible for plotting numerical data
Tensor flow - Used for high-level computation
This way these days every problem has a respected solution library to ease the time of the developer.
So far we learned what is a library let's understand why those many libraries and still every single day developers are designing their own libraries.
Why?
In his previous problem with Jack, he saved time and increased the readability of his code just by creating a single module.
Don't repeat yourself
This is one of the essential software principles & the main aim of using libraries is also this.
Reusability
One of the main benefits & reasons why libraries exist.
Time-saving
It's easy to import that library module rather than write something required from scratch.
Readability
It also makes our code looks clean.
Increases the Execution speed
Rather than writing the code directly just by instructing we are simply importing which in turn saves a lot of time.
In addition to this there an uncountable benefits why libraries and this is also the reason for a new library every single day.
How
This is the last section of the blog where I just give an intro regarding how to use the libraries.
It was so simple just using the general keyword "import". Even nowadays every library provides compatibility with another library & all we need to know is how to use it.
The library is not like magic that can generate suddenly instead it is a combination of small things (packages/modules) which are designed to fulfil certain tasks. The below diagram makes things even simple.
With this, I am wrapping up the library blog 😊. I just explain everything from scratch hope you understand the scene behind every library and learned something new.
Wind-up
If you like the blog and want content like this please follow the DevinTech community and be involved in our amazing community we are thrilled to be a part of your journey.
Discord -DevsInTech
Twitter - DevsInTech
If you want to make the connection with the writer of the content here you GO.
Twitter - Malavi Pande