Live Refactoring Session: Getting rid of dirty code


Details
Marcus Biel
A typical refactoring situation: Untested legacy code, written in Java 5, 14 years ago. Without tests we cannot touch the code, but without touching and understanding the code we cannot write tests. Chicken-and-egg problem! What to do?
In this live hacking I will refactor a small Sudoku Brute Force Solver. The code is anything but bad, but its age shows. In short sections we want to give the legacy code a rejuvenating treatment. In doing this, I want to introduce you to my personal approach when refactoring untested legacy code.
Among many other things, we will cover:
- Code readability
- Comments
- General OO
- Encapsulation
- Coupling
- Cohesion
- Immutable Classes
- Modern IO
- Java 8 Streams
I recommend that you familiarize yourself with the Sudoku rules and check the original code beforehand:
https://github.com/fzoli/Sudoku/blob/master/src/java/sudoku/chan/SudokuSolver.java
https://github.com/fzoli/Sudoku/blob/master/src/java/sudoku/chan/Grid.java
Marcus Biel (@MarcusBiel) works as Director of Customer Experience for Red Hat. He is a well-known software craftsman, Java influencer and Clean Code Evangelist. He is also a regular speaker at Java conferences all over the world, such as JBCN Conf Barcelona, JPoint Moscow and JAX London. Besides this, he works as a technical reviewer for renowned Java books such as Effective Java, Core Java SE 9 for the Impatient or Java by Comparison.
In 2015, Marcus started a Java blog and YouTube channel that makes Java accessible to passionate developers. There are many advanced tutorials that you can find online, but tutorials with a solid background like this one are rare.
Marcus has become well-known in the Java community, with a total of 70 000 followers across various social media platforms. In 2017, the editorial team at jaxenter.com rated him #13 in their list of the world’s top Java influencers.

Live Refactoring Session: Getting rid of dirty code