Skip to content

A kata involving noisy animals designed for practice in improving code

Notifications You must be signed in to change notification settings

thoughtbot/noisy-animals-kata

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Noisy Animals Kata

Install noisy animals:

bundle install

Then see the tests demonstrate how noisy the animals are:

bundle exec rspec

The exercise

This small exercise is designed to help thinking about and improve code.

The NoisyAnimal class has some poor code in it. Can you spot and fix some problems?

New requirements are so great!

When/If you're feeling comfortable with the code, try adding these animals:

  • A snake that makes the noise "hiss" when it is loud and "slither" when it is not loud
  • A mouse that is so silent that it outputs only one blank line, whether loud or quiet

Support the true or false values for the is_loud flag in both cases.

Don't forget the tests for your new requirements! Don't change any existing tests.

Self reflection before you start

  • What problems can you identify if you think for 5 minutes before you start changing code?
  • What sort of changes do you think will address these problems?

Self reflection after trying to make changes

  • Does your starting list of problems still feel complete?
  • If you rewrote the list now, would it be different? How and why?
  • Does your current assessment of the NoisyAnimal problems feel similar or different to other code you read or work with?
  • Have you found yourself trying something and then realising it wouldn't work? How easy was it to get back to something that did work?
  • Do you make git commits as you make your changes?
  • How often do you run the tests? What if you could only run them once every 10 minutes? Or 30 minutes?
  • What would it take to run the tests every time you changed a line of noisy_animal.rb?
  • Is it easier to add the new animals before or after addressing some of the problems?

About

A kata involving noisy animals designed for practice in improving code

Resources

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages