Elucidating the concept of the package manager ๐ฆ
What is a Package Manager?
A package manager is a CLI(Command Line Interface) software or a tool that is built to automate the installation of your programming environment and create the programming environment for you on your computer without having to configure and set it up manually.
A package manager contains a repository of software with various dependencies. With a package manager, you can keep a track of the software version and update it without having to do it manually which makes it very tedious and arduous and there is a chance that there will be conflict in your software due to the various version of the same dependency present in your program which usually happens if you configure it up manually.
A package manager is an all-in-one solution you can set up, install, configure, run, compile, and even can delete unnecessary or outdated packages or dependencies by just passing a command and the package manager will do the work.
Let's understand in a more precise manner
What is a Package?
A package is a collection of different files that are interrelated to each other which together make the software run properly and are compressed together to reduce the size of a file and deliver it in form of a package.
What's in a Package?
A package contains the binaries of software, libraries(sharable objects or other people's works), scripts, modules, and snippets. The package also includes metadata of a package i.e. the data of a package, encompassing of package version, author, summary, license, and a readme file.
What is a Dependency?
Dependency is an extension of your application that brings functionality to your application without making or creating it from scratch. The idea of dependency is to increase the development process by using other people's work in your application. This eventually avoids lots of work like building every unit of application and later maintaining it, upgrading it also increases the size of an application. Dependency work as a function that needs to be set up and call it to work.
What if you don't use Package Manager?
From downloading to configuring your project dependency manually without any package manager need lots of work to do such as -
Finding all the packages required and keeping them in a folder in a very sane manner.
You'll don't know whether or not your dependencies have vulnerabilities and malware.
Have to start from scratch like writing a code and making it a module for your application.
Adding other or new dependencies will again need to do all the above steps and not keeping it properly will lead to face turmoils.
Deleting the dependency which is of no use will need lots of work from searching and deleting it as there will be tens, hundreds even thousands of dependencies or can be more and in such a gargantuan amount of files it'll get difficult to find & delete and more importantly it is so time-consuming.
Working on other people's work
In addition to simplifying the installation, setting up, and configuration of the programming environment, dependency allows us to do less work, such as not having to build everything from scratch. Open source allows you to utilize other people's work in your application, not by copying but by using them as dependencies, which act as importing libraries that can be called as functions or methods or can be any means of programming.
Example
Like if you want to create a DApps(Decentralised Application) you not gonna create your own blockchain in that, you'll write your own consensus algorithm, and protocols and then you'll use that blockchain in your DApps?. Of course not you'll use pre-written blockchains like Ethereum, Solana and etc to make your DApps.
Or another example can react js where developers use react hook form, formik and yup library to validate the form. So we don't write the logic and code for form validation.
Dependency Hell
While working on dependency has its own cons and pros. Dependency Hell is a despondent lugubrious phenomenon that occurs when a program is failed to run or failed to compile or work for many reasons chances are the software is misconfigured or not configured properly or missing file or the dependency is outdated from the current version of implementing library which leads in the creation of bug or abnormal behavior of an application. Sometimes it also happens, initially, it was working fine later it is not working it happens because the current dependency is no longer maintained or updated to the current version of the technology which also makes it vulnerable.
Therefore, while working with other's people you should check the package's popularity or always consider those which are popular.
Various Package Manager Of Various Programming Languages
Node.Js - NPM & Yarn.
Python - Pip (Package installer for Python), PyPi (Python Package Index).
Java - Maven, Ivy & Gradle.
GoLang - GoPackages
PHP - Packagist.
Dart/Flutter - Pub.
Swift - SwiftPM.
Conclusion
A package manager is a tool that simplifies and minimizes the trouble of programming setup but also you can use other people's works directly into your project by just adding it as a dependency. Also, see how various programming languages have Package managers to install the library directly into your project anytime just by giving a command.
Hope you have found this blog helpful ๐.
Thank You for reading this out โค๏ธ.
Subscribe to my newsletter
Read articles from Arif Shaikh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by