/Trivia_Python_Refactored

This is my refactoring of the Python version of the Trivia legacy code application by @jbrains (github.com/jbrains/trivia)

This is my refactoring of the Trivia legacy code application provided by J.B. Rainsberger (github.com/jbrains/trivia). The Trivia exercise is available in many different programming languages and provides a great example of legacy code upon which developers can practice their refactoring skills.

I have chosen to refactor the Python version of the exercise. trivia_original.py contains the original code provided by J.B. Rainsberger, except for a small refactoring to allow a random seed to be provided, an extra line of output to display the winner and a correction of the typo "corrent" to "correct". game_runner.py runs the refactored code through a game runner, so that its output can be compared to the original version when the same random seed is used. trivia_refactored.py provides my refactored version of the code. Tests have been written with unittest to ensure that the refactorings did not change the behaviour of the original code. The code is written in Python 2, so the mock library will need to be installed on the system.

This exercise was written as a coding problem at the monthly Python Sheffield user group of 26/03/13. For more information, follow @pysheff on Twitter or see the Google group groups.google.com/group/python-sheffield.