Goals of workshop
Gaining the ability for the team to develop a common understanding of code quality in order to change the existing legacy code in small steps towards agreed standards. These standards are of course also subject to further discussions and further updates.

Gaining the ability to modify the code architecture to make it more extendable, readable and testable by applying design patterns.

JBCNConf 2019 – Refactoring Workshop
  • come back with ideas for changes in the organization of work in their teams to enable continuous improvement of existing legacy code to clean code
  • practice code refactoring towards design patterns
  • learn more about selected design patterns
  • experience whether, when and how to work on reducing technical debt
In addition, students will experience how design patterns can hinder work when applied incorrectly. Ultimately, the knowledge gained will help to adjust the architecture of the code due to changing requirements.

About the training

Participants will practice live refactoring by following the trainer working on the continuous improvement of code quality. These improvements will vary from the smallest changes resulting in better readability and saving time needed to understand the code, upto the introduction of design patterns. Design patterns enable the use of proven and repeatable architectural solutions for similar groups of challenges.

Technically, this is a continuous change from legacy code to clean (cleaner) code consisting of very regular quality fixes applied to places where changes are currently made. This is the so-called Scout Rule.
Clean Code is a very famous term that was coined by Uncle Bob. It describes what good code should look like so it is readable,maintainable and maintainable. T
During the workshop, the concept of the Refactoring Pyramid will be discussed, which defines groups of issues for working with existing legacy code as interdependent layers.
Pyramid of refactoring Wide
  • Clean flow of logic
  • Smaller method extraction
  • Building smaller classes
  • Looking for design patterns
  • Clean Architecture

Design patterns are common solutions for similar groups of problems. They have proven useful and helpful due to their reusability and effectiveness.

Design Patterns in programming were first described in 1994 in the book Design Patterns: Elements of Reusable Software Architecture. Many years later, one of the book’s authors – Ralph Johnson – in his speech “21 Years of Design Patterns” said: “We could have done better, but I think we did quite well.”

When the number of lines of code is increasing, there is usually one of the design patterns missing. That’s when we think “if only I had applied the Strategy / State / Chain of Responsiblity design pattern earlier instead of all these nested if-else statements…”. And it is these insights that lead us to refactor into relavant design patterns at the right time – not too early and not too late.

Plan of workshop
The workshop consists mainly of working with the code with the support of automatic refactorings built into the IntelliJ development environment from JetBrains. The source code is written in Java. The trainer performs all refactorings live in small steps, allowing participants to practice the same transformations on their laptops.
The remaining 25% of the training is devoted to the inspirational and motivational part, which allows you to look for improvements on how to make cleaning existing legacy code everyday habit and become part of the software development process. This, in turn, will enable to keep technical debt under control.
This training is mainly about refactoring to clean code and patterns – and about code architecture appropriate at the moment for current requirements. Different teams may prefer different architectures, and the goal of this training is to show how easily we can re-architect code to meet new business requirements.

Day 1 – training content Refaktoryzacja do Czystego Kodu

Part 1 – Cleaning Code in small steps

  • Review of Legacy Code project
  • It’s only one more “if” statement…
  • Review of automated refactorings in IntelliJ
  • Live refactoring in small steps
  • Habits of personal effectiveness for code quality
  • Clean Code & Pyramid of Refactoring
  • SOLID Principles & Pyramid of Refactoring

Part 2 – Clean Code to ease extendability and testability

  • Review of “Extended” Legacy Code project
  • New Requirements + No Cleaning = (More) Dirty Legacy Code
  • More Requirements are coming…
  • Live refactoring towards extraction of extension points
  • Clean code is extendable code
  • Habits of team effectiveness for code quality
  • Implementation of additional functionality using TDD

Main topics for the remaining days

  • practice of code refactoring to design patterns
  • linking how your software development process impacts final code quality
Day 2
Legacy code refactoring completed with the implementation of the following design patterns
  • Interpreter
  • Chain of Responsibility
  • Fluent Builder
  • Iterator
  • State
Day 3
Legacy code refactoring completed with the implementation of the following design patterns
  • Template
  • Bridge
  • Composite
  • Factory Method
  • Abstract Factory
  • Adapter
Workshop duration
The workshop is a very intensive aone nd based on my experience (i.e. carrying it out dozens of times) the proposed approach is 3 days of 8 hours.
Target Audience
Level: intermediate, although senior programmers also repeatedly claimed that they learned many new things that they could then share within their teams.