Code Smells Flashcards
1
Q
Signs and indicators of future problems/issues in the source code. May cause the program to be hard to understand, maintain and extend.
A
Code Smells
2
Q
Object-Orientation Abusers:
- method or class is trying to exhibit too many behaviors
A
Too Many Switch Statements
3
Q
Object-Orientation Abusers:
- fields get their values only under certain circumstances, outside of these circumstances, they’re empty
- refers to a field (variable) that is used only in certain situations or temporarily during execution
A
Temporary Field
4
Q
Object-Orientation Abusers:
- occurs when a subclass inherits from a parent class but does not use all of the methods and properties of the parent class
- when subclass does not use members inherited from a superclass
A
Refused Bequest
5
Q
Object-Orientation Abusers:
- closely related classes should share the same interface, so they can be pluggable
- two classes perform identical functions but have different method names
A
Alternative Classes with Different Interfaces
6
Q
Bloaters:
- a method contains too many lines of code
- methods that are too long are difficult to understand, test, and maintain
A
Long Method
7
Q
Bloaters:
- a class that contains many fields/methods/lines of code
- classes that are too large are difficult to understand, test, and maintain
A
Large Class
8
Q
Bloaters:
- occurs when developers overuse primitive data types, such as integers, strings, and booleans, to represent complex domain concepts
- Using primitive instead of creating own classes
A
Primitive Obsession
9
Q
Bloaters:
- more than three or four parameters for a method
- methods have too many parameters
A
Long Parameter List
10
Q
Bloaters:
- a group of data that always appear together
- occurs when a group of related variables are passed around together in a clump throughout various parts of the program
A
Data Clumps
11
Q
Change Preventers:
- same class changed for different reasons
- having to change many unrelated methods when you make changes to a class
A
Divergent Change
12
Q
Change Preventers:
- Several classes changed for every new feature/code
- making any modifications requires that you make many small changes to many different classes
A
Shotgun Surgery
13
Q
Change Preventers:
- occurs when an inheritance tree depends on another inheritance tree by composition
A
Parallel Inheritance Hierarchies
14
Q
Change Preventers:
- code that is too difficult to change without breaking other parts of the codebase. This can make the code difficult to maintain and extend
A
Rigid Code
15
Q
Dispensables:
- occurs when a method is filled with explanatory comments
A
Unnecessary Comments