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

Re: [XP] Test Objectives (was: Re: Unit Test Challenge II)

Expand Messages
  • Ron Jeffries
    ... Yes. Used well, and tested well, they do that. When the code that uses ours doesn t expect the exceptions the assertions throw, sometimes very bad things
    Message 1 of 263 , Apr 1 2:37 AM
    • 0 Attachment
      Around Sunday, March 31, 2002, 11:44:55 PM, Laurent Bossavit wrote:

      >> In production, if things are out of whack, we need to blow out pretty
      >> quickly. Assertions /might/ help with that.

      > They do help with that. And they make things blow in the way *we*
      > have predicted, not any which way. Kind of like the teams which blow
      > up buildings, who weaken supports in strategic locations to make sure
      > the buildings crumple up just so, rather than spreading themselves
      > all over innocent bystanders.

      Yes. Used well, and tested well, they do that. When the code that uses
      ours doesn't expect the exceptions the assertions throw, sometimes
      very bad things happen. No doubt assertions add some goodness. They
      also have some cost. I'd wager that most people here don't use them.
      In fact, Laurent, I wasn't aware that you use them. Maybe we would
      profit from an Assertions discussion.

      Ron Jeffries
      www.XProgramming.com
      XP says: Don't just sit on your DUF, do something. Get some feedback.
    • Ilja Preuß
      ... I don t write many asserts or comments, but *I* would most often prefer asserts before comments because - I always first look at the code if I want to know
      Message 263 of 263 , Apr 6 12:24 AM
      • 0 Attachment
        > Why don't you replace the asserts with comments?

        I don't write many asserts or comments, but *I* would most often prefer
        asserts before comments because

        - I always first look at the code if I want to know what it does. If a
        precondition is significant enough to be written down, it is probably
        significant enough to be spotted early.

        - I most often find it easier to articulate something about code *in*
        code than in natural language.

        - I think if I *don't* find it easy to articulate a significant concept
        about the code in code, that tells me something about the design.

        - Even if I find it easy to articulate an assertion, writing it down
        might nevertheless tell me something about the design I didn't smell
        before.

        - I almost always find it easier to understand code than to understand
        natural language.

        - I am more likely to forget adjusting a comment to changing code than
        adjusting an assert.

        - I think it is easier to refactor an assertion than to refactor a
        comment

        - I simply hate writing comments, whereas I love writing code! ;-)

        There are probably more reasons...

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