Loading ...
Sorry, an error occurred while loading the content.

Re: YAGDI You Are Gonna Debug It.

Expand Messages
  • p_jayadeep
    But IMO, your need for debugging goes down drastically for a code that is developed with unit tests, may be the log messages that you write are the ones that
    Message 1 of 31 , Jul 5 8:02 PM
    • 0 Attachment
      But IMO, your need for debugging goes down drastically for a code that is developed with unit tests, may be the log messages that you write are the ones that you need to verify with a unit test. That way you don't need to manually inspect the errors, but the failing Unit Tests give you an immediate feedback!

      Jayadeep

      --- In extremeprogramming@yahoogroups.com, John Carter <john.carter@...> wrote:
      >
      > Here's a thought for ye Agile folk.
      >
      > We've had YAGNI, You're Ain't Gonna Need It, as a tool to reduce the
      > weight of code that slows our ability to change, to be agile.
      >
      > Here's another.
      >
      > YAGDI You Are Gonna Debug It.
      >
      > You may be perfectly Test Driven, you may have a perfect suite of unit
      > tests...
      >
      > But if all those tests give you is "it failed", the first thing you
      > are going to do is scrabble around for more information.
      >
      > So design your code, write your tests to expose enough information,
      > write KNOWING YOU WILL BE DEBUGGING THIS CODE.
      >
      > 'Cause the simple fact is you will be debugging that code. Probably
      > now, maybe next year, and certainly if, being agile, you ever change
      > it.
      >
      > Often I merely need to look at either my log trace or my unit test
      > output and I know what the fault is.
      >
      > My next step is to add an assertion either in the test, or the code
      > that will prove that I know what the bug is.
      >
      > Then I fix it.
      >
      > If I can't immediately tell where the bug is, I alter the design to
      > expose in the error messages, the log traces, the reports, the reasons
      > it behaved as it did.
      >
      > Think of it as a story, a narrative. The person who cares should be
      > able to read the narrative of the systems behaviour.
      >
      > The user who doesn't care, should just be told which log file to email
      > to support.
      >
      >
      >
      > John Carter
      >
    • Adam Sroka
      ... To my mind, YAGNI says that if I don t need it now I might as well assume that I will never need it. One of the main advantages of mocks is that they allow
      Message 31 of 31 , Jul 20 7:22 PM
      • 0 Attachment
        On Mon, Jul 20, 2009 at 10:09 PM, Jeff Grigg<jeffgrigg@...> wrote:
        >
        >
        >>> --- kentb<kentb@...> wrote:
        >>>> I have almost no use for mocks. I think it's because
        >>>> I tend to write in a functional style.
        >
        >> --- Bill Caputo<list-subscriber@...> wrote:
        >>> I find myself faking/mocking in just three areas:
        >>> 1) Non-deterministic stuff (e.g. random number generators, dates)
        >>> 2) far-side of boundary stuff (e.g. databases, system calls, etc)
        >>> 3) complicated stuff that I don't want to write yet.
        >
        > --- Adam Sroka <adam.sroka@...> wrote:
        >> If we take YAGNI to it's logical extreme, don't most things
        >> reduce to #3?
        >
        > No, I don't think so. I use mocks for "nasty external things that are
        > difficult to control or test." So that would be #1 and #2 above. As for #3,
        > I just write it. It's needed to make the system work. It's needed to make
        > the functionality I'm working on right now work. Why wouldn't I write it
        > now?
        >

        To my mind, YAGNI says that if I don't need it now I might as well
        assume that I will never need it.

        One of the main advantages of mocks is that they allow me to speculate
        about the interface while deferring decisions about the
        implementation. Is it possible that I could know what message I need
        to send without knowing what the receiver should do in response?
        Because, if there is ever a time that that is true then using a mock
        makes sense.
      Your message has been successfully submitted and would be delivered to recipients shortly.