An anti-pattern is a behavior or practice that is common despite being ineffective or counterproductive.

learn more… | top users | synonyms

10
votes
7answers
2k views

Is this “anti-pattern” and should I stop using it or is this clever design?

I've basically stared to do the following when creating a REST service: HTML is requested service returns the desired web page but without the requested "resource", eg. data web page contains ...
46
votes
3answers
3k views

Is jQuery an example of “god object” antipattern?

I want to ask – I am slowly learning jQuery. What I see is an exact example of a God Object anti-pattern. Basically, everything goes to the $ function, whatever it is. Am I right and is jQuery ...
25
votes
13answers
3k views

Is there an antipattern to describe this method of coding? [closed]

I have a codebase where the programmer tended to wrap things up in areas that don't make sense. For example, given an Error log we have you can log via ErrorLog.Log(ex, "friendly message"); He ...
3
votes
2answers
1k views

Alternative to “inheritance versus composition?” [duplicate]

Possible Duplicate: Where does this concept of “favor composition over inheritance” come from? I have colleagues at work who claim that "Inheritance is an anti-pattern" and want to use ...
2
votes
1answer
195 views

Use of interfaces to ease rapid development/prototypes

Recently I've started to put almost all of my data structures into interfaces, and many of the classes that contain pieces of logic code as well, depending on how much work they are. I find that this ...
2
votes
3answers
396 views

Dynamic Forms: Pattern or AntiPattern?

I'm sure you've seen it. The database has a bunch of tables called Forms, Controls,FormsControls, ControlSets, Actions and the program that queries these tables has a dynamically generated user ...
63
votes
14answers
4k views

Name for this antipattern? Fields as local variables [closed]

In some code I'm reviewing, I'm seeing stuff that's the moral equivalent of the following: public class Foo { private Bar bar; public MethodA() { bar = new Bar(); ...
1
vote
2answers
287 views

What's the name of this pattern involving multiple inputs and what to do based on an input?

If I've got code similar to this (although perhaps not as constrained as warning levels): switch(item.StatusCode) { case StatusCode.SUCCESS: CallSuccess(item); break; case ...
3
votes
2answers
808 views

God Files versus Ravioli Code

Recently I asked a question about whether or not I should refactor my code. the responses I received were most definitely in the camp of going through with the refactoring due to the presence of a God ...
1
vote
1answer
800 views

Modular Database Structures

I have been examining the code base we use in work and I am worried about the size the packages have grown to. The actual code is modular, procedures have been broken down into small functional (and ...
20
votes
9answers
5k views

Alternatives to the singleton pattern

I have read different opinions about the singleton pattern. Some maintain that it should be avoided at all costs and others that it can be be useful in certain situations. One situation in which I ...
25
votes
7answers
5k views

Are utility classes with nothing but static members an anti-pattern in C++?

The question Where should I put functions that are not related to a class has sparked some debate over whether it makes sense in C++ to combine utility functions in a class or just have them exist as ...
8
votes
5answers
453 views

Reengineering the project from scratch [duplicate]

Possible Duplicate: When do you rebuild an application or keep on fixing the existing one I am currently working on a project that has been in development for the last few years used ...
10
votes
3answers
540 views

Is there a formal anti-pattern to describe the scenario?

Some code is written to generate Excel Spreadsheets (Office Interop). The code performs very poorly. A subsystem is designed to generate the files at night. Performance isn't a concern at night. ...
2
votes
2answers
513 views

Best practice for processing a list of items

I have a list of objects that need to be processed in some way. That way may not be correct for an item and thus raise an exception. In pseudo-code, it would look like: proccessItems (list) error = ...
31
votes
8answers
11k views

Is ORM an Anti-Pattern? [closed]

I had a very stimulating and interessting discussion with a colleague about ORM and its pros and cons. In my opinion, an ORM is useful only in the rarest cases. At least in my experience. But I don't ...
7
votes
4answers
387 views

Is there a name for “More events than expected” bug?

Is there a name for a family of bugs, that are caused by assumption, that user would generate only 1 event during the execution of the handler ? Simplest example is: animation triggered by click, ...
26
votes
11answers
12k views

Is using nested try-catch blocks an anti-pattern?

Is this an antipattern? It is an acceptable practice? try { //do something } catch (Exception e) { try { //do something in the same line, but being less ambitious ...
22
votes
10answers
3k views

How many are too many interfaces on a class?

I would probably consider it a code smell or even an anti-pattern to have a class that implements 23 interfaces. If it is indeed an anti-pattern, what would you call it? Or is it simply just not ...
0
votes
1answer
372 views

Finding a definition for this anti-pattern

Working on a large and multi-tiered software project, I just found a recurring anti-pattern to be occurring in the code. I coulnd't find its definition in Wikipedia or other sources after a quick ...
10
votes
9answers
1k views

Is this an anti-pattern?

I've seen this a lot in our legacy system at work - functions that go something like this: bool todo = false; if(cond1) { ... // lots of code here if(cond2) todo = true; ... // some other ...
7
votes
3answers
565 views

Reinventing the wheel because it doesn't exist

One of the languages I have to use at work is a very small, niche language called psl. One of the largest complaints I have about it as a language is that the libraries are very limited. While that's ...
10
votes
5answers
723 views

Violation of the DRY Principle

I am sure there's a name for this anti-pattern somewhere; however I am not familiar enough with the anti-pattern literature to know it. Consider the following scenario: or0 is a member function in a ...
4
votes
2answers
584 views

Is there a term for the error-handling anti-pattern of discarding all available info and just returning failure?

From time to time (unfortunately way too often) I have to fix code such as this: // C++ code bool anyOldFunction(Param p) { try { ... if(some_condition_here) { handleErrorX(); return ...
8
votes
3answers
482 views

Is there a name for the not given/null/empty-problem? [closed]

I work with code, where data is stored/exchanged in Hashtable/Dictionary/Associative-Array-like structures, like this { 'alpha': None, 'bravo': '', # 'charlie' is not given } there is not ...
4
votes
1answer
1k views

Is functional decomposition really an antipattern?

While I was reading The worst anti-patterns you have came across, I clicked on the link in this post to land on the web site about anti-patterns. And the ...
12
votes
12answers
1k views

The difference between best practices and common sense?

There is a lot of conversation regarding best practices1 in software development. I've seen at least three major points get a lot of discussion both on SE and elsewhere: What qualifies as a best ...
11
votes
4answers
5k views

EAV - is it really bad in all scenarios?

I'm thinking to use EAV for some of the stuff in one of the projects, but all questions about it in stackoverflow end up to answers calling EAV an anti pattern. But I'm wondering, if is it that wrong ...
5
votes
3answers
1k views

Design Anti-Patterns - C# - Do you call this a God object?

I am writing Portfolio module for my web site and it has 3 components. Gallery Category, Gallery, & Gallery Images. I am doing all the request handling, (creating, reading, updating, other), for ...
15
votes
5answers
900 views

How are mock objects commonly misused?

I read an article recently which said that mock objects are often misunderstood and misused. Are there any clear mocking anti-patterns which I can look out for?
25
votes
10answers
4k views

What naming anti-patterns exist? [closed]

There are some names, where if you find yourself reaching for those names, you know you've already messed something up. For example: XxxManager This is bad because a class should describe what the ...
2
votes
5answers
462 views

Anti patterns - Worth spending time or not

I have read this question and after a very long time it's clear I still don't understand anti-patterns. perhaps, it raised a new level of curosity to know why should I read Anti design pattern if they ...
12
votes
4answers
2k views

What is pattern based programming?

Can somebody explain the obsession with patterns and anti-patterns in programming? I ask because I have absolutely no idea what any of the patterns mean. When faced with a programming task I think ...
9
votes
1answer
496 views

When is a glue or management class doing too much?

I'm prone to building centralized classes that manage the other classes in my designs. It doesn't store everything itself, but most data requests would go to the "manager" first. While looking at an ...
4
votes
3answers
2k views

Constant Interface antipattern - PHP

I came across this Wikiepedia article which says that using interfaces for defining constants is not a good thing. Solution suggested there is to define constants in a final class and use static ...
20
votes
12answers
4k views

What design patterns are the worst or most narrowly defined? [closed]

For every programming project, Managers with past programming experience try to shine when they recommend some design patterns for your project. I like design patterns when they make sense or if you ...
31
votes
7answers
1k views

Code maintenance: keeping a bad pattern when extending new code for being consistent, or not?

I have to extend an existing module of a project. I don't like the way it has been done (lots of anti-pattern involved, like copy/pasted code). I don't want to perform a complete refactor for many ...
1
vote
5answers
287 views

Does this have a name? DRY overloading?

public int foo(int x) { int defaultValue = 0; return foo(x, defaultValue); } public int foo(int x, int y) { return x + y; }
251
votes
13answers
69k views

So Singletons are bad, then what?

There has been a lot of discussion lately about the problems with using (and overusing) Singletons. I've been one of those people earlier in my career too. I can see what the problem is now, and yet, ...
2
votes
6answers
861 views

Is “call and return” a pattern or an antipattern?

Imagine to have this code: class Foo: def __init__(self, active): self.active = active def doAction(self): if not self.active: return # do something f=Foo(false) f.doAction() ...
26
votes
8answers
1k views

What to do about “Failure Driven Development”?

At our shop, we strive to be agile. And I'd say we are making great strides. That said, a few of us have spotted a pattern we have started calling "Failure Driven Development". Failure Driven ...
40
votes
41answers
3k views

Which comments instantly ring alarm bells when a programmer says them? [closed]

Similar to my question about easily spotted warning signs in code I think sometimes comments programmers make can tell you quite a lot (of not good things) about them in a short period of time. The ...
98
votes
60answers
9k views

Which things instantly ring alarm bells when looking at code? [closed]

I attended a software craftsmanship event a couple of weeks ago and one of the comments made was "I'm sure we all recognize bad code when we see it" and everyone nodded sagely without further ...