Masterclass

Refactoring to a Clean Design

About

The purpose of this course is to help developers design easy to maintain code that’s a pleasure to work with. The workshop is driven by code examples aiming to teach developers refactoring techniques they can immediately apply to real-world projects.

On the first day we focus on focused micro-refactoring moves, while on the second day we talk about designing and refactoring the architecture of a system, which is often more impactful, but also more complex to perform. This training introduces the participants to an extensive set of refactoring moves that can be applied at moth levels to decompose a larger refactoring into a sequence of small, safe steps.

 

You should attend this workshop if you want to:

– Learn the major Code Smells and typical solutions

– Deepen your understanding of design concepts and principles

– Better understand the principles underlying the architecture of your system

– Enrich your toolbox with a number of automated refactoring from your IDE

 

By solving several refactoring exercises, you will learn how to:

– Break down complex refactoring into simple moves, performed automatically by IntelliJ

– Design and use Immutable Objects

– Write clean functional-style code

– Progressively restructure the architecture to match the changing requirements

 

In addition to the training itself, you will be given an assignment (refactoring coding katas). After you refactor it, you can send your cleaned-up solution to Victor before or up to 2 weeks after the training. Victor will then perform a code review of your solution providing a list of further improvement points, if any.

Course contents

  • Introduction
    • Refactoring opportunities
    • Separation by Layers of Abstraction
  • Micro-design:
    • Code Smells and fixes
    • Flag arguments, Parameter Objects
    • Function Size and Depth
    • Split Loop Refactoring
    • Handling null
    • Clean Code guidelines for Functional Programming
  • Logic Layers:
    • Adapter Pattern and Dependency Inversion Principle
    • Facade Pattern and Evolutionary Architectures
    • Domain Services – techniques to keep them small
    • A pragmatic take on Onion Architecture (aka Clean-, aka Hexagonal-)
  • Data Structures:
    • Immutable Objects in practice
    • Data Transfer Objects (DTOs) – why/when to keep them out of our Domain
    • Mapping to/from DTOs: Best Practices, pitfall of automatic mappers
    • Crafting an expressive Domain using Value Objects, invariants and constraints
    • Domain Events – mainstream best practices
    • “Light-CQRS” – A Pragmatic way to separate Read/Write models [Hibernate/JPA]
  • Breaking the Monolith – an incremental technique [briefly]
    • Entity links
    • Limiting calls and events between subdomains
    • Breaking Transactions, Foreign Keys and Replication
    • Microservices

–          Safe Refactoring in baby steps: many IDE hands-on tricks along the way

Target audience and prerequisites

Enthusiast developers that have:

– At least several years of experience with Java

– Basic understanding of the Java 8 lambdas and streams (nice to have)

Prerequisites:

The webinar will be streamed over Zoom, so for best experience have the app installed on your OS. At the beginning of the training you will be provided with a Git repository in which you can see all the code as it’s being worked out. At the end you’ll receive that repo zipped, with all the slides and conclusion documents we write together.

You are not required to write individually during the workshop, but you are free to do so if you want. In that case, you’ll need a development environment consisting of your favorite IDE, JDK 8+, working Maven (connected to central) and Git.