What is a 'code smell' in software engineering vocabulary?
Code smell (term coined by Kent Beck, popularized by Martin Fowler's Refactoring) is a symptom in source code suggesting deeper structural problems. Smells are not bugs — the code may work correctly — but they make code harder to understand, maintain, and extend.
2 / 10
What is a 'long method' code smell?
Long Method is one of Fowler's most common smells. Methods should do one thing. A method exceeding 10–20 lines often does multiple things and should be decomposed using Extract Method. Long methods are harder to name accurately, test, reuse, and understand.
3 / 10
What is 'feature envy' as a code smell?
Feature Envy: a method in class A that mostly uses data from class B suggests the method belongs in class B. The fix is typically Move Method — move the method to the class whose data it is most interested in.
4 / 10
What is 'primitive obsession' as a code smell?
Primitive Obsession: using String for phone numbers, float for currency, int for status codes — when a class (PhoneNumber, Money, OrderStatus) would better express intent, enforce invariants, and enable domain-specific behavior. The fix is Replace Data Value with Object.
5 / 10
What is 'shotgun surgery' as a code smell?
Shotgun Surgery: a single change requires modifying many classes. This is the inverse of Divergent Change. It indicates related behavior is spread across the codebase instead of being concentrated. The fix is to use Move Method/Field to consolidate related behaviors into a single class.
6 / 10
John, the senior developer, left this comment on a PR:
"This method is getting quite long. Consider breaking it down into smaller, more focused functions to improve readability and testability. It's starting to feel like 'long method syndrome'."
'Long method syndrome' specifically refers to a code smell where a single function performs too many tasks. John's comment correctly identifies this issue and proposes a targeted solution: breaking down the method into smaller, more manageable pieces. The incorrect options misinterpret the nuance of the warning – it's not about general styling or frustration; it's about architectural concerns.
7 / 10
You're reviewing a PR for a new user authentication service. The developer has implemented all the required functionality within a single API endpoint. The API response is:
```json{
"status": "success",
"data": {
"user_id": 123,
"token": "abcdefg"
}
}
```
Which of the following best describes the code smell present in this design?
'Shotgun surgery' describes a code smell where multiple developers are making small changes to the same component (in this case, the API endpoint) for different purposes. This leads to increased complexity and potential conflicts. The other options misrepresent the core issue: it's not about duplicated functionality or using primitive data structures; it's about scattered modifications.
8 / 10
During a standup meeting, Maria explains her work on the new payment processing module:
"I've been handling all the logic for validating credit card numbers and communicating with the external payment gateway directly within this class. It's working well, but I'm worried about future changes – if we need to integrate with a different gateway, it will require significant modifications here."
'Primitive obsession' is a code smell where a developer becomes overly attached to a particular data type or external dependency, creating tight coupling and making future changes difficult. Maria's concern about changing gateways demonstrates this issue – she's tied the logic too closely to the payment gateway implementation. The other options are valid design goals but don't address the core problem.
9 / 10
You receive this Slack message from a junior developer:
'I've added a new function to handle all user profile updates. It checks if the user exists, validates the input data, and then updates the database record. It's working fine now.'
'God classes' are a common code smell where a single class attempts to handle multiple unrelated tasks. This leads to increased complexity and reduced maintainability. The junior developer's function does too much – validating input, checking for existence, *and* updating the database – violating this principle. DRY is about avoiding duplication, which is what this situation highlights.
10 / 10
You're reviewing a PR describing changes to the user notification service. The description reads: 'I added code to send email notifications when users update their profiles and also when they make purchases.'
What type of code smell is most likely present?
'Feature envy' occurs when a single class or module attempts to handle multiple distinct features or responsibilities. In this case, the developer is trying to manage both profile updates and purchase notifications within the same service. This creates complexity and makes it harder to maintain and extend the functionality – it's about spreading responsibility too thinly.
What will I practice in "Code Smells — Vocabulary and Identification"?
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.