Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/emilybache/Tennis-Refactoring-Kata
This is a Refactoring Kata based on the rules of Tennis
https://github.com/emilybache/Tennis-Refactoring-Kata
Last synced: 3 months ago
JSON representation
This is a Refactoring Kata based on the rules of Tennis
- Host: GitHub
- URL: https://github.com/emilybache/Tennis-Refactoring-Kata
- Owner: emilybache
- License: mit
- Created: 2013-06-10T12:36:08.000Z (over 11 years ago)
- Default Branch: main
- Last Pushed: 2024-06-23T08:25:32.000Z (5 months ago)
- Last Synced: 2024-06-26T11:35:19.650Z (5 months ago)
- Language: TypeScript
- Homepage: https://youtu.be/XifUs1FhWRc
- Size: 1.47 MB
- Stars: 671
- Watchers: 19
- Forks: 1,240
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
README
_Support this and all my katas via [Patreon](https://www.patreon.com/EmilyBache)_
# Tennis Refactoring Kata
You can find out more about this exercise and where it comes from in [this YouTube video](https://youtu.be/XifUs1FhWRc). There are also some Guided Learning Hour videos that include demos of me solving parts of it.
* [Refactoring: What you need to know](https://youtu.be/K7xSsNpeM8I) - includes demo of TennisGame3 in C#
* [Refactoring Skills: Extract Function](https://youtu.be/lOAktlPd8uk) - includes demo of TennisGame6 in C## The Scenario
Imagine you work for a consultancy company, and one of your colleagues has been doing some work for the Tennis Society. The contract is for 10 hours billable work, and your colleague has spent 8.5 hours working on it. Unfortunately he has now fallen ill. He says he has completed the work, and the tests all pass. Your boss has asked you to take over from him. She wants you to spend an hour or so on the code so she can bill the client for the full 10 hours. She instructs you to tidy up the code a little and perhaps make some notes so you can give your colleague some feedback on his chosen design. You should also prepare to talk to your boss about the value of this refactoring work, over and above the extra billable hours.
There are several versions of this refactoring kata, each with their own design smells and challenges. I suggest you start with the first one, with the class "TennisGame1". The test suite provided is fairly comprehensive, and fast to run. You should not need to change the tests, only run them often as you refactor.
There is a deliberate error in several of the implementations - the player names are hard-coded to "player1" and "player2". After you refactor, you may want to fix this problem and add suitable test cases to prove your fix works.
If you like this Kata, you may be interested in [my books](https://leanpub.com/u/emilybache) and website [SammanCoaching.org](https://sammancoaching.org)
## Kata Description
Here is a description of the problem this code is designed to solve: [Tennis Kata](https://sammancoaching.org/kata_descriptions/tennis.html).
## Questions to discuss afterwards
* How did it feel to work with such fast, comprehensive tests?
* Did you make mistakes while refactoring that were caught by the tests?
* If you used a tool to record your test runs, review it. Could you have taken smaller steps? Made fewer refactoring mistakes?
* Did you ever make any refactoring mistakes and then back out your changes? How did it feel to throw away code?
* What would you say to your colleague if they had written this code?
* What would you say to your boss about the value of this refactoring work? Was there more reason to do it over and above the extra billable hour or so?## Code Reading Practice
Test your code reading skills. Here is a description of what to do: [Scanning for Code Smells](https://sammancoaching.org/exercises/code_reading.html). There are suitable lists of urls to open in some of the language subdirectories.