Questions tagged [anti-patterns]
An anti-pattern is a behavior or practice that is common despite being ineffective or counterproductive.
                240 questions
            
            
            
                -3
            
            votes
        
        
            
                1
            
            answer
        
        
            
                173
            
            views
        
        
            
            
        Is there a name for this anti-pattern? (reference to a class member passed to another class method) [closed]
                    Is there a name for this anti-pattern?
A reference to a class member is being passed to another class method, rather than having the class method set the class member directly.
public class ...
                
            
       
        
            
                10
            
            votes
        
        
            
                7
            
            answers
        
        
            
                3k
            
            views
        
        
            
            
            
        Is it an anti-pattern to support different parameter types when using a dynamically-typed language?
                    In the Python code base we inherited there are several functions that check parameter types and try to "accommodate" different types. Example:
def process_data(arg):
    json_ = {}
    if ...
                
            
       
        
            
                5
            
            votes
        
        
            
                1
            
            answer
        
        
            
                332
            
            views
        
        
            
            
        What do you call an enum that translates its own values?
                    I see this pattern a lot, especially with countries, or more generally regions. An enum is defined with additional fields and with methods that translate to and from these values.
Example:
import ...
                
            
       
        
            
                2
            
            votes
        
        
            
                1
            
            answer
        
        
            
                374
            
            views
        
        
            
            
            
        In poltergeist, whats wrong with "solely to trigger or initialize several other objects"? Isn't it is a good use of encapsulation and reuse?
                    After reading What differentiates function objects from poltergeists?, according to the definition of poltergeist, I still don't understand why would "poltergeist" be a bad pattern:
A ...
                
            
       
        
            
                2
            
            votes
        
        
            
                2
            
            answers
        
        
            
                350
            
            views
        
        
            
            
        Can chatty microservices be okay to use if there is a specific use case for them?
                    Introduction
Hi everyone,
in my company we are using microservice approach and of course are trying to do it as correct as possible. There is a new requirement coming up where I have laid out a ...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                93
            
            views
        
        
            
            
        Is using an UId to hash Mutable Entities an anti-pattern?
                    In the context of an object-oriented language, such as Dart, I have an abstract entity which has a single property called id (which is incrementally uniquely generated to make sure there are no-...
                
            
       
        
            
                0
            
            votes
        
        
            
                1
            
            answer
        
        
            
                194
            
            views
        
        
            
            
            
        Is it anti-pattern to obtaining public static data from a function?
                    In C programming, I have a set of information, and I have to ways of providing it to user:
construct a data structure and provide it as an object.
write a function to read them out and return them.
...
                
            
       
        
            
                1
            
            vote
        
        
            
                1
            
            answer
        
        
            
                302
            
            views
        
        
            
            
            
        Is module scoped initialisation considered a bad practice?
                    A module app.js includes another module service.js. The service.js module/file contains some functions but also does some module scoped initialisations(registry variable).
// service.js
const ...
                
            
       
        
            
                0
            
            votes
        
        
            
                0
            
            answers
        
        
            
                127
            
            views
        
        
            
            
        Is having many thin factories an antipattern?
                    I need to perform the following task: for a user [email protected], store a blob of data into their dedicated data store.
DataStoreService is what actually stores the blob of data in the user's store, ...
                
            
       
        
            
                -1
            
            votes
        
        
            
                7
            
            answers
        
        
            
                728
            
            views
        
        
            
            
            
        If you use Inversion of Control, what alternatives to obfuscated function calls exist?
                    Consider a class that follows the obfuscated function call anti-pattern. I've also seen these called "stupid classes". The definition of such a class is that it only has one public method ...
                
            
       
        
            
                -1
            
            votes
        
        
            
                3
            
            answers
        
        
            
                539
            
            views
        
        
            
            
            
        Are there existing term(s) for a 1-1 child-parent table anti-pattern?
                    NOTE: Please don't respond by telling me that I probably don't understand what I am looking at.  You can't possibly know that and it's wrong.  Just don't answer if that's all you have to say.
I'm ...
                
            
       
        
            
                1
            
            vote
        
        
            
                3
            
            answers
        
        
            
                2k
            
            views
        
        
            
            
        Are "Distributed Enums" an Anti-pattern in non-OOP like they seem to be considered in OOP?
                    I have recently read about the so-called "distributed enum anti-pattern." In particular, as it relates to using enums in conditional statements. (The idea is apparently that if you were to ...
                
            
       
        
            
                11
            
            votes
        
        
            
                5
            
            answers
        
        
            
                4k
            
            views
        
        
            
            
        How do you fix the wrong-case-sensitivity dictionary setting bug-pattern?
                    There is a coding anti-pattern I've noticed (while using .Net). You declare a data class, which is supposed to have a dictionary field (or get/set Property), and lets call it 'Properties', for the ...
                
            
       
        
            
                4
            
            votes
        
        
            
                1
            
            answer
        
        
            
                293
            
            views
        
        
            
            
        What is the anti-pattern for modules that group objects of the same type? [closed]
                    In MVC, I often seen all models in a models.py module, all views in a views.py module, and the controller - you guessed it - in a controller.py module. In other projects, I sometimes see all exception ...
                
            
       
        
            
                3
            
            votes
        
        
            
                2
            
            answers
        
        
            
                582
            
            views
        
        
            
        Creating an abstraction just for exception handling - a pattern or anti-pattern?
                    Assume that an external library or framework not under our control exposes a Controller API:
abstract class Controller {
    abstract fun call(): Result
}
Assume that we want to handle exceptions ...