Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 1

Page |1

Why is it a bad idea to have such a class? Mention at least two quality attributes expected to decrease because
of having large classes, and explain why.

A "Large Class," which used to be colloquially referred to as a "God class," is a class in object-oriented programming
that attempts to perform too many responsibilities or tasks. It is a common anti-pattern in software development
because it can lead to various issues and hinder software quality. Here are two quality attributes that are expected to
decrease as a result of having large classes and explanations for why they are affected:

1) Maintainability: Large classes make the codebase more challenging to maintain. When a class is responsible
for numerous tasks, it becomes complex and difficult to understand. This complexity can lead to several
issues:
a) Reduced Readability: Large classes have long methods and many instance variables. This makes it
hard for developers to quickly grasp what the class does and how it does it. As a result, maintaining
and updating the code becomes error-prone, as developers may inadvertently introduce bugs while
trying to understand and modify the class.
b) Decreased Reusability: Large classes often have tightly coupled functionality, so extracting and
reusing parts of the class in other system parts becomes challenging. This decreases code reusability
and modularity, making it more difficult to adapt the code for future changes or use it in other
projects.
c) Testing Challenges: Testing large classes comprehensively can be time-consuming and complex. It
may require writing extensive test cases to cover all the different behaviors and interactions within the
class. This increases the maintenance overhead of test suites and makes it more likely that some edge
cases will be overlooked.
2) Scalability and Performance: Large classes can negatively impact the scalability and performance of a
software system. This happens because:
a) Increased Coupling: Large classes tend to have many dependencies within the class itself, leading to
high coupling. When a change is made to such a class, it can have ripple effects throughout the
system, causing performance bottlenecks and making it challenging to scale the application. High
coupling can also make it difficult to parallelize or optimize the code.
b) Inefficient Resource Utilization: Large classes may perform multiple tasks sequentially within a single
method, resulting in inefficient resource utilization. For example, a large class that handles data
processing and access might cause unnecessary queries or inadequate data manipulation, impacting
the overall system's performance.
c) Limited Parallelization: In modern computing environments, parallelization is essential for achieving
optimal performance. Large classes with monolithic methods are less amenable to parallelization
because they encapsulate multiple responsibilities within a single unit of execution. This can hinder
the ability to use multicore processors and distributed computing resources.
Thus, large classes are a common problem in software development because they undermine key quality attributes
such as maintainability and scalability/performance. They make code harder to understand, maintain, and reuse,
introducing performance bottlenecks and limiting the ability to scale the system effectively. To improve software
quality, it's essential to refactor large classes into smaller, more focused units that adhere to single responsibility and
separation of concerns.

REFERENCES:
[1] Vaucher, S., Khomh, F., Moha, N., & Guéhéneuc, Y. G. (2009, October). Tracking design smells: Lessons from
a study of god classes. In 2009 16th Working Conference on reverse engineering (pp. 145-154). IEEE.
[2] Kim, D.K., 2017. Finding bad code smells with neural network models. International Journal of Electrical and
Computer Engineering, 7(6), p.3613.

You might also like