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

RE: [XP] Re: Why do I test private methods?

Expand Messages
  • Robert Watkins
    ... It s not complete, though. Try adding (or removing) variables from the method... you tinker with the stack, and you blow things away. If you add or remove
    Message 1 of 88 , Oct 1, 2000
    • 0 Attachment
      Mark Wilden writes:
      > From: "Ron Jeffries" <ronjeffries@...>
      > > In what other debugger can you change any method on the execution stack
      > and
      > > resume?) ;->
      >
      > Microsoft Visual C++.

      It's not complete, though. Try adding (or removing) variables from the
      method... you tinker with the stack, and you blow things away. If you add or
      remove members (variables or methods) to a class, you're stuffed as well.
      And if you delete a method on your call stack, you're screwed. So MSVC++
      doesn't meet Ron's definition.

      About all you can do is tinker with the logic in the code. Handy, I admit,
      and a darn sight better than nothing, but far from complete.

      (That said, I like the "Edit-And-Continue" option. I wish I had it in my
      Java environment (though dynamic class loaders get around this to a degree))

      Robert.

      --
      /\\\ Robert Watkins | Email: robert.watkins@...
      ( ))) Software Engineer - Tech Dev | Ph: +61 7 3303 3432
      \/// MINCOM Ltd | Fax: +61 7 3303 3232
      Mincom

      This transmission is for the intended addressee only and is confidential
      information. If you have received this transmission in error, please
      delete it and notify the sender. The contents of this e-mail are the
      opinion of the writer only and are not endorsed by Mincom Limited unless
      expressly stated otherwise.
    • Ilja Preuß
      ... a) Writing the test you document what the private method is supposed to do. b) Writing the test you think about what the method is supposed to do. This way
      Message 88 of 88 , Oct 7, 2000
      • 0 Attachment
        > I've been convinced that
        > using a test of a
        > private method is "a way" of tracking down a bug revealed by a public
        > method, though I've also been convinced that simply using a
        > debugger would probably be faster.

        a) Writing the test you document what the private method is supposed to
        do.
        b) Writing the test you think about what the method is supposed to do.
        This way you may find a better design to refactor the code to.
        c) You may use the debugger to find the bug, then write a test to pin it
        down and convince yourself that you removed it *and* that it will never
        reoccur.


        ciao, Ilja
      Your message has been successfully submitted and would be delivered to recipients shortly.