Refactoring

Table of Contents

Introduction

How it works

for each desired change, make the change easy (warning: this may be hard), then make the easy change – Kent Beck

Refactoring is the process improving the structure of the code without changing its externally observable behaviour. In order to be confident in doing so, there needs to be a high unit test coverage.

Workflows of Refactoring

Refactor Type Description
TDD Refactoring is part of the Red-Green-Refactor cycle of TDD. After the "Make it work" step, the "Make it clean" step follows explicitly.
Boy Scout Rule Code smells are fixed right away in little steps when they are identified.
Comprehension After a hard time understanding a piece of code, the heureka moment is captured to make it easier next time for someone else.
Preparatory Changes of the code structure before the new feature to make the work easier.
Planned Code structure improvements which are part of the project plan. This should be an exception.
Long term Working towards a vision how the code should look like. Ideally in little steps without making it part of the project plan.

Refactorings

Extract variable

Unsorted Bookmarks

GitHubImpressum