Bad Code smells refactoring Between classes

Fowler et al. Bad smell refactoring between classes

Get Started. It's Free
or sign up with your email address
Bad Code smells refactoring Between classes by Mind Map: Bad Code smells refactoring Between classes

1. Incomplete Library class Responsabilities must be placed in lib but we don't wana modify

1.1. Introduce foreign Method

1.2. Introduce local extension

2. Message Chains Clients.getA().getB().getC() but object are not related

2.1. Hide delegate

2.1.1. d

2.2. Extract method

2.3. Move method

3. Primitive Obsession Primitives values is good BUT => Creating specifique class is better

3.1. Raplace data value with object

3.2. Replace type code with class

3.3. Replace type code with state/strategie

3.4. Replace type code with subclass

3.5. Special cases

3.5.1. if Many var to regroup

3.5.1.1. Extract class

3.5.2. If primitives value are in param list

3.5.2.1. Introduce Parameter object

3.5.3. If presence of tabes

3.5.3.1. Replace array with object

4. Data Class Class with only get/set

4.1. Move method

5. Data Clumps data always found tog

5.1. Extract class

5.2. Introduce parameter object

5.3. Preserve whole object

6. Refused Bequest Sub-class don't need al heritation

6.1. Create a neighbor class

6.1.1. Push down method

6.1.2. Push down field

6.2. If sub class use same behavior but don't wana support interface of super class

6.2.1. Replace inheritance with delegation

6.2.1.1. p

7. Inappropriate Intimacy 2 class having sex too much

7.1. Move method

7.2. Move field

7.3. Extract class

7.4. Hide delegate

7.5. Replace inheritance with delegation

8. Lazy Class Class doing fuck all & need refactor

8.1. Collapse hiarchy

8.1.1. Faire un merge

8.2. Inline class

8.2.1. Move all its features into another class and delete it.

9. Parallele inheritance hiarchy Creating sub class need a lot of subs class of other hiarchy

9.1. Combine hiarchies

9.1.1. Move field

9.1.2. Move method

10. Feature envy Methods is belgar asking too many shit from other class

10.1. Move method

10.2. Extract method

11. Middle man A class delegate too many stuff to another

11.1. Remove middle man

11.2. Special cases

11.2.1. If only few method aren't doing shit

11.2.1.1. Inline method

11.2.1.1.1. Put the method's body into the body of its callers and remove the method.

11.2.2. if Transfom middle class in sub class

11.2.2.1. Replace delegation with inheritance

11.2.2.1.1. Create a field for the superclass, adjust methods to delegate to the superclass, and remove the subclassing.

12. Divergent Change Class is often modified for god knows why

12.1. Extract class

12.1.1. Regrpup resposabilities related (cohesion) or ce qui change en meme temps dans une autre class

13. Shotgun Surgey 1 changement require many other changement

13.1. options

13.1.1. Regroupd changement in 1 class

13.1.1.1. Move method

13.1.1.2. Move field

13.1.2. Regroup similar behavior

13.1.2.1. Inline class

13.1.2.1.1. i

14. Alternative classes with different Interfaces Method that doing same shit , but with different signature

14.1. Rename method

14.2. Move method (to the more effective class)