46
Concordion

Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Embed Size (px)

Citation preview

Page 1: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Concordion

Page 2: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 3: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti.

How can we stop it?

Page 4: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Clean code expresses its logic clearly. It's well presented and makes good use of abstraction to hide irrelevant details.

Or to put it simply...

Page 5: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

It's readable.

Page 6: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

So, focus relentlessly on readability. Not just in code,

but in everything:

Build scripts, class names, log files, story cards, acceptance tests,

method names, e-mails, unit tests,management reports, etc.

Page 7: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Don't tolerate acceptance tests written like this...

Page 8: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 9: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Use Concordion and write them like this instead...

Page 10: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 11: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Clear tests lead to clear fixture code

Page 12: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Notice you are not forced to use tables or a "Given... When... Then..." structure

Page 13: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

"Given... When... Then..." is an excellent thinking tool, but it's not a natural way to explain things.

Concordion lets you focus on readability.

Page 14: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 15: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 16: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 17: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 18: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 19: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Visibility to Management

A huge benefit of having readable tests is that managers can actually read them and gauge their quality.

This provides the team with an incentive for writing them well and not cutting corners.

Page 20: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

• Tables <table>, <tr>, <th>, <td>

• Paragraphs <p>

• Bold <b>

• Headings <h1>

You don't need to know much HTMLto use Concordion...

Page 21: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

A Worked Example of Concordion

Page 22: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 23: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 24: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Although this HTML might look a bit complicated, most of it is just a template.

You only need to worry about the bits in the middle...

Page 25: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 26: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Now, highlight the key phrases in bold...

Page 27: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 28: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 29: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Once agreed, the developer can instrument it with hidden attributes that

communicate with the fixture...

Page 30: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 31: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Here's our base fixture...

Page 32: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 33: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

If we run it with JUnit, then currently it will fail...

Page 34: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 35: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

The test output is written to a filein the temp directory*...

* You can change this via a system variable, if you like.

Page 36: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 37: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Let's add the missing methodand run it again...

Page 38: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 39: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 40: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

It still fails, so let's get it to pass.

Normally this would be a call to the system under test, but for this demowe'll just implement it in the fixture...

Page 41: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 42: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 43: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti
Page 44: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

There are versions for...

• Java

• .NET

• Ruby

• Python

Page 45: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

http://www.concordion.org

Page 46: Concordion. You've been there... starting a project with great intentions but, 6 months down the line, you're sitting in front of another plate of spaghetti

Coaching

Although Concordion is very easy to use, the way of thinking - distilling and decomposing behaviours - can take some to get used to.

I'm an independent consultant based in London, UK.

Please contact me if you would like some help getting your team off on the right track with Concordion.

David Peterson

[email protected]://www.davidpeterson.co.uk