Skip to content

Instantly share code, notes, and snippets.

@victorclee
Last active June 28, 2017 14:31
Show Gist options
  • Save victorclee/02abfa136413919a84c72fdeea7c742c to your computer and use it in GitHub Desktop.
Save victorclee/02abfa136413919a84c72fdeea7c742c to your computer and use it in GitHub Desktop.
Test Driven Development

TIL - Things I Learned - Tuesday 06/27/2017

Test Driven Development

TDD can help you write cleaner code, and help you code DRYer.

Cycle of TDD:

  1. Write a test that fails (a red test)
  2. Make the code work (runs green)
  3. Refactor. Eliminate redundancy (purple)
    and repeat the cycle.

Why TDD?

  1. Ensures that your test is written correctly.
  2. Ensures that you actually write tests for all of your code.
  3. Leads to better design.

The TDD Debate

Some people thinks this is the worst way to write code:
Martin Fowler
https://martinfowler.com/articles/is-tdd-dead/
dhh
http://david.heinemeierhansson.com/2014/tdd-is-dead-long-live-testing.html

TDD is a good tool, but maybe not necessary to run a department.

Write a Fizzbuzz app and test it!

https://en.wikipedia.org/wiki/Fizz_buzz

Useful resource

https://www.codecademy.com/courses/ruby-beginner-en-Zjd2y/0/1
https://www.amazon.com/Refactoring-Ruby-Addison-Wesley-Professional/dp/0321984137

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment