Skip to content

Example from first chapter of 'Refactoring' by Martin Fowler, with tests and translations

License

Notifications You must be signed in to change notification settings

ciza99/Theatrical-Players-Refactoring-Kata

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

70 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Theatrical Players Refactoring Kata

The first chapter of 'Refactoring' by Martin Fowler, 2nd Edition 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. This repo was forked from https://github.com/emilybache/Theatrical-Players-Refactoring-Kata

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 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

Thank you to Martin Fowler for kindly giving permission to use his code. Thank you to Emily Bache for creation of this kata.

How to Practice the Kata in group/mob session by GIT push/pull handover

In the following steps one from the group will fork the repo, add collaborators, each of you clone the forked repo and you can start the Kata in common Mob session!

Fork this repository

Fork this repository by clicking on the fork button on the top of this page. This will create a copy of this repository in your account. image

Add collaborators

Go to your GitHub account, open the forked repository, click on the Settings menu item, click on the Manage access and then click the Invite a collaborator button. Add all the software craftsmen, who will collaborate on the Kata with you. image

Clone the repository

Clone the forked repository to your machine.

  1. Go to the GitHub account with the forked repository, open the forked repository, click on the code button and then click the copy to clipboard icon.
  2. Open a terminal and run the following git command: git clone "url you just copied", where "url you just copied" (without the quotation marks) is the url to this repository (your fork of this project).

For example: git clone https://github.com/this-is-you/first-contributions.git

image

Practice the Kata in common Mob session

  1. New driver pulls all the previous changes and start sharing his screen
  2. You enjoy the mobbing
  3. When limit is done, the last commit is created
  4. All commits are pushed to the common repository
  5. Drivers are switched and new driver starts with the point 1 (pull + sharing his screen)

Get feedback on your Mob session

  • get feedback on your code -> just create a Pull Request (or send a link to your public repo with all the changes) and contact us
  • get feedback on format of the session -> just contact us and describe, how we can help you

Contact info:

Best practices

  • Do as small as possible commits, so you can easily revert the changes if you go a wrong way anytime
  • Switch Driver regularly
  • I recommend to start with 7 minutes for switch a Driver (and experiment with that during the next session)
  • Experiment with navigators (e.g. just one can navigate or everybody navigates)
  • Have a fun and learn something new from others!

Do not hesitate to mention your activity and provide link on your code during job interview in YSoft!

About

Example from first chapter of 'Refactoring' by Martin Fowler, with tests and translations

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 20.4%
  • Go 15.0%
  • PHP 12.6%
  • Java 12.1%
  • C++ 9.7%
  • Swift 9.6%
  • Other 20.6%