Make Your Code More Testable

Four half-days: 10:00-13:30 PDT (1700-2030 UTC)

Learn to Refactor to Testable Code

Past students say:

"Ted did a great job of incorporating different education tools like diagrams, written explanations, and verbal explanations while also giving us many opportunities to work in a hands-on manner. 10 out of 10."

and

"A fantastic course and I enjoyed it very much...learned a lot, got plenty of hints of where to dig deeper both from you and other people taking the course, got an answer to a question that has been bugging me for ages, and had a lot of fun in the process."

About The Class

This interactive, online class looks at the problems we encounter in our codebases, such as code that is hard to read and maintain, and designs that cause the code to be hard to understand and test. We look at finding messy code by their “smell”, and explore ways to tidy up those messes using refactoring. We use automated refactorings in tools like IntelliJ IDEA so that we can improve legacy code that isn't well-covered by existing tests. We finish with ways to improve the reliability of your code through well-written Unit Tests and Test-Driven Development.

See below for more details

Tickets Prices in USD

Interested in future courses? Enter your Name and Email:

Additional Information

Prerequisites

You don't need to be a Java expert, but you will need to be able to read and write straightforward Java code as all exercises and code samples are in Java. We don't use any complex Java libraries, so if you know C#, you'll be able to get a lot out of this class. For JavaScript/TypeScript you won't get as much as we make heavy use of automated refactorings that can't be easily done in JS/TS, however all of the concepts apply to object-oriented code.

Class Format & Schedule

This is an online, real-time, interactive class taught through Zoom, starting at 10am PDT (1700 UTC) for 3 1/2 hours (including breaks). The class is spread across 4 days to fit in your day, as well as provide lots of sleep cycles in between to improve your learning.

The Content

Code Smell: Long Method

  • What they are, and a long look at the Long Method code smell.
  • Exercise: find code smells

Refactoring & Testing

  • What refactoring really is (and what it's not)
  • Rules of refactoring
  • Five modes of refactoring
  • Revealing hidden design by continually applying Tiny Clarifications
  • Exercise: refactor away some code smells

  • Boundaries and refactoring at different levels

  • Tests and how they support refactoring

  • Exercise: run and examine tests

Primitive Obsession Code Smell

This code smell is often overlooked, but it's one of the most common code smells and refactoring away that smell (through encapsulation) is one of the most powerful ways to improve your code's design.

Exercise: identify and refactor Primitive Obsession.

Feature Envy Code Smell

Closely related to Primitive Obsession is the Feature Envy code smell. Once you solve Primitive Obsession by creating a new type, behavior elsewhere starts to look out of place. Feature Envy puts the behavior where it belongs.

Exercise: Encapsulate Collection

Refactoring Heuristics

A set of a dozen heuristics that you can apply to your code base to improve the readability of the code as well as the testability.

Test-First Thinking

Even when you can't do Test-Driven Development, learning the Test-First Thinking and the Two Test Questions make it easier to write testable code, even in a poorly tested codebase.

Good Unit Tests

What are good unit tests? How to decide what test to write first? And what tests do you write next?

Test-Driven Development

End with a taste of Test-Driven Development using the "Predictive TDD" cycle and get an understanding of TDD as a complete process, even for code not developed using TDD.

Parting Gifts

After the class is over, you will get:

  • Copies of all slides
  • Code shown and worked on during class
  • Video recording of the entire class for your review
  • Access to a private Discord community to ask questions
  • A chance to participate in "Mob Programming" sessions