2011-01-08

Let's Code Dimdwarf #30: Thoughts on YAGNI

Support for multiple clients has now been implemented. When making this system, initially I made it work on just one client, because I knew that adding features later to a simple codebase is easy and then your understanding of the problem will be better. It took only a bit over 4 hours to add support for more than one client - surely not much longer than if I had built it in already in the beginning.

Download as MP4

Episode Archive

2 comments:

  1. When the test have responses as a Set instead of aList, doesn't that hide any possible duplicates? Keep the responses as a List and assert that the list does not contain duplicates.

    FestAssert syntax would be
    assertThat(responses).contains(1, 2, 3, 4).doesNotHaveDuplicates();

    Then again, I do not know Scala, but still find your vidoes very interesting!

    ReplyDelete
  2. Yes, you're right. It was bad of me to ignore the order in which the events were processed, especially in a way which makes the test so relaxed. And anyways my design principle is to make this system as deterministic as possible, so maintaining FIFO order should be the default option.

    I realized it after I had recorded this episode and fixed it off-camera. The issue was that I was using Scala's List and new items are always added to the beginning of a List, so you need to remember to reverse it. I fixed it by using Buffer and Seq which are similar to Java's List: https://github.com/orfjackal/dimdwarf/commit/876ca3024717384c06d77bd708aeccebba149b28

    ReplyDelete