Smelles and refactoring

xiaoxiao2021-03-06  77

I have organized it to help the code Ref care.

Smells within classes

Smells

Refactoring

Comments

Long Method Extract Method.

Large Class Extract Class

Extract Subclass

Long Parameter List Replace Parameter with Method

Preserve Whole Object

Introduce Parameter Object.

Smells Between Classes

Smells category

Smells

Refactoring

Data

Primitive Obsession Replace Data Value with Object

Replace Type Code with Class

Replace Type Code with Subclasses

Replace Type Code with State / Strategy.

Data class

Data CLUMP Extract Class

Introduce Parameter Object

Preserve Whole Object

Temporary Field Extract Class

Introduce Null Object

Inheritance

Refuse Bequest Push Down Method Push Down Field Replace Inheritance with Delegation

INAPPRIATE INTIMACY (SUBCLASS FORM) Self Encapsulate Field Form Template Method Replace Inheritance with Delegation

Lazy Class Collapse Hierarchy Inline Class Responsibility

Feature envy

Move Method

INAppriate Intimacy (General Form) Move Method and Move Field

Extract Class and Hide delegate

Change Bidirectional Association To Unidirectional

Message Chains Extract Method Move Method Hide Delegate

Middle man Remove Middle Man

Replace Delegation with inheritance Accommodating Change

DIVERGENT CHANGE

SHOTGUN SURGERY

Parallel Inheritance Hierarchies

Combinator explosion

Library classes

Incomplete Library Class

转载请注明原文地址:https://www.9cbs.com/read-107937.html

New Post(0)