Skip to main content

Posts

Showing posts from January, 2016

What if we taught Testing First?

I was thinking about how people are taught to program. It seems to me that most of the time, people are taught by quickly creating something. Its a "Hello World" app, or a quick Web page to display something. The idea is that you get to create something quick and easy and experience the thrill that comes along with that. From there you start digging into more complex concepts and with experience you learn how to do everything.

What if we changed that to writing a test first? What if we used the TDD process of red -> green -> refactor to teach? The code required to write a test would be very simple. A single line for setup, the assembly step of a test. A single line for the system to do work, the act step of the test. Then a single line to prove the work did what was expected, the assert step.

[Test] function GivenInputOfHelloWorld_Always_ReturnOutputOfHelloWorld(){     var input = "Hello World";        var result = Target.Process(input);        Assert.AreEqu…