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. Since we won't be using any complex Java libraries, if you know C#, you'll also be able to get a lot out of this class. For JavaScript/TypeScript you won't get as much as we'll lean a lot on automated refactorings that can't be easily done in JS/TS, however all of the concepts still apply to object-oriented code.
Class Format & Schedule
This is an online, real-time, interactive class taught through Zoom, starting at 10am PST (1800 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