1/59
Flashcards of vocabulary terms and definitions related to code smells and refactoring techniques.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
Combinatorial Explosion
A subtle form of duplication where code does the same thing using different combinations of data or behavior.
Divergent Change
Occurs when one class is commonly changed in different ways for different reasons.
Indecent Exposure
Lack of information hiding; exposing methods or classes that should not be publicly visible.
Conditional Complexity
Conditional logic that becomes complicated and expansive over time.
Incomplete Library Class
When responsibilities should be moved to a library class, but modification is not possible.
Duplicated Code
The most pervasive smell, existing in explicit (identical) or subtle (similar) forms.
Inappropriate Intimacy
Classes that delve too much into each others’ private parts.
Feature Envy
When a method makes too many calls to other classes to obtain data or functionality.
Alternative Classes with Different Interfaces
When the interfaces of two classes are different but the classes are quite similar.
Data Clumps
Bunches of data that hang around together and should be made into their own object.
Data Class
Classes that have fields, getting and setting methods, and nothing else.
Large Class
The presence of too many instance variables, indicating a class is trying to do too much.
Freeloader
A class that isn’t doing enough to pay for itself and should be eliminated.
Oddball Solution
A problem solved inconsistently in a system, indicating subtly duplicated code.
Solution Sprawl
Code or data sprawled across numerous classes used in performing a responsibility.
Temporary Field
Objects containing fields that don't seem to be needed all the time.
Switch Statement
Duplicated switch statements across a system, revealing a lack of object orientation.
Speculative Generality
Generic or abstract code that isn’t actually needed today.
Parallel Inheritance Hierarchies
Every time you make a subclass of one class, you have to make a subclass of another.
Middle Man
Objects that add no value, simply passing messages on to another object.
Long Parameter List
Long lists of parameters in a method, difficult to understand and likely to be volatile.
Message Chains
A long sequence of method calls or temporary variables to get some data.
Shotgun Surgery
Changing lots of pieces of code in different places to add a new or extended piece of behavior.
Refused Bequest
Inheriting code you don't want and writing code to refuse the 'bequest'.
Primitive Obsession
Relying too much on primitives (integers, Strings, etc.) instead of creating classes.
Long Method
Long methods containing duplicated code that should be broken into smaller, well-named methods.
Unify Interfaces with Adapter
A refactoring technique to unify different interfaces using an adapter.
Rename Method
A refactoring technique to rename a method for clarity.
Move Method
A refactoring technique to move a method to a more appropriate class.
Replace Implicit Language with Interpreter
A refactoring technique to replace implicit language with a dedicated interpreter.
Extract Method
A refactoring technique to break down a method into smaller, more manageable parts.
Introduce Assertion
A refactoring technique to introduce assertions for validating state.
Introduce Null Object
A refactoring technique to handle null values more gracefully with a null object.
Move Embellishment to Decorator
A refactoring technique to add responsibilities dynamically.
Replace Conditional Logic with Strategy
A refactoring technique to replace conditional logic with strategy pattern.
Replace State-Altering Conditionals with State
A refactoring technique to replace state-altering conditionals with state pattern.
Encapsulate Field
A refactoring technique to encapsulate a field and control access to it.
Encapsulate Collection
A refactoring technique to encapsulate a collection and control access to it.
Extract Class
A refactoring technique to create a new class from parts of an existing one.
Preserve Whole Object
A refactoring technique to pass the whole object as a parameter instead of individual fields.
Introduce Parameter Object
A refactoring technique to group multiple parameters into a single object.
Form Template Method
A refactoring technique to form a template method by extracting common steps.
Introduce Polymorphic Creation with Factory Method
A refactoring technique to create objects polymorphically using a factory method.
Pull Up Method
A refactoring technique to move a method up to a superclass.
Pull Up Field
A refactoring technique to move a field up to a superclass.
Replace One/Many Distinctions with Composite
A refactoring technique to replace one/many distinctions with composite pattern.
Substitue Algorithm
A refactoring technique to replace an algorithm with a better one.
Hide Delegate
A refactoring technique to hide the delegate object from the client.
Introduce Foreign Method
A refactoring technique to wrap a class with additional methods.
Introduce Local Extension
A refactoring technique to create a new and extended class.
Consolidate Conditional Expression
A refactoring technique to consolidate duplicate conditional fragments.
Decompose Conditional
A refactoring technique to decompose and distribute responsibility within a class using the composite pattern.
Replace Magic Number with Symbolic Constant
A refactoring technique to to create a constant from a literal for clarity.
Consolidate Duplicate Conditional Fragments
A refactoring technique to combine methods that perform a similar series of steps into a single method.
Replace Delegation with Inheritance
A refactoring technique to replace delegation with inheritance.
Replace Inheritance with Delegation
A refactoring technique to replace inheritance with delegation.
Parameterize Method
A refactoring technique to turn hard-coded algorithms into replaceable components
Replace Record with Data Class
A refactoring technique to replace a record with a data object.
Replace Nested Conditional with Gard Clauses
A refactoring technique to replace nested conditional with guard clauses.
A refactoring technique to replace method with method object