12 Factors: Revisiting the 2nd Factor - Dependencies
Luiz Ferreira
Posted on March 10, 2023
Welcome to my blog
!
I'm starting this project as a way to revisit some important concepts, study a bit, and share some of the knowledge I've accumulated on my journey so far!
Don't forget to visit my website and follow the new posts there. Contact me through social networks so we can talk more about these cool topics.
In this first phase of study, I'd like to revisit the concepts used in the study of the 12 factors for modern application development, inspired by the books of the legendary Martin Fowler.
In our last article, we talked about the first factor of the 12 factors of software development, Codebase. Today, we're going to talk about the second factor:
Dependency Management
Dependency Management is an essential practice to ensure that your code is compatible and scalable. By using package management systems and the practice of isolating dependencies from the environment, you ensure that your application runs safely and reliably in different environments. This allows you to focus on creating new features without worrying about compatibility issues between application dependencies.
Use Package Management Systems
An important practice for managing dependencies is to use package management systems, such as NPM for Node.js or Maven for Java. These systems allow dependencies to be installed automatically, through a configuration file that specifies the application dependencies and their versions.
In the case of Python, a widely used package management system is Pip. Pip is an easy-to-use tool that allows for quick and practical installation of packages and dependencies. In addition, Pip offers various features, such as the creation of virtual environments and the installation of packages from files.
In the case of Go, the default package management system is Go Modules. It was introduced in version 1.11 of Go and is responsible for managing source code packages and dependencies. Go Modules offers various features, such as version control and compatibility checking of dependencies.
In Rust, the default package management system is Cargo. Cargo allows for automated package installation and dependency management. In addition, Cargo offers features such as project creation, code compilation, and management of installed packages.
Isolating Dependencies from the Environment
Another important practice is the isolation of dependencies, which involves installing application dependencies in an environment that is isolated from the local machine. This is done using tools like Python's Virtualenv, Ruby's RVM, or asdf, which is a tool for managing language and package versions.
asdf allows you to install and manage multiple language versions, such as Python, Ruby, Node.js, and Erlang, as well as packages related to these languages. With this, it is possible to have different versions of the same language or package installed in the same environment without interfering with each other.
In addition, asdf also allows for the creation of specific virtual environments for different infrastructure tools such as Terraform, Terragrunt, Helm, among others. These virtual environments allow you to isolate specific dependencies for each tool and configure them separately, avoiding conflicts and ensuring the stability of your environment.
For example, when using Terraform, you can create an asdf virtual environment specifically for Terraform and install only the necessary dependencies for your project's execution. This ensures that you do not have conflicts between the dependencies of Terraform and the dependencies of other projects running in the same environment.
In addition, asdf is an easy-to-install and use tool, with support for various operating systems and an active community of developers, ensuring a large number of plugins available for different languages and tools.
Stay Tuned
Did you like our article? We hope so! Stay tuned for upcoming posts, where we'll talk about the other factors of the 12 factors of software development. And don't forget to follow us on social media to stay up-to-date with more programming tips and information.
Until next time!
Posted on March 10, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.