The document discusses various anti-patterns related to programming, methodologies, organizational design, and projects. It identifies 26 different anti-patterns across 4 categories: project management, analysis, configuration management, and social. Anti-patterns are patterns that may form solutions but are counterproductive or harmful. The document encourages recognizing when these patterns occur so they can be avoided.
14. BLIND FAITH
Introducing
unnecessary
complexity into a
solution
Lack of checking of
(a) the correctness of
a bug fix or (b) the
result of a subroutine
ACCIDENTAL
COMPLEXITY
15. CARGO CULT
PROGRAMMING
Incomprehensible
structure ,
especially because
of misuse of code
structures
Using patterns and
methods without
understanding why
SPAGHETTI
CODE
16. SOFT CODE
Embedding
assumptions about
the environment of
a system in its Storing business
logic in configuration
files rather than
source code
HARD CODE
17. LAVA FLOW
Retaining a part of
Retaining undesirable a system that no
(redundant or low- longer has any use
quality) code because
removing it is too
expensive or has
unpredictable
BOAT
ANCHOR
18. MAGIC
STRINGS
Including
unexplained
numbers in
algorithms
Including literal
strings in code, for
comparisons, as
event types etc.
MAGIC
NUMBERS
19. SINGLE FUNCTION
EXIT POINT
public Foo merge (Foo a, Foo b) {
Foo result;
if (a != null) {
if (b != null) {
// complicated merge code goes here.
} else {
result = a;
}
} else {
result = b;
}
return result;
}
20. GUARD CLAUSE
public Foo merge (Foo a, Foo b) {
Foo result;
if (a != null) {
if (b != null) {
// complicated merge code goes here. public Foo merge (Foo a, Foo b) {
} else { if (a == null) return b;
result = a; if (b == null) return a;
} // complicated merge code goes here.
} else { }
result = b;
}
return result;
}
22. int foo(void)
{
char *p = NULL;
char *q = NULL;
int foo(void)
int ret = SUCCESS;
{
char *p = malloc(SIZEOF_P);
p = malloc(SIZEOF_P);
char *q = malloc(SIZEOF_Q);
if(p)
int ret = p && q ? SUCCESS : FAIL;
{
q = malloc(SIZEOF_Q);
if (ret == SUCCESS)
if(q)
{
{
/* do something */
/* do something */
}
free(q);
free(p);
}
free(q);
else
ret = FAIL;
return ret;
}
free(p);
}
else
ret = FAIL;
return ret;
}
23. LOOP-SWITCH
SEQUENCE
// parse a key, a value, then three parameters
String key = null;
String value = null;
List<String> params = new LinkedList<String>(); // parse a key and value
String key = stream.parse();
for (int i = 0; i < 5; i++) { String value = stream.parse();
switch (i) {
case 0: // parse 3 parameters
key = stream.parse(); List<String> params =
break; new LinkedList<String>();
case 1:
value = stream.parse(); for (int i = 0; i < 3; i++) {
break; params.add(stream.parse());
default: }
params.add(stream.parse());
break;
}
}