Anti Patterns

  • 5,349 views
Uploaded on

 

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
5,349
On Slideshare
0
From Embeds
0
Number of Embeds
3

Actions

Shares
Downloads
0
Comments
0
Likes
10

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide







































Transcript

  • 1. A NTI -P ATTERNS
  • 2. Patterns are ever ywhere
  • 3. There are GOOD patterns
  • 4. There are BAD patterns
  • 5. Bad Patterns
  • 6. Bad patterns seriously harm you and others around you
  • 7. I see BAD PATTERNS! COLE
  • 8. Programming Methodological Organizational Design A NTI -P ATTERNS AntiPatterns AntiPatterns
  • 9. Programming AntiPatterns Methodological Organizational Design A NTI -P ATTERNS AntiPatterns AntiPatterns
  • 10. Programming Methodological AntiPatterns AntiPatterns Organizational Design A NTI -P ATTERNS AntiPatterns AntiPatterns
  • 11. Programming Methodological AntiPatterns AntiPatterns Organizational A NTI -P ATTERNS AntiPatterns Design AntiPatterns
  • 12. Programming Methodological AntiPatterns AntiPatterns A NTI -P ATTERNS Design Organizational AntiPatterns AntiPatterns
  • 13. Organizational Design AntiPatterns Methodological AntiPatterns Programming AntiPatterns AntiPatterns
  • 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; }
  • 21. ARROW ANTI-PATTERN if if if if do something endif endif endif endif
  • 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; } }
  • 24. Organizational Design AntiPatterns Methodological AntiPatterns Programming AntiPatterns AntiPatterns
  • 25. Organizational Design AntiPatterns Methodological AntiPatterns AntiPatterns
  • 26. COPY AND PASTE PROGRAMMING TESTER DRIVEN DEVELOPMENT SOMEONE ELSE’S EXAMPLE PROGRAMMING BY PERMUTATION
  • 27. Organizational Design AntiPatterns Methodological AntiPatterns AntiPatterns
  • 28. Organizational Design AntiPatterns AntiPatterns
  • 29. CIRCULAR DEPENDENCY GOD OBJECT SEQUENTIAL COUPLING BASE BEAN
  • 30. ABSTRACTION INVERSION INNER-PLATFORM EFFECT N-FRAME RACE HAZARD
  • 31. ARCHITECTURE BY IMPLICATION
  • 32. Organizational Design AntiPatterns AntiPatterns
  • 33. Organizational AntiPatterns
  • 34. DESIGN BY COMMITTEE
  • 35. ABSTRACTIONIST VS. IMPLEMENTATIONIST “Experts report that only 1 in 5 software developers is able to define good abstractions”
  • 36. The point isn't as much to say "don't do this" as it is to say "you probably don't even realize that you're doing this, but it doesn't work..”
  • 37. WE’VE SEEN 26 ANTI-PATTERNS 4 OF DIFFERENT TYPES
  • 38. PROJECT MANAGEMENT ANTI-PATTERNS ANALYSIS ANTI-PATTERNS CONFIGURATION MANAGEMENT ANTI-PATTERNS SOCIAL ANTI-PATTERNS
  • 39. http://sourcemaking.com/antipatterns/ http://www.c2.com/cgi/wiki?AntiPatterns http://en.wikipedia.org/wiki/Anti-pattern