Application Design - Why modularization is important

Modularization brings many benefits to the application and its programmers. In this section, you learn some of the main benefits that modularization provides.

Easier to change

You probably know by now that applications change. A business is a dynamic entity and so are the applications that support it. Modularization reduces the difficulty, cost, and time to do changes. With monolithic applications, even a simple change can become an arduous task requiring more effort and risk than expected.

How does modularization make changes easier to do? Imagine a huge monolithic application where all the functions are in the same module. The business needs a small change in the logic that is embedded in the code. You are not familiar with the whole application and time is against you. This scenario is not far from reality. When programmers face this situation, they do not have the time to understand all the mixed code and make the change using bad techniques such as “copy-paste”. The risk increases and the code becomes a bigger mess than before.

Now consider the other scenario. You must do the same small change, but in a well-designed modular application. If you generate a diagram of the application, you see how the application is structured. Now, you can understand which modules you must change. You did not have to go through the thousand of lines of code that were not related to your change. Modularization makes it easier to understand the whole application and focus only on the parts that you care about.

Now, consider an example where you must make a change in how you access a database. With a monolithic application, you might have to repeat the same change many times. What if you miss one of the data access locations? You just injected a bug. With a modular approach, you update the one module that deals with the database access and you are done.

Easier to understand

When you are trying to understand a monolithic program, you must see everything at once. The smallest component is the whole application. It is not easy to focus on the UI logic or the database access separately. Given the absence of layers and separation, you are forced to understand all aspects of the application even if you are only interested in a specific part.

In a modular application, you can start learning different parts of the code and ignoring the rest. For example, you can focus on understanding how a specific part of the business logic works, without having to go into the UI or data access.

This ease in understanding benefits you mainly in the following areas:

New talent training
Less time and costs to train new people in the application. It is easier to explain small pieces one at a time than a whole monolithic application.

Modernization projects
These projects require personnel who understand the original application before it is modernized. Code understanding is an arduous task that can be eased with a modular design.

Error location and fixing
Finding errors in monolithic applications can be difficult. A modular design can help you isolate the errors easier and faster.

Easier to test

From a testing perspective, it is easier to test modular applications. Similar to the understanding process, you can focus on a particular module and write unit tests for it. Unit tests are valuable resources to validate your code. They allow you to write tests for specific sections of code that can be hard to reach. Unit tests must be complemented with integration and function tests, but in monolithic applications you do not have this option.


In terms of test design, monolithic applications tend to have higher complexity, which makes them harder to test. This difficulty in testing can lead to important sections not being tested correctly and additional risk for bugs in the future.

Reusability

Large pieces of software are harder to reuse. Modularization aims to create the application as a composition of small pieces. With a good design, it is easier to reuse these pieces in different parts of the application.

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>