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
Views #: 6
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

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

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

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

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

Correct Answer

Explanation

Refactoring 'Bad Smells'

1 pts

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

To complete the line match

  1. Click on an item in the first group
  2. Click on the match in the second group

To delete a match, double click on a line

Bad smell

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

Description

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

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

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

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

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

Correct Answer

Explanation

Reengineering vs. Refactoring - Key Difference

1 pts

Match each statement to whether it describes reengineering or refactoring.

drag and drop the selected option to the right place

note_alt Add notes
flag Flag

Correct Answer

Explanation