Screenshot of a Packagecloud test package in a repository

Divide and conquer – Dev, Test, and Production repositories

The term “dividing and conquering” refers to a general strategy for solving problems by breaking them down into smaller, more manageable chunks (i.e., “dividing” them). Each sub-problem can then be solved (“conquered”) individually before the subproblems are combined into a single coherent solution.

Many fields have used the notion of “divide and conquer,” from mathematics to marketing. The term is frequently used in computer science to describe an approach to designing algorithms that tackle large, complex problems or datasets. Some popular algorithms that have earned the label of “divide and conquer” are Quicksort and the Fast Fourier transform (FFT). In software development, “divide and conquer” usually refers to splitting a large project into subprojects or tasks that individual developers can tackle more easily.

Dev, test, and production repositories

As it pertains to software development, “divide and conquer” can also refer to the practice of splitting software repositories across multiple environments. These environments include:

  • Development (“dev”): The dev environment is where code is written and new software features and functionality are created.

  • Test: The test environment is where the new additions in the dev environment are thoroughly tested to ensure they work correctly and are free of bugs.

  • Production: The production environment is where new software is deployed once written and tested, making it available to users.

Each of these three environments is structured differently based on its different needs. For example, suppose we are developing a software application that uses a large database with users’ personal information (addresses, phone numbers, etc.). We would like to test this application to ensure that it works properly, but we might not want to use the production database for testing since it contains sensitive data that should not be visible to testers. Instead, the test environment might have its own database containing synthetic data: information that seems realistic but has been generated by a computer instead of being collected from the real world.

Software repositories, too, might be split between these three environments: dev, test, and production. This is because the separate environments depend on different libraries and frameworks, with certain packages used in one environment but not another.

To continue our example above, suppose that the application is being developed in the Python programming language. Then developers might use a Python package in the test environment specifically designed to generate synthetic data, such as Faker or SDV. However, this package does not need to be installed in the dev or production environments since it might cause confusion or bloat.

Using the “divide and conquer” strategy for software repositories makes it easier for developers to follow the principle of separation of concerns. Maintaining separate repositories streamlines and simplifies the software development process. 

Read more

You might also like other posts...