liveBook · Manning

Refactoring

As explained in Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform

Continuous refactoring is the repeated restructuring of software during development without changing its externally observable behavior.

Refactoring restructures software while keeping the product working. Used continuously, it prevents overdesigned architecture and lets a simpler design emerge as development circumstances change. section 1.14.1 section 12.6

A practical refactoring workflow emphasizes:

  • Start with a simple design instead of trying to future-proof the architecture. section 1.14.1
  • Make small, manageable changes and keep the code working after each step. section 12.6
  • Support restructuring with thorough automated testing; build the tests along the way when necessary. section 12.6 section 12.6.6
  • Find natural seams in a monolith and extract aligned components incrementally rather than attempting a big-bang conversion. section 12.6 section 12.6.6
  • Continue delivering features and fixing bugs while restructuring, so problems do not accumulate. section 12.6

Extracting a monolith

A monolith with tangled code may lack obvious extraction boundaries. Refactor it first, or refactor during extraction, using automated tests and small, well-tested steps to expose components that align with the intended microservices architecture. section 12.6.6 section 12.6

Figure 12.23 Refactoring a monolith to microservices can only be done in an iterative sequence of small and well-tested steps.

Use the workflow diagram to follow refactoring as an iterative sequence of small, well-tested steps. section 12.6

How Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform covers it

How deep it goes
Explains iterative steps, testing, natural seams, and delivery constraints, but defers detailed conversion tactics to individual monoliths.
Examples
Shows simple architectural design, incremental monolith extraction, natural seams, and Terraform code refactoring.
What it assumes
Assumes basic software design and planning, while emphasizing that monolith conversion depends heavily on the existing codebase.
What you can do after
Apply refactoring through small tested changes while preserving a working product and preparing components for extraction.
How it connects
Connects software design, microservices, monolith conversion, automated testing, and infrastructure as code.

Also explained in

Compare how 22 books explain refactoring →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Bootstrapping Microservices, Second Edition: With Docker, Kubernetes, GitHub Actions, and Terraform. The section links point to the parts of the book it draws on.