Smells to Refactorings

0.0(0)
studied byStudied by 0 people
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/59

flashcard set

Earn XP

Description and Tags

Flashcards of vocabulary terms and definitions related to code smells and refactoring techniques.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

60 Terms

1
New cards

Combinatorial Explosion

A subtle form of duplication where code does the same thing using different combinations of data or behavior.

2
New cards

Divergent Change

Occurs when one class is commonly changed in different ways for different reasons.

3
New cards

Indecent Exposure

Lack of information hiding; exposing methods or classes that should not be publicly visible.

4
New cards

Conditional Complexity

Conditional logic that becomes complicated and expansive over time.

5
New cards

Incomplete Library Class

When responsibilities should be moved to a library class, but modification is not possible.

6
New cards

Duplicated Code

The most pervasive smell, existing in explicit (identical) or subtle (similar) forms.

7
New cards

Inappropriate Intimacy

Classes that delve too much into each others’ private parts.

8
New cards

Feature Envy

When a method makes too many calls to other classes to obtain data or functionality.

9
New cards

Alternative Classes with Different Interfaces

When the interfaces of two classes are different but the classes are quite similar.

10
New cards

Data Clumps

Bunches of data that hang around together and should be made into their own object.

11
New cards

Data Class

Classes that have fields, getting and setting methods, and nothing else.

12
New cards

Large Class

The presence of too many instance variables, indicating a class is trying to do too much.

13
New cards

Freeloader

A class that isn’t doing enough to pay for itself and should be eliminated.

14
New cards

Oddball Solution

A problem solved inconsistently in a system, indicating subtly duplicated code.

15
New cards

Solution Sprawl

Code or data sprawled across numerous classes used in performing a responsibility.

16
New cards

Temporary Field

Objects containing fields that don't seem to be needed all the time.

17
New cards

Switch Statement

Duplicated switch statements across a system, revealing a lack of object orientation.

18
New cards

Speculative Generality

Generic or abstract code that isn’t actually needed today.

19
New cards

Parallel Inheritance Hierarchies

Every time you make a subclass of one class, you have to make a subclass of another.

20
New cards

Middle Man

Objects that add no value, simply passing messages on to another object.

21
New cards

Long Parameter List

Long lists of parameters in a method, difficult to understand and likely to be volatile.

22
New cards

Message Chains

A long sequence of method calls or temporary variables to get some data.

23
New cards

Shotgun Surgery

Changing lots of pieces of code in different places to add a new or extended piece of behavior.

24
New cards

Refused Bequest

Inheriting code you don't want and writing code to refuse the 'bequest'.

25
New cards

Primitive Obsession

Relying too much on primitives (integers, Strings, etc.) instead of creating classes.

26
New cards

Long Method

Long methods containing duplicated code that should be broken into smaller, well-named methods.

27
New cards

Unify Interfaces with Adapter

A refactoring technique to unify different interfaces using an adapter.

28
New cards

Rename Method

A refactoring technique to rename a method for clarity.

29
New cards

Move Method

A refactoring technique to move a method to a more appropriate class.

30
New cards

Replace Implicit Language with Interpreter

A refactoring technique to replace implicit language with a dedicated interpreter.

31
New cards

Extract Method

A refactoring technique to break down a method into smaller, more manageable parts.

32
New cards

Introduce Assertion

A refactoring technique to introduce assertions for validating state.

33
New cards

Introduce Null Object

A refactoring technique to handle null values more gracefully with a null object.

34
New cards

Move Embellishment to Decorator

A refactoring technique to add responsibilities dynamically.

35
New cards

Replace Conditional Logic with Strategy

A refactoring technique to replace conditional logic with strategy pattern.

36
New cards

Replace State-Altering Conditionals with State

A refactoring technique to replace state-altering conditionals with state pattern.

37
New cards

Encapsulate Field

A refactoring technique to encapsulate a field and control access to it.

38
New cards

Encapsulate Collection

A refactoring technique to encapsulate a collection and control access to it.

39
New cards

Extract Class

A refactoring technique to create a new class from parts of an existing one.

40
New cards

Preserve Whole Object

A refactoring technique to pass the whole object as a parameter instead of individual fields.

41
New cards

Introduce Parameter Object

A refactoring technique to group multiple parameters into a single object.

42
New cards

Form Template Method

A refactoring technique to form a template method by extracting common steps.

43
New cards

Introduce Polymorphic Creation with Factory Method

A refactoring technique to create objects polymorphically using a factory method.

44
New cards

Pull Up Method

A refactoring technique to move a method up to a superclass.

45
New cards

Pull Up Field

A refactoring technique to move a field up to a superclass.

46
New cards

Replace One/Many Distinctions with Composite

A refactoring technique to replace one/many distinctions with composite pattern.

47
New cards

Substitue Algorithm

A refactoring technique to replace an algorithm with a better one.

48
New cards

Hide Delegate

A refactoring technique to hide the delegate object from the client.

49
New cards

Introduce Foreign Method

A refactoring technique to wrap a class with additional methods.

50
New cards

Introduce Local Extension

A refactoring technique to create a new and extended class.

51
New cards

Consolidate Conditional Expression

A refactoring technique to consolidate duplicate conditional fragments.

52
New cards

Decompose Conditional

A refactoring technique to decompose and distribute responsibility within a class using the composite pattern.

53
New cards

Replace Magic Number with Symbolic Constant

A refactoring technique to to create a constant from a literal for clarity.

54
New cards

Consolidate Duplicate Conditional Fragments

A refactoring technique to combine methods that perform a similar series of steps into a single method.

55
New cards

Replace Delegation with Inheritance

A refactoring technique to replace delegation with inheritance.

56
New cards

Replace Inheritance with Delegation

A refactoring technique to replace inheritance with delegation.

57
New cards

Parameterize Method

A refactoring technique to turn hard-coded algorithms into replaceable components

58
New cards

Replace Record with Data Class

A refactoring technique to replace a record with a data object.

59
New cards

Replace Nested Conditional with Gard Clauses

A refactoring technique to replace nested conditional with guard clauses.

60
New cards

A refactoring technique to replace method with method object