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

RE: [XP] Re: Mocks: How to make sure they behave like the real thing

Expand Messages
  • Desilets, Alain
    ... Hum... I usually don t see a single argument to a single method is a sign that there is not enough separation of concern. It s certainly not a reason to
    Message 1 of 115 , Jun 1, 2007
    • 0 Attachment
      > > Then, I modify method ClassB.methodX(), to add a compulsory argument
      > to it: ClassB.methodX(newArgument). I change TestClassB
      > accordingly (i.e. I make it so that the tests pass
      > newArgument to ClassB.methodX), but I forget to do so for
      > ClassA and TestClassA. In other words, ClassA still invokes
      > ClassB.methodX as though it had no compulsory argument.
      > >
      >
      > [snipend]
      >
      > From what you are describing, there is some functionality
      > that is changing. Have you tried encapsulating what is
      > changing from ClassB.
      > Extract that varying functionality from ClassB. Usually when
      > I end up with a cascade effect like your describing it means
      > I don't have enough separation of concerns.

      Hum... I usually don't see a single argument to a single method is a sign that there is not enough separation of concern. It's certainly not a reason to create a new class.


      ----
      Alain Désilets, MASc
      Agent de recherches/Research Officer
      Institut de technologie de l'information du CNRC /
      NRC Institute for Information Technology

      alain.desilets@...
      Tél/Tel (613) 990-2813
      Facsimile/télécopieur: (613) 952-7151

      Conseil national de recherches Canada, M50, 1200 chemin Montréal,
      Ottawa (Ontario) K1A 0R6
      National Research Council Canada, M50, 1200 Montreal Rd., Ottawa, ON
      K1A 0R6

      Gouvernement du Canada | Government of Canada
    • J. B. Rainsberger
      ... I worked on one project trying to organize C code in an OO fashion using various pointer-related idioms I didn t entirely understand. This experience
      Message 115 of 115 , Jun 14, 2007
      • 0 Attachment
        George Dinwiddie wrote:

        > J. B. Rainsberger wrote:
        > > I would never use mocks on a C project; but of course, I would never
        > > work on a C project.
        >
        > I've certainly used fakes and stubs on C projects. In fact, the
        > practice lead me to heavy reliance on function pointers long before I
        > started using OO.

        I worked on one project trying to organize C code in an OO fashion using
        various pointer-related idioms I didn't entirely understand. This
        experience rather entrenched my distrust of C.
        --
        J. B. (Joe) Rainsberger :: http://www.jbrains.ca
        Your guide to software craftsmanship
        JUnit Recipes: Practical Methods for Programmer Testing
        2005 Gordon Pask Award for contribution Agile Software Practice
      Your message has been successfully submitted and would be delivered to recipients shortly.