Modern Backend – Refactoring with New Syntax

Modern Backend – Refactoring with New Syntax

The final session of Part 1 of the [Modern Backend] course is a hands-on lecture on "Refactoring with New Syntax."

In this lecture, we will conduct live coding to apply two key Java 25 language features covered in the previous Lesson 8 that can be directly incorporated into actual code: Module Import and Flexible Constructor Bodies to the bulletin board practice project.


📌 Key topics:

  • Selecting the scope of the exercise: criteria for distinguishing the targets for code refactoring (module imports and flexible constructors) from the excluded topics (primitive type patterns and compact object headers) among the four topics in Lesson 8

  • Practical application of Module Import:

  • Storage layerLocalFileStorage)'s java.io, java.nio, and java.util imports import module java.base;consolidated into a single module import

  • The principles behind class name conflicts between different modules and how to resolve them through single-type imports

  • Practical application of Flexible Constructor Bodies:

  • PostNotFoundException: super()Parameter null validation and safe exception handling in the prologue before the

  • StorageException: Consolidating preprocessing logic, such as filename parsing, label processing, and field assignment, in the prologue and passing the results to the superclass constructor

  • Precautions when implementing the prologue (rules restricting references to uninitialized instance fields and methods)

  • Completion of Part 1 [Core Java 25 Features and Migration] and a preview of Part 2 [Spring Boot]


Explore the refactoring process of incorporating the latest Java syntax cleanly and safely into real-world projects.

Site footer