TDD Problems

All problems‎ > ‎

Integer stack

Develop a class implementing the classic Stack datastructure containing integer values. That is, it should support the following operations:
  1. Push(value) - adds a value to top of the stack
  2. value Pop() - removes the top element of the stack and returns that value
  3. int Count() - returns the current number of elements contained in the stack
Comment by Jeff: Demonstrates technique well but solution is a bit too trivial, which can shortchange the value of TDD


Comments (3)

Olof Bjarnason - Sep 13, 2008 12:49 PM

Jeff@
Agreed but I think this site should have both easy and harder problems

Jeff Langr - Sep 25, 2008 7:56 AM

Hi Olaf--I agree, I don't think we should edit any of them out. My notion was to add notes on positive/negative experiences in using these as bases for TDD demos.

Olof Bjarnason - Sep 25, 2008 8:21 AM

aha. I see. this comment area is good to have. it would be even better if anonymous users (with moderation to avoid spam) would be possible..