Refactoring Exercises
Refactoring a Method
A class called
Group
has a method called GetUsers()
. Below are three versions of that method.
Please drag and drop the versions such that the best is on top, the 2nd best beneath it, and the worst is at the bottom.
- Before you finish ordering, you can press the Show Hint button to reveal how many of your answers are right/wrong without specifying which are in the right/wrong position. Remember, you can continue to order items after hitting this button.
- After you finish ordering, you can press the Check Answers button to see author commentary, as well as a green border for items in the right position and a red border for items in the wrong position.
(Reading...)
Formatting Hints:
To format... | use this markup: |
---|---|
source code | {source:lang=java|lineNumbers=false}...{source} (Supported languages: java, cpp, csharp, c, python.) |
bold text | __some text__ |
italicized text | ~~some text~~ |
underlined text | @@some text@@ |
a method or class name | ``myMethod(...)`` |