Welcome to Duncan White's Practical Software Development (PSD) Pages.

I'm Duncan White, an experienced and professional programmer, and have been programming for well over 20 years, mainly in C and Perl, although I know many other languages. In that time, despite my best intentions:-), I just can't help learning a thing or two about the practical matters of designing, programming, testing, debugging, running projects etc. Back in 2007, I thought I'd start writing an occasional series of articles, book reviews, more general thoughts etc, all focussing on software development without all the guff.

See all my Practical Software Development (PSD) Pages

picture of D. White

Testing and Development part 2

Worked Example of TDD - the Stack

Developing the Stack module the TDD Way

TDD Phase I: The Stub Stack

TDD Phase II: Choose stack type and make test1 pass!

TDD Phase III: Get Test2 Working

Phew! Let's take stock!

We've now developed a stack module that can successively pass our first two test cases (test1 and test2). Test2 ends up having pushed a single integer onto a stack, leaving a non-empty depth 1 stack whose top value was the value we pushed.

In the Third Part of this article, we'll introduce more test cases and get them working via TDD.

Back to the first part of this article Back to PSD Top
Written: March-June 2013