Antipatterns

Global Butterfly

As per IBMSP, Global Butterfly is a structural pattern for an object that has many global dependents. Changes to a global butterfly have a significant impact on the rest of the system. Global dependents include both direct (immediate) as well as indirect dependents. Applies to: Classes, Inner classes, Interfaces, Packages.…

0
Read More

What are Anti-patterns?

In software engineering, an anti-pattern is a pattern that seems to work but is counter-productive and far from optimal in practice. An anti-pattern can easily result in unmaintainable and error-prone solutions. Usually, anti-patterns emerge over a period of time when new functionality is added incrementally without a focus on continuous…

0
Read More

Feature Envy

In object-oriented design, generally, data should be packaged together with the processes that use that data. The Feature Envy anti-pattern is one where a method seems more interested in a class other than the one it actually is in. The most common focus of envy is the data. The fundamental…

0
Read More

Global Variable

The global variable anti-pattern is detected for global non-static and non-const variables which are exposed using “extern” keyword. This anti-pattern is only applicable to C/C++. Impact As Global variables can be read and modified from multiple parts of the program, it is difficult to restrict access making them prone to…

0
Read More

Data Exposure

Variables should not be exposed in the header files. Proper encapsulation of a module requires data hiding. All internal data should only be in private variables inside the .c/ .cpp source code files. Impact Data is visible to clients and they can alter its contents. This may lead to incorrect…

0
Read More

Format Exposure

Structs defined in header expose the internals. They should be moved to .c source files. Impact Clients can alter the internals of the data structure themselves leading to costly changes of all clients. Leads to very tight coupling. Characteristics Definition of struct is present in header files which are exposed…

0
Read More

Unused Method

This anti-pattern applies to functions/methods which are not called. Impact Unused methods unnecessarily bloat the code. Such methods adversely impact understandability and maintainability. Characteristics A function/ method is not called. Guidelines Consider removing or commenting the unused methods.

0
Read More

Decapsulation

This anti-pattern applies to functions/ methods which are not called from external modules/ components but are still exposed. Impact It unnecessarily exposes the interface to client components/ modules If the function/ method is intended to be used privately, calling such functions/ methods might have undesirable output. Characteristics The function/ method…

0
Read More

Fan Out

This anti-pattern applies to functions/methods which have high direct outgoing dependencies. Impact Fan outs are undesirable as changes to the signature of called functions/methods require a change in the caller fan out function/method. Fan outs indicate fragility. Characteristics A function/method directly calls many functions. Guidelines Try to remove direct dependencies…

0
Read More

Message Chain

Long sequence of outgoing method/function calls detected. Impact Message Chains are undesirable because they indicate fragility as intermediate dependencies are dependencies in disguise. Characteristics A function/method calls many functions which internally calls many other functions. Guidelines It can be beneficial to move a method to a class that contains most…

0
Read More