volume_mute
Primitive Refactoring Transformations
publish date: 2026/06/24 21:27:38.143302 UTC
volume_mute
Which of the following are examples of primitive refactoring transformations that can be used singly or together to address bad smells? Select all that apply.
Correct Answer
(1) Extract method - removing duplication by creating a new shared method
(2) Consolidate conditional expression - replacing a sequence of tests with a single test
(3) Pull up method - replacing similar methods in subclasses with one method in a superclass
Explanation
Primitive refactoring transformations include: Extract method (removing duplication by creating a shared method); Consolidate conditional expression (replacing multiple tests with one); and Pull up method (replacing similar subclass methods with a single superclass method). These transformations can be combined to address specific bad smells.
Reference
Software Engineering, Ian Sommerville, 10th edition
