Accelerated TDD: For More Productive C++ [2021 class archive]

Accelerated TDD: For More Productive C++is a two-day training course with programming examples taught by Phil Nash. It is offered onsite at the Gaylord Rockies from 09:00 to 17:00 on Saturday, October 23rd and and Sunday, October 24th, 2021 (immediately prior to the conference). Lunch is included.

Course Description

We all know that writing tests for our code is “what we should do”, and maybe we’re even doing that already. But it feels like extra busy-work that slows us down – and they hardly ever catch any bugs anyway…

Maybe we’ve even tried TDD, and felt that it was just adding even more ceremony to the problem with no real advantages.

But the advantages are definitely there! We just need a good grounding in what TDD _actually_ is (and isn’t) and how to do it properly – especially in the context of C++, which brings its own idiosyncrasies and bottlenecks to the matter.

That’s what this workshop aims to be. Whether you’ve never written a test before, or you’ve had some mileage with TDD already, be prepared to ratchet up your productivity by thinking about things in new ways and gaining more approaches to breaking down problems in sustainable ways.

Prerequisites

  • Be comfortable with the basics of C++. Being an expert not required
  • A laptop with a reasonably modern OS.
  • A compiler capable of running C++11 (ideally gcc, clang or VC++) – don’t worry if it’s not what you use in your day job.
  • An open mind and motivation to find better ways of doing things.

Course Topics

  • Why “Accelerated”?
  • Why test?
    • What is a test?
    • Type of test (unit, integration, system, regression, acceptance…)
    • Roles of a test
    • How testing makes us go faster
  • Why test first?
    • Coverage = Courage
    • Design pressures
    • Mental modes
    • Focus and flow
    • Never more than 5 mins from green
  • How to TDD
    • The TDD Cycle
    • The Art and Craft of TDD
    • Are we done yet?
  • Relevant Design Principles
    • Separation of Concerns
    • Single Responsibility
    • Cohesion
    • Low/ Loose Coupling
    • SOLID?
  • Growing Software, Guided By Tests
    • Putting it all together
    • Treat test code like production code
    • Negative paths
    • Avoiding brittle tests
    • Pruning tests
    • Dependent Tests
    • Tests as documentation
  • Decelerated TDD
    • Slowing down to speed up
    • Deliberate Practice
  • Pain points and Limitations
    • Slow running tests
    • Flakey Tests
    • Brittle tests revisited
    • Testing the implementation
    • Orthogonal concerns (e.g. logging, error handling)
    • Premature Generalisation
    • Beware a false sense of security
    • Getting legacy code under test
    • Getting team buy-in
    • The Transformation Priority Premise
  • Beyond TDD
    • BDD
    • ATDD
    • Property based Testing
    • Mutation Testing
    • Fuzz Testing
    • Treat test code like production code, except when you shouldn’t
    • Mocking
    • Risk Planes
  • Next Steps
    • Keeping the momentum going
    • Pairing
    • Forming habits

We’ll work through several demos and exercises together and will often work in pairs.

Register Here

Course Instructor

Phil Nash

Phil Nash is the original author of the C++ test framework, Catch2, and composable command line parser, Clara. As Developer Advocate at SonarSource he’s involved with SonarQube, SonarLint and SonarCloud, particularly in the context of C++. He’s also the organiser of C++ London and C++ on Sea, as well as co-host and producer of cpp.chat and NoDiagnosticRequired podcasts.

More generally he’s an advocate for good testing practices, TDD and using the type system and functional techniques to reduce complexity and increase correctness. He’s previously worked in Finance and Mobile, and offers training and coaching in TDD for C++.