Practise naming code smells: long method, feature envy, shotgun surgery, primitive obsession, and the refactorings that address them.
0 / 10 completed
1 / 10
A function that does too much and spans hundreds of lines is a ___ smell.
The long method smell is usually fixed by Extract Method, splitting it into smaller, well-named functions.
2 / 10
A method that uses another class's data more than its own exhibits ___.
Feature envy suggests the logic belongs in the other class; Move Method relocates it to where the data lives.
3 / 10
When one small change forces edits across many classes, that's ___.
Shotgun surgery means a concern is scattered; consolidating it (Move/Inline) so changes happen in one place addresses the smell.
4 / 10
Using a raw string or int where a small dedicated type would be clearer is ___.
Primitive obsession is fixed by introducing a value object (e.g. a Money type) that carries meaning and validation.
5 / 10
Repeated identical blocks of logic are the ___ smell.
Duplicated code is resolved by Extract Method/Function so the logic lives once and changes propagate everywhere automatically.
6 / 10
During a code review of Sarah's new payment processing module, Mark comments: 'This function handles both successful transactions and error handling. It's getting quite long – over 200 lines!'. What code smell does this primarily indicate?
Mark's observation about the function's length and handling of multiple responsibilities points to the 'Long Method' code smell. This suggests the function is trying to do too much and should be broken down into smaller, more manageable units. The other options – Data Clumps, Primitive Obsession, and Switch Statements – address different aspects of code quality but aren't directly related to a single, excessively long method.
7 / 10
You receive the following Slack message from David regarding a recent change he made: 'I needed to access the user's address information to update their profile. I just grabbed the data directly from the User class; it seemed the simplest approach.' What code smell does this situation suggest?
David's action of directly accessing data from another class (User) without considering its own responsibilities highlights the 'Divergent Change' code smell. This means changes to one class are unintentionally affecting other classes that depend on it, leading to a fragile and difficult-to-maintain system. The other options represent different smells related to design flaws, but divergent change is specifically triggered by this scenario.
8 / 10
In a PR description for a new feature, Alex writes: 'I've refactored the authentication service to use an HTTP request. It's more efficient than the previous method.' What potential code smell is being introduced here?
Alex's description suggests 'Inappropriate Intimacy,' which occurs when a class uses the internal details of another class excessively. By focusing solely on HTTP requests and not considering how it interacts with the authentication service's core logic or data structures, he creates a tightly coupled dependency – a key indicator of this smell. The other options relate to different design issues but aren't directly tied to overly close coupling.
9 / 10
During a standup meeting, John says: 'I've been using a raw string literal to represent the API endpoint URL. It was much simpler than creating a dedicated String class for this purpose.' What code smell does this scenario indicate?
John's choice of using a raw string literal instead of a dedicated String class exemplifies 'Primitive Obsession.' This smell occurs when a language's primitive data types are used to represent domain concepts that should have their own classes. Using a raw string for an API endpoint is a clear case of this, as it lacks encapsulation and makes the code less maintainable. Refactoring and Code Duplication relate to different concerns.
10 / 10
A senior developer notices that several modules in a legacy system repeatedly implement similar logic for validating user input. What code smell is most likely present?
The repeated implementation of identical input validation logic strongly suggests the 'Shotgun Surgery' code smell. This indicates that the same functionality is scattered across multiple modules – a sign of poor design and potential duplication. Symptoms of Latent Coupling and Message Chains deal with different types of coupling issues, while Data Clumps represents data being grouped together inappropriately.
What will I practice in "Code Smell Identification Language"?
This is a Refactoring Language exercise set. It walks through 10 scenario-based multiple-choice questions built around real usage of refactoring language terminology that IT professionals encounter on the job.
Is this exercise free to use?
Yes. Every exercise on CoderSlingo, including this one, is free to complete with no account, sign-up, or paywall.
How many questions are in this exercise?
This set contains 10 questions. Each one shows immediate feedback and a detailed explanation after you answer, so you learn the correct usage right away rather than waiting for a final score.
Do I need prior experience to complete this exercise?
No prior experience is required. Each question includes a full explanation covering the reasoning behind the correct answer, so the exercise itself teaches the refactoring language vocabulary as you go.
Can I retry the exercise if I get questions wrong?
Yes — use the "Try again" button on the results screen to reset your answers and go through all the questions again. There is no limit on attempts.
Is my progress saved?
Your answers and score for the current session are tracked in the browser as you go. No account or login is needed, and there is nothing to install.
What if I don't understand a term used in a question?
Read the explanation shown after you answer each question — it breaks down the correct term in plain English with a real-world example. You can also check the site Glossary for quick definitions.
How is this different from reading a blog article on the topic?
Exercises like this one are interactive drills that test and reinforce specific vocabulary through multiple-choice questions, while blog articles explain concepts in prose. Practising here after reading builds active recall, not just passive recognition.
Where can I find more Refactoring Language exercises?
See the Refactoring Language exercises hub for the full set of related pages, or browse all exercise categories from the main Exercises index.
Can I use this exercise to prepare for a technical interview?
Yes — refactoring language vocabulary comes up often in technical discussions and interviews. Pair this exercise with our dedicated Interview Preparation section for role-specific practice.