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

Re: [XP] Give simple design a chance - old code never dies

Expand Messages
  • Curtis Cooley
    ... If I take code out and tests break it was necessary. Otherwise it was unnecessary. If I take code out and no tests break and your code breaks then write
    Message 1 of 15 , Jul 1 1:08 PM
      On Tue, 2003-07-01 at 12:05, Jeff Grigg wrote:
      > > Bill Wake wrote:
      > >> 6. Guessing wrong is not necessarily a wash: if you
      > >> generalize wrong, you may make the later change even
      > >> more expensive than it would have been. (So, you may
      > >> have to rip out the generalized but wrong solution,
      > >> returning to the simple design, and then generalize
      > >> it in the way "reality" requires.)
      >
      > --- Steve Berczuk <berczuk@a...> wrote:
      > > Another factor that people who distrust YAGNI is fear
      > > that once code is in the system it will /never/ go away.
      > > [...] If this is the place a person is coming from, its
      > > easy to see why a 'more general' solution seems like a
      > > safer bet. Of course, the problem isn't lack of generality,
      > > it's lack of ability to keep the code base 'alive.'
      > >
      > > Maybe the trick is to convice a non-believer in YAGNI that
      > > code will change over time when needed?
      >
      > Old code never dies. It never goes away. Revoking existing
      > functionality can be a remarkably difficult and dangerous thing to
      > do: It can be somewhere between "difficult" and "impossible" to
      > determine if someone has come to rely on the "unnecessary" extra
      > functionality or generality. This means that once you put
      > inappropriate generality in, you may never be able to take it out.
      > Your only choice then is to add generality on top of generality,
      > multiplying the complexity.
      >
      > So premature generality can be a remarkably *unsafe* bet!

      If I take code out and tests break it was necessary. Otherwise it was
      unnecessary.

      If I take code out and no tests break and your code breaks then write
      tests next time.

      Kent once said something like "you know your project has reached a good
      state when you are adding functionality while reducing lines of code." I
      don't know how you could achieve such a state unless you were removing
      more code than your new functionality required.

      --
      ======================
      Curtis R Cooley
      RADSoft
      Better software faster
      curtis@...
      ----------------------
      Alcazar: "Leela, this must all be very confusing."
      Leela: "A little. That's why I've decided to hurt you until you explain it."
    • Jeff Grigg
      ... Correct. To safely remove unnecessary generality or functionality, you must test all functionality that might have used it after making the change. But if
      Message 2 of 15 , Jul 1 2:27 PM
        >>> Bill Wake wrote:
        >>>> [...] you may have to rip out the generalized but wrong
        >>>> solution, returning to the simple design, and then
        >>>> generalize it in the way "reality" requires.)

        >> --- Steve Berczuk <berczuk@a...> wrote:
        >>> Another factor that people who distrust YAGNI is fear
        >>> that once code is in the system it will /never/ go away.
        >>> [...] If this is the place a person is coming from, its
        >>> easy to see why a 'more general' solution seems like a
        >>> safer bet. [...]

        > On Tue, 2003-07-01 at 12:05, Jeff Grigg wrote:
        >> Old code never dies. It never goes away. Revoking existing
        >> functionality can be a remarkably difficult and dangerous
        >> thing to do: [...]
        >>
        >> So premature generality can be a remarkably *unsafe* bet!

        --- Curtis Cooley <curtis@r...> wrote:
        > If I take code out and tests break it was necessary. Otherwise
        > it was unnecessary.
        > If I take code out and no tests break and your code breaks
        > then write tests next time.

        Correct. To safely remove unnecessary generality or functionality,
        you must test all functionality that might have used it after making
        the change.

        But if you're not using Test Driven Development (TDD),
        then "retesting everything" quickly becomes practically impossible.
        _ _ _

        So we end up with a remarkable irony:

        If you're doing TDD, then removing unwanted generality and
        functionality is much easier and safer than if you're not.

        But if you're *NOT* doing YAGNI, then you're probably not doing TDD,
        so throwing a bunch of additional functionality and generality in can
        be *VERY* risky if it may turn out that you don't need it. So
        what "seems like a safe bet" turns out just the opposite if the
        additional generality or functionality is not needed.
      • Curtis Cooley
        ... Actually, if you are doing TDD then removing unwanted generality is impossible since you can t remove what you can t find : D -- ======================
        Message 3 of 15 , Jul 1 2:36 PM
          On Tue, 2003-07-01 at 14:27, Jeff Grigg wrote:
          > >>> Bill Wake wrote:
          > >>>> [...] you may have to rip out the generalized but wrong
          > >>>> solution, returning to the simple design, and then
          > >>>> generalize it in the way "reality" requires.)
          >
          > >> --- Steve Berczuk <berczuk@a...> wrote:
          > >>> Another factor that people who distrust YAGNI is fear
          > >>> that once code is in the system it will /never/ go away.
          > >>> [...] If this is the place a person is coming from, its
          > >>> easy to see why a 'more general' solution seems like a
          > >>> safer bet. [...]
          >
          > > On Tue, 2003-07-01 at 12:05, Jeff Grigg wrote:
          > >> Old code never dies. It never goes away. Revoking existing
          > >> functionality can be a remarkably difficult and dangerous
          > >> thing to do: [...]
          > >>
          > >> So premature generality can be a remarkably *unsafe* bet!
          >
          > --- Curtis Cooley <curtis@r...> wrote:
          > > If I take code out and tests break it was necessary. Otherwise
          > > it was unnecessary.
          > > If I take code out and no tests break and your code breaks
          > > then write tests next time.
          >
          > Correct. To safely remove unnecessary generality or functionality,
          > you must test all functionality that might have used it after making
          > the change.
          >
          > But if you're not using Test Driven Development (TDD),
          > then "retesting everything" quickly becomes practically impossible.
          > _ _ _
          >
          > So we end up with a remarkable irony:
          >
          > If you're doing TDD, then removing unwanted generality and
          > functionality is much easier and safer than if you're not.

          Actually, if you are doing TDD then removing unwanted generality is
          impossible since you can't remove what you can't find :>D

          --
          ======================
          Curtis R Cooley
          RADSoft
          Better software faster
          curtis@...
          ----------------------
          Dr. Zoidberg: "Okay, so you're nonchalant, stop rubbing our noses in it.
        • Steve Berczuk
          ... I agree with you, but my point was that the old code never dies can cut both ways. Sometime people think: If I implement it this way NOW, it will never
          Message 4 of 15 , Jul 8 6:29 AM
            Jeff Grigg wrote:

            > --- Steve Berczuk <berczuk@a...> wrote:
            >>Maybe the trick is to convice a non-believer in YAGNI that
            >>code will change over time when needed?
            >
            >
            > Old code never dies. It never goes away. Revoking existing
            > functionality can be a remarkably difficult and dangerous thing to
            > do: It can be somewhere between "difficult" and "impossible" to
            > determine if someone has come to rely on the "unnecessary" extra
            > functionality or generality. This means that once you put
            > inappropriate generality in, you may never be able to take it out.
            > Your only choice then is to add generality on top of generality,
            > multiplying the complexity.
            >
            > So premature generality can be a remarkably *unsafe* bet!

            I agree with you, but my point was that the 'old code never dies' can
            cut both ways. Sometime people think: "If I implement it this way NOW,
            it will never change, do I should do the most general thing..."

            Thinking about it, it seems that YAGNI and "Old Code Never Dies" (OCND?
            :) ) conflict with each other...

            -steve


            --
            Steve Berczuk | steve@... | http://www.berczuk.com
            SCM Patterns: Effective Teamwork, Practical Integration
            www.scmpatterns.com
          Your message has been successfully submitted and would be delivered to recipients shortly.