Lecture 14: Antipattern Flashcards
Pattern Definition
A pattern has two parts: A Problem and a Solution.
- The problem class is elaborated in terms of a Context and a set of Forces
- The solution resolves these Forces with Benefits and Consequences
- To be considered as a pattern, the solution must be applicable to more than one specific problem
Solutions usually generate Follow-on Problems
- Follow-on problems can again be elaborated in terms of Context and Forces which may lead to the applicability of other patterns.
Patterns can become Antipatterns
Patterns can evolve into Antipatterns when change occurs
- Examples of changes:
- Change of requirements (functional, nonfunctional and pseudo requirements)
- Moving from a desktop-system to a smart phone
- Change of project parameters
- Increase of budget, extending the project finish time, people leaving the project
- Change of methodology
- Moving from functional decomposition to object-orientation
- Moving from a defined process to an agile process
- Change of requirements (functional, nonfunctional and pseudo requirements)
- In those cases the solution proposed by the pattern becomes a problematic solution.
Informal Antipattern Definitions
- Antipattern identify and categorize the common mistakes in software practice
- „An Antipattern is something that looks like a good idea, but which backfires badly when applied.“ (Jim Coplien)
- Synonyms for Antipattern
- Description of a bad practice
- Description of a bad idea or pitfall
- Description of a typical project management mistake
- Description of a typical design error
- Description of the bad use of an activity.
Antipattern
Definition
- An Antipattern consists of a problem and two solutions:
- The Problematic Solution describes a commonly occurring solution that generates overwhelming negative consequences
- The Refactored Solution describes how the problematic solution can be reengineered to avoid these negative consequences and lead to benefits again
- The Refactored Solution often leads to Follow-On Problems.
Applicability of Patterns and Antipatterns
- Patterns are good for problems which have no solution yet
- Innovation projects (Green field engineering projects)
- Patterns emphasize the use of proven good design principles
- information hiding, high coherence, low coupling, …
- “Thou shall not …”
- Antipatterns are good for emphasizing the recognition of mistakes in existing systems, software projects and software processes
Examples:- Bad design
- Too much time spent in analysis
- Constantly missing deadlines
- Typical excuse: “I knew about this design shortcut, but I had no choice because of {budget, deadline, missing resources,…}….
Changing bad solutions into better ones
- When a pattern becomes an antipattern, it is useful to have an approach to change the problematic (bad) solution into a better one
- Incremental Reengineering (Refactoring):
- The process of incrementally changing the bad structure of a system, project or organization into a better structure with the use of antipatterns
Why Antipatterns?
“The study of Antipatterns is an important research activity.
The presence of good patterns in a successful system is not enough. You also must show that those patterns are absent in unsuccessful systems.
Likewise, it is useful to show the presence of certain patterns in unsuccessful systems, and their absence in successful systems.”
Bruegge’s Corollary: It is also useful to show the presence of certain patterns in unsuccessful projects, and their absence in successful projects.
Typical Mistakes in Software Development
- What do you have to do to kill a project?
- Show the same demo twice to the same audience
- Focus on technologies, not on problems and scenarios
- Don’t maintain consistency between releases
- Isolate team efforts from other teams within an organization
- Rewrite existing clients, servers and applications
- Change the purpose of the system so that the models describe the wrong objects
Root Causes for Antipatterns
- Most common mistakes in software project management and development:
- Insufficient communication with the client
- Unfulfilled requirements
- Insufficient testing
- Cost overruns and schedule slips
- Reason for these mistakes: “The 7 deadly sins”
- Pride, greed, lust, envy, gluttony, wrath and sloth
- SALIGIA (Latin): superbia, avaritia, luxuria, invidia, gula, ira, acedia
- Now a popular analogy used to identify ineffective practices
- Haste, Pride, Apathy, Sloth, Ignorance, Avarice, Narrow-Mindedness.
- Pride, greed, lust, envy, gluttony, wrath and sloth
The Seven Deadly Sins in Software Practice
- Haste
- Solutions based on hasty decisions (“time is most important”) lead to compromises in software quality
- Pride (Hubris)
- Not invented here (NIH): Not willing to adopt anything from the outside
- Apathy
- Not caring about a problem, followed by unwillingness to attempt a solution
- Sloth
- Making poor decisions based on “easy” answers
- Ignorance
- Failure to seek understanding
- Avarice (Excessive Complexity)
- No use of abstractions, excessive modeling of details
- Narrow-Mindedness
- The refusal to use solutions that are widely known (“Why reuse? I only have to solve one problem”).
Anti Pattern Taxonomy
-
Development Antipatterns
- Focus on the viewpoint of the software developer
- Issues: Software refactoring, modification of source code to improve the software structure with respect to long-term maintainability
-
Architecture Antipatterns
- Focus on the viewpoint of the software architect
- Issues: Partitioning of subsystems and components, platform independent definition of interfaces, and connectivity of components
-
Management Antipatterns
- Focus on the viewpoint of the software project manager
- Issues: Software project organization, software project management, software process model, human communication, rationale management and resolution of issues.
Analysis Paralysis Antipattern
- General Form
- Goal to achieve perfection and completeness of the analysis phase
- Generation of very detailed models
- Assumption, that everything about a problem can be known a priori
- Detailed analysis can be successfully completed prior to coding
- Analysis model will not be extended nor revisited during development
- Symptoms And Consequences
- Cost of analysis exceeds expectation without a predictable end point
- Analysis documents no longer make sense to the domain experts
- Typical Causes
- Management assumes a waterfall progression of phases.
Plan-Driven Software Development
- Linear, phase oriented process
- Start –> Analyze – > Design –> Implement
- Main goal to minimize risk through careful upfront planning
- Equates phrases with activities
- No iterations, just one pass
- Start –> Analyze – > Design –> Implement
Best Known model of Plan-Driven Software Development: The Waterfall Model
- You start with activity 1 (requirements elicitation)
- When you are finished with requirements elicitation, you move to activity 2 (analysis)
- When you are finished with analysis, you proceed with design
- When you are finished with design, you proceed with implementation
- When you are finished with implementation, you proceed with testing
- When you are done with testing, your system is successfully built.
Viral Marketing: A new Pattern
- Bruce Kammerl and Microsoft used Viral Marketing
- Also called Content Marketing, Linkbait, Virus Marketing
- Mostly used in online marketing
- Goal: Maximum reach out for a new product