CS 222 Spring 2016
Refactoring Challenge
Due: March 9, Wednesday, 10:30 am.
Language: Java
Submission:
- Check your file encoding. It should be UTF-8
- Checkout the project inClass_refactoring from SVN to get started
- Commit your code to SVN at the end of the class
Assignment Explanation
We will do refactoring in this assignment. You will be given a code and refactor it as much as you can.
You will be responsible for all the topics we have covered in class about clean code:
- Names
- Functions
- Comments
- Format
- Code smells
Task
Read the code. I put an explanation comment at the beginning. Try to understand what each function does.
Run the code and see the output.
In a cycle refactor the code and run it to see if it still works as expected.
My advice to you:
- Renaming is the easiest start with renaming
- Focus on one method at a time. Keep you changes local as much as possible (i.e. Refactor only one method, even if it’s only renaming).
- Run the code frequently to see if the code is still works as expected
- Order your methods according to Format slides
- Make sure you have no redundant comments in the code
- Do not try to create classes or split the source code into two first. This is the last thing you should consider for this assignment.
Grading
- Code Quality (25)
- Names: 5
- Comments: 3
- Format: 7
- Functions: 10
Penalties:
- Submitting code that is not compiling: -10 points
- Submitting code that is not runnning correctly: -10 points
- Submitting code not with SVN: -5 points
- Not being present in the class but submitting the assignment: -25 points