38
AntiPatterns By Thomas Hutton

By Thomas Hutton. Definition AntiPattern Template Benefits of Identifying AntiPatterns Benefits of Understanding AntiPatterns

Embed Size (px)

Citation preview

Page 1: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

AntiPatternsBy Thomas Hutton

Page 2: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Definition AntiPattern Template Benefits of Identifying AntiPatterns Benefits of Understanding AntiPatterns

Overview

Page 3: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

“Software engineering consists of all the technical activities that are performed to build the project deliverable (the “just build it” activities). Software engineering deals with construction the components, integrating them, verifying them, validating them, and finally combining all of the components into a product and convincing the customer to accept delivery of it.” (Chemuturi, 19)

Definition

Page 4: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

“Mechanism to describe a commonly occurring solution to a software development need that generates significantly negative consequences.” (Brown, XXVII)

“An AntiPattern is a repeated application of code or design that leads to a bad outcome.” (Dudney, XIX)

Definition

Page 5: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

A process that works for one team or project may not work for another.◦ Not necessarily an AntiPattern

Not limited to any single area.◦ Project Management◦ Analysis/Design◦ Code

A Matter of Perspective

Page 6: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Software Engineering processes are based off best practices compiled from experiences.

AntiPatterns are a key building blocks for these processes – they represent failed processes.

Learning from mistakes

Yin Yang

Page 7: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

An programming assignment is due in two days. Due to your class load, you do not have the considerable amount of time to correctly produce a proper solution. As a result, you think to yourself “I just need to hand something in. At least I will get some credit.”

Example

Page 8: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Also known as: The Quick’n’Dirty

Understanding of the project is that the code must be produced quickly and will not be maintained later.

One-Shot Deal

Page 9: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Why would one produce such a program?

◦ Too little time.◦ General laziness.◦ Technical Inability◦ Changes to Requirements

Root Cause

Page 10: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Prototypes◦ Built with the idea that the code may be

scrapped, but will provide data on the direction of the project.

◦ “This implies, practically speaking, that programmers must learn to disregard their notions of “professional pride” and produce what they typically thought of as amateurish code, quick-and-dirty hacks and kludges that absolutely will not stand the test of time.” (Borenstein, 118)

Common Forms

Page 11: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

The Tool◦ Usually single developers given a mission to build

a program to quickly complete a simple task.

The Retrofit◦ Demand for a new architecture while functionality

is untouched.

Common Forms

Page 12: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Leads to programs that cannot be maintained

Generally programs are of poor quality Programs are unlikely produce proper

output in test scenario Lack of documentation Inefficient or dead code

Symptoms

Page 13: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

AntiPattern Name Also Known As Most Applicable Scale Refactored Solution Name Refactored Solution Type Root Causes Unbalanced Forces Anecdotal Evidence

AntiPattern Template

Page 14: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Background General Form Symptoms and Consequences Typical Causes Known Exceptions Variations

Detailed Template

Page 15: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Most Frequent Scale◦ Global: Design issues across all systems.◦ Enterprise: Coordination/communication across

an organization◦ System: Coordination/communication across

applications.◦ Application: Individual application.◦ Framework: Macro-level.◦ Micro-Architecture: Repeated use of solutions.◦ Object: Especially reusable objects.

Template - Details

Page 16: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Refactored Solution Type◦ Software◦ Technology◦ Process◦ Role

Unbalanced Forces◦ Management of “primal forces” – organizational

pressures that occur

Template - Details

Page 17: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Name: One-Shot Deal AKA: Quick’n’Dirty Scale: Enterprise Solution Name: Aim Before You Shoot Solution Type: Process Root Causes: Sloth, Haste, or Ignorance Unbalanced Forces: Management of IT

Resources

Apply the Template

Page 18: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

From our example: “I just need to hand something in. At least I will get some credit.”

“We don’t need documentation.” “This isn’t a major release, we just need

something now.” “If we don’t get this done now, we won’t

ever get it done.”

Anecdotal Evidence

Page 19: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Aim Before You Shoot◦ Think about the implications of creating software

without documentation.◦ Ask if there is any chance this program will need

to be maintained.◦ Is anyone paying for this software?◦ How long is the software expected to be used?◦ How difficult is the software to create?

Solution

Page 20: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Prototypes◦ Managed expectations can lead to a prototypes

achieving their goal: to provide an example. Consider developing prototypes in a different

language. Automated Source Code Control Formal Defect Tracking Standards for Documentation/Testing

Exceptions

Page 21: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

As a project manager, you are worried about the integrity and quality of code your developers are producing. So far, the code seems to fit into the design scheme and passes test cases, but you question the maintainability of the code. Therefore, you tell all of your developers to implement a new standard.

Another Example

Page 22: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Also Known As: The Necessary Evil Generally a problem with process Can be caused by pride or ignorance Often managers fail to understand the

complexity of new standards, reason to have standards at all

The Standards

Page 23: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Developers outright refuse to implement the new standards

Schedule is not changed to reflect the time and effort necessary to implement a standard

“Organizations pay lip service to quality standards or guidelines or… they implement the standards/guidelines poorly.” (Chemuturi, 213)

Problems

Page 24: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

From our example: “I know how we can fix this problem! We’ll implement a standard.”

“Standards are worthless.”

“Just stick to the standards!”

Anecdotal Evidence

Page 25: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Additional work created by implementing a new and/or complex standard

Organization does not value standards and/or is not committed to implementing them

Selected standard is overly complex

Root Causes

Page 26: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Name: The Standards AKA: The Necessary Evil Scale: System Solution Name: Back to Zero Solution Type: Process Root Causes: Ignorance, Sloth, Apathy,

Narrow-Mindedness, or Pride Unbalanced Forces: Management of

Complexity

Apply the Template

Page 27: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Return to Zero◦ Look at the what is necessary to uphold your

expectations for quality

◦ Match the expectation to the standard

◦ Look for standards that support maintenance but are flexible

Refactored Solution

Page 28: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Projects that do no need standards

◦ Very small, quick, and have little complexity

◦ Be wary of falling into the One-Shot Deal AntiPattern

Exceptions

Page 29: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

AntiPatterns can occur in sequence, meaning that one problem often leads to another.

Solving the first quickly may solve the subsequent AntiPatterns.

Generally due to lack of control

Interacting AntiPatterns

Page 30: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Stand alone

No hidden causes

Related to the people, technology and/or process

Isolated AntiPatterns

Page 31: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

WebSphere MQ Monitoring

Personal Experience

Page 32: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Avoid or reduce the effects of the AntiPattern!

The sooner you identify a potential problem, the more likely you are to find a solution.

Remember failures – those experiences will help you succeed in the future.

Benefits to Identifying AntiPatterns

Page 33: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Chronicle problems that occur and the solution attempted.◦ Reuse or refine good solutions◦ Abandon bad solutions◦ Ask yourself “Why did this solution work or fail?”◦ The goal is to be consciously aware of the

problem, what caused it to occur and how to solve it.

How to Identify AntiPatterns

Page 34: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Trust your intuition!

Talk to coworkers about your concerns.◦ They have just as much at stake as you do.

Read a book.

How to Identify AntiPatterns

Page 35: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Aligned with the goals of software engineering◦ On time delivery◦ Cost within budget◦ Customers happy with delivered software

Avoidance of AntiPatterns◦ Prior knowledge is key

Benefits to Understanding AntiPatterns

Page 36: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Increased Understanding of Best Practices!

Benefits to Understanding AntiPatterns

Page 37: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Borenstein, Nathaniel S. Programming as If People Mattered: Friendly Programs, Software Engineering, and Other Noble Delusions. Princeton, NJ: Princeton UP, 1991. Print.

Brown, William J., Hays W. McCormick, and Scott W. Thomas. AntiPatterns in Project Management. New York: Wiley, 2000. Print.

Sources

Page 38: By Thomas Hutton.  Definition  AntiPattern Template  Benefits of Identifying AntiPatterns  Benefits of Understanding AntiPatterns

Chemuturi, Murali, and Thomas M. Cagley. Mastering Software Project Management: Best Practices, Tools and Techniques. Ft. Lauderdale, FL: J. Ross Pub., 2010. Print.

Dudney, Bill. J2EE Antipatterns. Indianapolis, IN: Wiley Pub., 2003. Print. ◦ Found online via school library at

http://pltlib.wisconsin.edu/vwebv/holdingsInfo?searchId=797&recCount=25&recPointer=0&bibId=242218&searchType=7

Sources