Package Manager 101

Package Manager 101

·

6 min read

Introduction

Discovering Package Manager

In the world of coding, there's a special tool that makes life easier for developers. It's called a package manager, and it's like a helpful friend for building software. In this blog, we'll dive into what package managers are and how they make coding simpler. No jargon, just plain language to help you understand the magic behind software development with package managers. So, let's get started on this journey to explore the world of package managers!

What is a Package Manager?

Okay, so what's a package manager? Imagine you're baking cookies. You need different ingredients like flour, sugar, and chocolate chips. Instead of going to the store for each ingredient separately, you'd love it if there was a magical grocery store that put all these ingredients together in a bag just for you, right? Well, a package manager does something similar for software.

In simple terms, a package manager is like that magical grocery store for software developers.

Here's a real-world example: Let's say you're building a website, and you need special code (we call it libraries or packages) to make your website do cool things. Without a package manager, you'd have to find each piece of code one by one from all over the internet, download it, and make sure it works with your project. It's like hunting for each cookie ingredient separately.

Now, with a package manager, you can just tell it what you need, and it goes and gets those pieces of code for you. It's like saying, "I need flour, sugar, and chocolate chips for my cookies," and the magical grocery store gives you a bag with everything inside.

So, in the world of coding, a package manager is your helper who brings all the ingredients (code) you need for your project, making your life as a developer way easier.


Types of Package Manager

When it comes to package managers, there are a few different flavours, like different flavours of ice cream. They all serve the same purpose – to help you manage software, but they work in slightly different ways. Let's break them down

1. System Package Managers (For Your Computer's Operating System)

Think of your computer's operating system as the boss of your computer. It tells everything what to do. And just like bosses, different operating systems prefer different ways of doing things. Here are a couple of examples:

Linux: If you're using Linux, you've probably heard of package managers like APT (Advanced Package Tool). It's like a super-smart librarian who knows where all the books (software) are in the library (your computer). You ask for a book (software), and APT finds it and sets it up for you.

Windows: If you're on Windows, you have a couple of options. One is Chocolatey, which is like having a personal shopper for software. You tell it what you want, and it goes out and gets it for you. Another new one is Winget, which is like having a menu in a restaurant. You pick what you want, and it gets served to you.

These are just a few examples, but the idea is the same – they help you find, install, and manage software on your computer. It's like having a handy assistant to take care of all your software needs.

2. Language-Specific Package Managers

Now, let's talk about a different kind of package manager, which is more like a language translator. You see, different programming languages have their own package managers. For example:

Node.js (JavaScript): If you're into web development using Node.js, you'll probably use npm (Node Package Manager). It's like a toolbox full of JavaScript tools and libraries. You ask for a tool, and npm hands it to you.

Python: Python developers often use pip, which is like a delivery service for Python packages. You order a package, and pip delivers it to your Python project.

These language-specific package managers are like experts in their field. They make sure you get the right tools and libraries for the programming language you're using.

So, whether you're working with your computer's operating system or a specific programming language, there's a package manager ready to assist you.


Advantages of using a Package Manager

Package managers, like those we discussed earlier, may sound like fancy software tools, but they offer some very practical advantages for anyone working with computers and code. Let's take a closer look at why they're so handy

  • They Help You Find and Install Software Easily

    Package managers are akin to personal shopping assistants. Instead of spending hours browsing through numerous stores to find a specific item, they swiftly locate and install the desired software on your computer, sparing you the effort of scouring the internet for it.

  • They Keep Your Software Up to Date

    Software is constantly evolving, just like your favourite apps on your phone get updates. Package managers make sure you're using the latest and safest versions of software. They can even update all the software on your computer with just a few clicks, which saves you from manually downloading and installing updates.

  • They Handle Dependencies for You

    Think of software like a recipe that needs specific ingredients. Some ingredients (called dependencies) are needed for multiple recipes. Package managers keep track of these ingredients and make sure they're available when you need them. This means less headache for you when you're building software because you don't have to worry about gathering all the right ingredients; the package manager does it for you.

  • They Simplify Uninstalling Software

    Have you ever tried to remove software from your computer, only to find that it left behind a mess of files and settings? Package managers clean up after themselves. When you want to remove software, they do it cleanly, leaving your computer tidy and clutter-free.

  • They Promote Collaboration

    Imagine you're working on a group project with friends. Package managers help everyone stay on the same page. You can share a list of software packages and their versions (like sharing a shopping list) with your team. When they use the same package manager, they'll have the exact same setup as you, making collaboration smoother.


How Package Manager is being used

  • User/Developer: This is you, the person using the package manager.

  • Package Manager: This box represents the package manager like npm or Winget.

  • Package Registry: Think of this as a big database or storehouse where all the packages (ingredients or apps) are stored.

  • Fetch and Install Packages: The package manager communicates with the package registry to fetch and install the packages you need for your project or computer.


Common Package Manager Commands

In this section, I will cover only Windows but I also provide the link to the command for all the above package managers that I mention above like apt, choco, npm, pip

so I use Winget as a package Manager for my daily tasks of installing, deleting, and updating the packages which I installed on my PC.

That's all for today's Blog, I hope that you like that blog if you have any suggestion do let me know I have socials attached to my profile

Thank you for Reading 🫡🫡

Â