https://github.com/emilybache/Theatrical-Players-Refactoring-Kata
Example from first chapter of 'Refactoring' by Martin Fowler, with tests and translations
https://github.com/emilybache/Theatrical-Players-Refactoring-Kata
Last synced: 4 months ago
JSON representation
Example from first chapter of 'Refactoring' by Martin Fowler, with tests and translations
- Host: GitHub
- URL: https://github.com/emilybache/Theatrical-Players-Refactoring-Kata
- Owner: emilybache
- License: mit
- Created: 2019-08-07T06:06:03.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-16T06:09:57.000Z (7 months ago)
- Last Synced: 2024-12-03T15:48:18.021Z (4 months ago)
- Language: Pascal
- Homepage: https://youtu.be/TjIrKEaOiVw
- Size: 624 KB
- Stars: 201
- Watchers: 5
- Forks: 212
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: license.txt
Awesome Lists containing this project
- jimsghstars - emilybache/Theatrical-Players-Refactoring-Kata - Example from first chapter of 'Refactoring' by Martin Fowler, with tests and translations (Pascal)
README
_Support this and all my katas via [Patreon](https://www.patreon.com/EmilyBache)_
Theatrical Players Refactoring Kata
====================================The first chapter of ['Refactoring' by Martin Fowler, 2nd Edition](https://www.thoughtworks.com/books/refactoring2) contains a worked example of this exercise, in javascript. That chapter is available to download for free. This repo contains the starting point for this exercise in several languages, with tests, so you can try it out for yourself.
I made a video ["Refactoring with Martin Fowler | Theatrical Players Code Kata"](https://youtu.be/TjIrKEaOiVw) that explains a little bit about the exercise and why you should give it a try.
What you need to change
-----------------------
Refactoring is usually driven by a need to make changes. In the book, Fowler adds code to print the statement as HTML in addition to the existing plain text version. He also mentions that the theatrical players want to add new kinds of plays to their repertoire, for example history and pastoral.Automated tests
---------------
In his book Fowler mentions that the first step in refactoring is always the same - to ensure you have a solid set of tests for that section of code. However, Fowler did not include the test code for this example in his book. I have used an [Approval testing](https://medium.com/97-things/approval-testing-33946cde4aa8) approach and added some tests. I find Approval testing to be a powerful technique for rapidly getting existing code under test and to support refactoring. You should review these tests and make sure you understand what they cover and what kinds of refactoring mistakes they would expect to find.Acknowledgements
----------------
Thankyou to Martin Fowler for kindly giving permission to use his code.