volume_mute

Use Case - Recognizing a Bad Smell

publish date2026/06/24 21:38:19.030527 UTC

volume_mute

A code reviewer notices that a class accepts five separate parameters together as a group in nearly every method - an order ID, a customer ID, a timestamp, a region code, and a status flag - and this same group of five parameters appears together throughout the codebase. What refactoring opportunity does this represent?

Correct Answer

Data clumping, which could be addressed by encapsulating the group of related parameters into a single object

Explanation

This is a textbook example of the 'data clumping' bad smell, where the same group of data items reoccurs together in many places. The standard refactoring response is to encapsulate the related data items into a single object, simplifying method signatures and centralizing the related data's behavior.

Reference

Software Engineering, Ian Sommerville, 10th edition


Quizzes you can take where this question appears