Nhu Nguyen преди 6 години
ревизия
496691c9d6
променени са 2 файла, в които са добавени 56 реда и са изтрити 0 реда
  1. 53
    0
      README.MD
  2. 3
    0
      package.bluej

+ 53
- 0
README.MD Целия файл

@@ -0,0 +1,53 @@
1
+## Objectives
2
+
3
+1. Understand test driven development process
4
+
5
+# What is Test Driven Development?
6
+
7
+Test Driven Development, or TDD, is a method for approaching a problem not through the implementation of the solution, but rather, through the expectations of a working solution. What that means is, instead of trying to write the code that solves the problem, you first define what the working code will do when it works, and then you write the implementation to make it work.
8
+
9
+# Test Driving FizzBuzz
10
+
11
+A classic programming problem is [FizzBuzz](http://c2.com/cgi/wiki?FizzBuzzTest). It is considered the [Stairway to Heaven](http://www.codinghorror.com/blog/2007/02/fizzbuzz-the-programmers-stairway-to-heaven.html) of programming because there are so many different ways to play it and everyone plays it.
12
+
13
+The goal of FizzBuzz is to build a program that can take a number:
14
+- if the number is evenly divisible by 3, it should return "Fizz"
15
+- if it's divisible by 5, it should return "Buzz"
16
+- if it's divisible by both 3 and 5, it should return "FizzBuzz"
17
+- otherwise it should print the number
18
+
19
+## Defining Our Expectations
20
+
21
+Let's approach solving this problem from a TDD approach. That means that we don't care about "how", but rather, we care about "what". What should the program do if it works correctly, not how it does it. We are going to write our expectations first, then our implementation.
22
+
23
+Before we look at the RSpec syntax, let's just express our tests in plain English (also sometimes referred to as "pseudo-code").
24
+
25
+1. We expect FizzBuzz.of(3) to return "Fizz"
26
+2. We expect FizzBuzz.of(5) to return "Buzz"
27
+3. We expect FizzBuzz.of(15) to return "FizzBuzz"
28
+4. Anything else will return the number FizzBuzz.of(2) returns "2"
29
+
30
+We don't care how that `#fizzbuzz` method works, nor how it's defined, *we are just stating our expectations*. And we're doing that first. When coding, it's important to have a target to shoot for; by writing your test first and stating your expectations of your code, you know your goal. You get to use your entire brain to think about just your goals, not how you'll get there, which adds clarity and focus to the problem.
31
+
32
+> The competent programmer is fully aware of the strictly limited size of his own skull; therefore he approaches the programming task in full humility.
33
+>
34
+> — <cite>Edsger W. Dijkstra</cite>
35
+
36
+Test-Driven Development allows us to fully utilize our mental capacity to clearly state the problem we're solving and then to 100% focus on implementing a solution. When you are just coding, you're actually focusing on stating the problem and the solution at the same time. You are thereby splitting your thinking in two, making you less effective at both.
37
+
38
+> It's the exact same reason you make a todo list. Also testing is not for present you, it's for future you.
39
+>
40
+> — <cite>Joe M Burgess</cite>
41
+
42
+# Instruction
43
+Given a number, your method should return a string:
44
+- Fizz if it's divisible by 3
45
+- Buzz if it's divisible by 5
46
+- FizzBuzz if it's divisible by 15
47
+- the number otherwise
48
+
49
+## Todo
50
+1. For this repo
51
+2. Clone your fork
52
+3. Solve the problem using TDD
53
+4. Create a pull request

+ 3
- 0
package.bluej Целия файл

@@ -0,0 +1,3 @@
1
+#BlueJ package file
2
+#Thu May 31 13:04:16 EDT 2018
3
+project.charset=UTF-8