👨‍💻
Software Engineering
Refactoring: Improving the Design of Existing Code
Refactoring: Improving the Design of Existing Code
  • Overview
  • Chapter 2
    • Defining Refactoring
    • Why Should We Refactor?
    • When Should We Refactor?
    • Problems with Refactoring
    • Refactoring, Architecture, and Yagni
    • Refactoring & the Wider Software Development Process
    • Refactoring & Performance
    • Going Further
  • Chapter 3
    • Bad Smells in Code
    • Smell: Mysterious Name
    • Smell: Duplicated Code
    • Smell: Long Function
Powered by GitBook
On this page
  • 🌳 Old Mindset
  • 🌱 New Mindset: Evolutionary Architecture
  1. Chapter 2

Refactoring, Architecture, and Yagni

Refactoring has profoundly changed how people think about software architecture.

🌳 Old Mindset

  • Software design & architecture should be worked on and mostly completed before writing code.

  • Once code is written, its architecture is fixed and can only decay due to carelessness.

🌱 New Mindset: Evolutionary Architecture

  • Refactoring allows us to significantly alter the architecture of software that's been running in production for years.

  • Finishing Architecture before coding assumes the requirements for the software can be understood early on. Experience shows that this is usually an unachievable goal.

  • People only understand what is needed from software once they have a chance to use it.

  • As our understanding of user needs changes, we use refactoring to adapt the architecture to those new demands rather than speculate on what might be needed upfront.

  • YAGNI: Simple, incremental design

    • Doesn't mean architectural thinking disappears or we neglect upfront thinking.

    • Preparatory thinking can still be valuable and save time.

  • The balance has shifted to dealing with issues later when we understand them better.

    • See Also: Lean Software Development - Decide as late as possible

PreviousProblems with RefactoringNextRefactoring & the Wider Software Development Process

Last updated 1 year ago