The Blob - A Dev Anti Pattern

Sangeevan Siventhirarajah
2 min readFeb 23, 2024

--

The Blob represents a situation where a single class takes on a central role in processing, while other classes primarily serve as containers for data. This design flaw can be recognized through a class diagram that features a complex controller class at the centre, surrounded by multiple simple data classes. The main drawback of this pattern is the excessive concentration of responsibilities within a single class.

In general, the Blob demonstrates a procedural design approach but can also be implemented in object-oriented languages. In procedural design, the process and data are kept separate, whereas in object-oriented design, the process and data models are integrated along with their respective components.

The Blob class contains most of the processing logic, while the other objects mainly hold the data. Architectures that exhibit the Blob pattern often maintain a segregation of process and data, leaning more towards procedural-style architectures rather than object-oriented architectures.

The blob can arise from inappropriate allocation of requirements. It commonly occurs when a software module is assigned responsibilities that overlap with a majority of other parts of the system, particularly for system control or management.

Moreover, the Blob can arise during iterative development, where initial proof-of- concept code gradually evolves into a prototype and eventually a production system. This phenomenon is frequently observed in programming languages that are primarily GUI-centric, such as Visual Basic. In such cases, the functionality and purpose of a simple form expand incrementally throughout development or prototyping.

As the system evolves, the distribution of responsibilities is not appropriately reassigned, resulting in one module becoming dominant. The Blob is often accompanied by redundant code, making it challenging to distinguish between the useful functionality of the Blob class and the code that is no longer necessary.

To solve this problem, a key solution is to extract behaviour from the Blob and distribute it to the encapsulated data objects in a manner that enhances their capabilities and reduces the complexity of the Blob. By redistributing the responsibilities and avoiding the concentration of logic, the system can be refactored to improve its overall design and maintainability.

--

--

No responses yet