1/22
These flashcards cover key concepts and definitions related to code smells and object-oriented design principles for the midterm exam.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Code Smells
Indicators of potential problems in the code, caused primarily by poor design.
Open-Closed Principle (OCP)
Software entities should be OPEN for extension but CLOSED for modification.
Lazy Class
A class with so little functionality it doesn't justify its existence.
Divergent Change
One class is modified for many different, unrelated reasons.
Shotgun Surgery
A single logical change requires making many small edits across different classes.
Feature Envy
A method/class relies more on another class's data and methods than its own.
Inappropriate Intimacy
Two classes are tightly coupled—one knows too much about the other's internals.
Bad Naming
Variables/methods/classes have unclear, misleading, or overly abbreviated names.
Long Methods
Methods that exceed ~15 lines and do too many things at once.
Large Classes
Classes with too many methods/responsibilities.
Duplicated Code
Same or very similar code appearing in multiple places.
Dead Code
Code that is never executed or whose result is never used.
Magic Numbers
Hard-coded numeric literals instead of named constants.
Message Chaining
A series of method calls chained together, violating the Law of Demeter.
Primitive Obsession
Overusing primitive data types instead of creating small objects.
Data Clumps
Groups of variables that are always passed together and should be encapsulated in an object.
Technical Debt
Accumulation of code smells and shortcuts ignored over time.
Single Responsibility Principle (SRP)
A class should have only ONE reason to change.
Liskov Substitution Principle (LSP)
Subtypes must be substitutable for their base types without breaking behavior.
Interface Segregation Principle (ISP)
Clients should not be forced to depend on interfaces they do not use.
Dependency Inversion Principle (DIP)
High-level modules should not depend on low-level modules; both should depend on abstractions.
High Cohesion
The degree to which the responsibilities of a class are related or focused.
Low Coupling
The degree to which classes are independent; changes in one do not affect others.