Todos los packs
StableArquitecturamartin-fowler-refactoring
Martin Fowler — Refactoring
Operationalizes disciplined refactoring: small, behavior-preserving transformations backed by tests, named code smells that signal when to refactor, and the practice of continuous small improvement over big rewrites.
refactoringcode-smellstechnical-debttestingincremental-improvement
Principios
- · RF1 — Refactor continuously, not as a separate phase. Interleaved with feature work, driven by the rule of three and by "make the change easy."
- · RF2 — Never mix refactoring and behavior change in one step. One hat at a time; ideally one commit per hat.
- · RF3 — Every step is small and independently verifiable. If a step can't be verified by running tests in under a minute, it's too big — split it.
- · RF4 — Tests must exist and pass before refactoring starts, and pass again after each step. No test coverage on the code being touched → write characterization tests first, or accept elevated risk explicitly.
- · RF5 — Name the smell before choosing the refactoring. Diagnosis before treatment avoids applying a familiar refactoring to the wrong problem.
Patrones
- · Long method — if you have to scroll to see the whole thing, or hesitate before naming it, it's probably too long. → Extract Function.
- · Large class — a class doing many unrelated things (see SRP). → Extract Class.
- · Duplicated code — same logic in ≥2 places (the third occurrence triggers action). → Extract Function, call from both.
- · Feature envy — a method more interested in another class's data than its own. → Move Function to where the data lives.
- · Long parameter list — >3-4 params, especially several of the same type. → Introduce Parameter Object.
Riesgos
- · Ver anti-patrones específicos del dominio en el pack.
Checklist
- [ ] Behavior changes and structural refactoring are separated (commits/PRs). (MF1)
- [ ] Refactored code has test coverage; characterization tests added where missing. (MF3)
- [ ] Full test suite passes at each meaningful checkpoint, not just at the end. (MF2)
- [ ] Duplication extracted only at the third occurrence, not preemptively. (MF4, RF7)
- [ ] Refactoring steps map to named catalog refactorings, reviewable individually. (MF5)
- [ ] Unrelated smells spotted in review are filed as follow-ups, not scope-crept into this PR.
Fuentes
En la bibliografía AKOS
Este pack cita las siguientes fuentes registradas en el índice bibliográfico:
- blogmartinfowler.comMartin Fowler
- bookRefactoring: Improving the Design of Existing Code (2nd Edition)Martin Fowler. Addison-Wesley
- blogStranglerFigApplicationMartin Fowler