Refactoring - Preventative Maintenance

Refactoring as continuous structural upkeep, its tie to agile methods, common "bad smells," and how it differs from reengineering

download Export
search_insights Statistics
stylus_note White Board
Quran
calculate Calculator
dictionary Dictionary
fullscreen Full Screen
QUESTION OF

volume_mute Read quiz aloud
Views #: 193
Questions #: 11
Time: 10 minutes
Pass Score: 80.0%
Style
Mode

Definition of Refactoring

1 pts
volume_mute

What is refactoring?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Refactoring as Preventative Maintenance

1 pts
volume_mute

Why can refactoring be thought of as 'preventative maintenance'?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Refactoring Is Not Limited to Object-Oriented Development

1 pts
volume_mute

True or False: Although refactoring is sometimes considered to be limited to object-oriented development, the underlying principles can in fact be applied to any development approach.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Refactoring and Agile Methods

1 pts
volume_mute

Why is refactoring described as an inherent part of agile methods?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Regression Testing and Refactoring Safety

1 pts
volume_mute

How does an emphasis on regression testing in agile methods help reduce the risk of refactoring?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Refactoring 'Bad Smells'

1 pts
volume_mute
To complete the line match
  1. Click on an item in the first group
  2. Click on an item in the second group
  3. To delete a match, double click on a line

Bad smell

Long methods
Switch (case) statements
Data clumping
Speculative generality
Duplicate code

Description

The same group of data items reoccurs in several places and could be replaced with an encapsulating object
Statements scattered around a program that depend on a value's type, often replaceable with polymorphism
Generality is included in a program in case it is needed in the future, but can usually simply be removed
The same or similar code appears in multiple places and could be extracted into a single reusable method
A method that is too long and should be redesigned as several shorter methods

Match each refactoring 'bad smell' to its correct description.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Polymorphism as a Refactoring Solution

1 pts
volume_mute

In object-oriented languages, what technique can often replace scattered switch (case) statements that depend on an object's type?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Primitive Refactoring Transformations

1 pts
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.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


IDE Support for Refactoring

1 pts
volume_mute

How do interactive development environments such as modern code editors typically support the refactoring process?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


When Code Cannot Simply Be Refactored

1 pts
volume_mute

What might be necessary if you take over a program for maintenance whose structure has been significantly degraded, beyond what simple code-level refactoring can fix?

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation


Reengineering vs. Refactoring - Key Difference

1 pts
volume_mute
Statement
×Takes place after a system has been maintained for some time and maintenance costs are increasing
×Uses automated tools to process a legacy system and create a new, more maintainable version
×Is intended to avoid the structure and code degradation that increases maintenance difficulty
×Is a continuous process of improvement throughout development and evolution
Reengineering
Refactoring

Match each statement to whether it describes reengineering or refactoring.

note_alt Add notes
flag Flag
volume_mute

Correct Answer

Explanation