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

Re: [XP] New Articles on XProgramming.com

Expand Messages
  • Ron Jeffries
    ... Interesting ... I guess I d like to see an example worked out, especially where the algorithm isn t entirely known in advance. For example I wonder how
    Message 1 of 20 , May 1, 2006
      On Sunday, April 30, 2006, at 9:34:29 PM, June Kim wrote:

      >> > Finally, I see some difference in your style of TDDing from me. I try
      >> > to remove duplications in tests and try to cut the cases as "aspects".
      >> > My analogy is "rice rolled in dried laver", as we call it in Korea
      >> > Kimbab. http://images.google.co.kr/images?q=kimbab&sa=N&tab=wi You
      >> > can slice a Kimbab roll into pieces with varying sizes but every piece
      >> > has rice, carrot, spinach, dried seaweed and all the same ingridients.
      >> > If you disassemble the roll instead, you can get all of the
      >> > ingridients separate. In the test cases of open, spare, and perfect,
      >> > each one is testing separating frames, scoring each frame, summing
      >> > frames, and etc. The problem is that when there is any need to change
      >> > the code, due to the permeated aspects across many test cases, the
      >> > tests could be fragile and you are forced to change many of them at
      >> > once. (Of course those tests are valuable as integration tests.) I
      >> > think many uniformal test cases are a smell. When test cases are
      >> > written in ingrideints tests(disassembly), those cases reads like the
      >> > rules(declarative) described in the original requirements.
      >>
      >> I would be delighted to see an example of that style of TDD, in a
      >> language I can understand such as Ruby, Java, C#. From the
      >> description, I'm not quite getting it.

      > Sorry for not being clear.

      > When you are tdding a fibonacci sequence generator, you could follow
      > the steps of:

      > assert fibo(0) == 1
      > assert fibo(1) == 1
      > assert fibo(2) == 2
      > assert fibo(3) == 3
      > assert fibo(4) == 5
      > assert fibo(5) == 8

      > each being its own test case. You could feel confident enough just
      > doing those sequences.

      > What I prefer is, following the original problem statement:

      > Fibonacci sequence is a sequence that starts from 1 1 and then add the
      > last two numbers to get next.

      > Now I would compose todo list as:
      > fibo starts from 1 1
      > add last two numbers
      > fibo expands with the result above
      > and etc

      > The former example(fibo(n) == m) is showing uniformal test cases and I
      > think there is a bad smell. For each test case, you see add last two
      > and expand the sequence and the start is 1 1, all intermingled.

      Interesting ... I guess I'd like to see an example worked out,
      especially where the algorithm isn't entirely known in advance. For
      example I wonder how you'd use your style in TDDing bowling in a
      conventional language ...

      Thanks for the conversation and the help with J. Very interesting!

      Ron Jeffries
      www.XProgramming.com
      A man hears what he wants to hear, and disregards the rest. -- Paul Simon
    • Anthony Williams
      ... I ve posted a C++ version to my blog: http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html At 75 lines vs 72, it s not much different to
      Message 2 of 20 , May 2, 2006
        Ron Jeffries <ronjeffries@...> writes:

        > Bowling Vectors
        > Ron Jeffries
        > 04/26/2006
        >
        > June Kim posted a J Language version of bowling that is very
        > vector-oriented. As an experiment, I coded up a vector-style
        > version in Ruby, TDD of course. It turned out to be kind of
        > interesting.
        >
        > http://www.xprogramming.com/xpmag/dbcBowlingVector.htm

        I've posted a C++ version to my blog:

        http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html

        At 75 lines vs 72, it's not much different to Ron's Ruby version in length,
        and just as clear, in my opinion.

        Anthony
        --
        Anthony Williams
        Software Developer
        Just Software Solutions Ltd
        http://www.justsoftwaresolutions.co.uk
      • Ian Collins
        ... Interesting solution. One thing you could mention is all of the one line functions will probably be optimised away - it would be interesting to see the
        Message 3 of 20 , May 2, 2006
          Anthony Williams wrote:

          >Ron Jeffries <ronjeffries@...> writes:
          >
          >
          >
          >>Bowling Vectors
          >>Ron Jeffries
          >>04/26/2006
          >>
          >> June Kim posted a J Language version of bowling that is very
          >> vector-oriented. As an experiment, I coded up a vector-style
          >> version in Ruby, TDD of course. It turned out to be kind of
          >> interesting.
          >>
          >> http://www.xprogramming.com/xpmag/dbcBowlingVector.htm
          >>
          >>
          >
          >I've posted a C++ version to my blog:
          >
          >http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html
          >
          >At 75 lines vs 72, it's not much different to Ron's Ruby version in length,
          >and just as clear, in my opinion.
          >
          >
          >
          Interesting solution.

          One thing you could mention is all of the one line functions will
          probably be optimised away - it would be interesting to see the
          resulting assembler :)

          Ian
        • Ron Jeffries
          ... It s certainly similar, and I imagine that to a person who was used to seeing C++ s rather excessive use of :: an , it s pretty clear. After a while one
          Message 4 of 20 , May 3, 2006
            On Tuesday, May 2, 2006, at 9:55:48 AM, Anthony Williams wrote:

            >>
            >> June Kim posted a J Language version of bowling that is very
            >> vector-oriented. As an experiment, I coded up a vector-style
            >> version in Ruby, TDD of course. It turned out to be kind of
            >> interesting.
            >>
            >> http://www.xprogramming.com/xpmag/dbcBowlingVector.htm

            > I've posted a C++ version to my blog:

            > http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html

            > At 75 lines vs 72, it's not much different to Ron's Ruby version in length,
            > and just as clear, in my opinion.

            It's certainly similar, and I imagine that to a person who was used
            to seeing C++'s rather excessive use of :: an <>, it's pretty clear.
            After a while one reads right past the noise characters.

            However, I've been looking at a fair amount of actual C++ code
            lately and I've never seen a one-line function. I've seen lots of
            twenty, forty, even hundred-line functions.

            Your example shows that it is /possible/ to write C++ in that style
            ... but would you, and would a typical on-the-ground C++ programmer
            really write that way?

            (On the other hand, would a typical on-the-ground Ruby or C#
            programmer write the way I do? I have my doubts about that, too.)

            Ron Jeffries
            www.XProgramming.com
            Replacing an on-site customer with some use cases is about as effective
            as replacing a hug from your Mom with a friendly note.
          • Tim Dugan
            Regarding this.. [...] been looking at a fair amount of actual C++ code lately and I ve never seen a one-line function. I ve seen lots of twenty, forty, even
            Message 5 of 20 , May 3, 2006
              Regarding this..

              "[...] been looking at a fair amount of actual C++ code lately and I've
              never seen a one-line function. I've seen lots of twenty, forty, even
              hundred-line functions."

              Perhaps a lot of programmers have weak programming style? :)

              Previously when I did C++ and now, with Java, I definitely write a
              significant number of 1-line methods--and not just "accessors" and
              "setters". I suspect most programmers don't write one-line methods
              because they view a method as a unit of work to be coded, not as an
              abstraction of how an object works.

              One of the developers I was working with recently said he prefers long
              methods over multiple short ones because it's easier to tell where you
              are in the debugger.

              Tim Dugan, Technical Lead - O&D/RTDP
              PROS Revenue Management
              (713)335-7942, tdugan@...

              -----Original Message-----
              From: extremeprogramming@yahoogroups.com
              [mailto:extremeprogramming@yahoogroups.com] On Behalf Of Ron Jeffries
              Sent: Wednesday, May 03, 2006 6:29 AM
              To: extremeprogramming@yahoogroups.com
              Subject: Re: [XP] Re: New Articles on XProgramming.com

              On Tuesday, May 2, 2006, at 9:55:48 AM, Anthony Williams wrote:

              >>
              >> June Kim posted a J Language version of bowling that is very
              >> vector-oriented. As an experiment, I coded up a vector-style
              >> version in Ruby, TDD of course. It turned out to be kind of
              >> interesting.
              >>
              >> http://www.xprogramming.com/xpmag/dbcBowlingVector.htm

              > I've posted a C++ version to my blog:

              > http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html

              > At 75 lines vs 72, it's not much different to Ron's Ruby version in
              length,
              > and just as clear, in my opinion.

              It's certainly similar, and I imagine that to a person who was used
              to seeing C++'s rather excessive use of :: an <>, it's pretty clear.
              After a while one reads right past the noise characters.

              However, I've been looking at a fair amount of actual C++ code
              lately and I've never seen a one-line function. I've seen lots of
              twenty, forty, even hundred-line functions.

              Your example shows that it is /possible/ to write C++ in that style
              ... but would you, and would a typical on-the-ground C++ programmer
              really write that way?

              (On the other hand, would a typical on-the-ground Ruby or C#
              programmer write the way I do? I have my doubts about that, too.)

              Ron Jeffries
              www.XProgramming.com
              Replacing an on-site customer with some use cases is about as effective
              as replacing a hug from your Mom with a friendly note.



              To Post a message, send it to: extremeprogramming@...

              To Unsubscribe, send a blank message to:
              extremeprogramming-unsubscribe@...

              ad-free courtesy of objectmentor.com
              Yahoo! Groups Links









              The information contained in this email may be confidential and/or legally privileged. It has been sent for the sole use of the intended recipient(s). If the reader of this message is not an intended recipient, you are hereby notified that any unauthorized review, use, disclosure, dissemination, distribution, or copying of this communication, or any of its contents, is strictly prohibited. If you have received this communication in error, please contact the sender by reply email and destroy all copies of the original message. Thank you
            • Anthony Williams
              ... ... There s a lot of badly structured C++ out there, much of it written by quite competent programmers. I ve inherited code with thousand-line
              Message 6 of 20 , May 3, 2006
                Ron Jeffries <ronjeffries@...> writes:

                > On Tuesday, May 2, 2006, at 9:55:48 AM, Anthony Williams wrote:
                >
                >>>
                >>> June Kim posted a J Language version of bowling that is very
                >>> vector-oriented. As an experiment, I coded up a vector-style
                >>> version in Ruby, TDD of course. It turned out to be kind of
                >>> interesting.
                >>>
                >>> http://www.xprogramming.com/xpmag/dbcBowlingVector.htm
                >
                >> I've posted a C++ version to my blog:
                >
                >> http://www.justsoftwaresolutions.co.uk/cplusplus/vector_bowling.html
                >
                >> At 75 lines vs 72, it's not much different to Ron's Ruby version in length,
                >> and just as clear, in my opinion.
                >
                > It's certainly similar, and I imagine that to a person who was used
                > to seeing C++'s rather excessive use of :: an <>, it's pretty clear.
                > After a while one reads right past the noise characters.

                <G>

                > However, I've been looking at a fair amount of actual C++ code
                > lately and I've never seen a one-line function. I've seen lots of
                > twenty, forty, even hundred-line functions.

                There's a lot of badly structured C++ out there, much of it written by quite
                competent programmers. I've inherited code with thousand-line functions
                before, but that doesn't make it good C++ style.

                > Your example shows that it is /possible/ to write C++ in that style
                > ... but would you, and would a typical on-the-ground C++ programmer
                > really write that way?

                I'm most definitely an "on-the-ground C++ programmer", since I do most of my
                work using C++. I'm fairly sure I'm not typical, though --- I use TDD, for
                starters, even on GUI stuff.

                I refactor my code until it's clear. Sometimes that means one line functions,
                sometimes not. Bowling actually seems quite conducive to short functions.

                SourceMonitor tells me that my average on a recent 30k-line project is 3.1
                lines/function for non-test code. Even so, many of the functions are more
                complex than I'd like; I just haven't devoted the time to make them shorter.

                > (On the other hand, would a typical on-the-ground Ruby or C#
                > programmer write the way I do? I have my doubts about that, too.)

                ;-)

                Anthony
                --
                Anthony Williams
                Software Developer
                Just Software Solutions Ltd
                http://www.justsoftwaresolutions.co.uk
              • Ron Jeffries
                ... There are a lot that don t follow the same style guidelines as I do, anyway ... ... Don t know. I really don t understand what folks are doing. ... I
                Message 7 of 20 , May 3, 2006
                  On Wednesday, May 3, 2006, at 8:33:08 AM, Tim Dugan wrote:

                  > Regarding this..

                  > "[...] been looking at a fair amount of actual C++ code lately and I've
                  > never seen a one-line function. I've seen lots of twenty, forty, even
                  > hundred-line functions."

                  > Perhaps a lot of programmers have weak programming style? :)

                  There are a lot that don't follow the same style guidelines as I do,
                  anyway ...

                  > Previously when I did C++ and now, with Java, I definitely write a
                  > significant number of 1-line methods--and not just "accessors" and
                  > "setters". I suspect most programmers don't write one-line methods
                  > because they view a method as a unit of work to be coded, not as an
                  > abstraction of how an object works.

                  Don't know. I really don't understand what folks are doing.

                  > One of the developers I was working with recently said he prefers long
                  > methods over multiple short ones because it's easier to tell where you
                  > are in the debugger.

                  I laugh, I cry.

                  On Wednesday, May 3, 2006, at 8:43:07 AM, Anthony Williams wrote:

                  > I'm most definitely an "on-the-ground C++ programmer", since I do most of my
                  > work using C++. I'm fairly sure I'm not typical, though --- I use TDD, for
                  > starters, even on GUI stuff.

                  > I refactor my code until it's clear. Sometimes that means one line functions,
                  > sometimes not. Bowling actually seems quite conducive to short functions.

                  > SourceMonitor tells me that my average on a recent 30k-line project is 3.1
                  > lines/function for non-test code. Even so, many of the functions are more
                  > complex than I'd like; I just haven't devoted the time to make them shorter.

                  Yes ... that average is way lower than what I see, even among C++
                  folks who are allegedly very good. I think there may be a thing in
                  more, um, mature programmers who accept longer code, though I am
                  old, if not mature, and I wrote tiny routines in C. Even assembler.

                  I just don't get it, sometimes ... some people's kids ...

                  Ron Jeffries
                  www.XProgramming.com
                  Fear is the mindkiller. --Bene Gesserit Litany Against Fear
                • Keith Ray
                  I ve seen Java code just with just as many large methods and large classes as C++. The mozilla project has some c++ methods that are several 1000 s of lines
                  Message 8 of 20 , May 3, 2006
                    I've seen Java code just with just as many large methods and large
                    classes as C++.

                    The mozilla project has some c++ methods that are several 1000's of
                    lines long -- a very fertile source for writing about code smells and
                    refactoring. ;-)

                    On 5/3/06, Ron Jeffries <ronjeffries@...> wrote:
                    > On Wednesday, May 3, 2006, at 8:33:08 AM, Tim Dugan wrote:
                    >
                    > > Regarding this..
                    >
                    > > "[...] been looking at a fair amount of actual C++ code lately and I've
                    > > never seen a one-line function. I've seen lots of twenty, forty, even
                    > > hundred-line functions."
                    >
                    > > Perhaps a lot of programmers have weak programming style? :)
                    >
                    > There are a lot that don't follow the same style guidelines as I do,
                    > anyway ...
                    >
                    > > Previously when I did C++ and now, with Java, I definitely write a
                    > > significant number of 1-line methods--and not just "accessors" and
                    > > "setters". I suspect most programmers don't write one-line methods
                    > > because they view a method as a unit of work to be coded, not as an
                    > > abstraction of how an object works.
                    >
                    > Don't know. I really don't understand what folks are doing.
                    >
                    > > One of the developers I was working with recently said he prefers long
                    > > methods over multiple short ones because it's easier to tell where you
                    > > are in the debugger.
                    >
                    > I laugh, I cry.
                    >
                    > On Wednesday, May 3, 2006, at 8:43:07 AM, Anthony Williams wrote:
                    >
                    > > I'm most definitely an "on-the-ground C++ programmer", since I do most of my
                    > > work using C++. I'm fairly sure I'm not typical, though --- I use TDD, for
                    > > starters, even on GUI stuff.
                    >
                    > > I refactor my code until it's clear. Sometimes that means one line functions,
                    > > sometimes not. Bowling actually seems quite conducive to short functions.
                    >
                    > > SourceMonitor tells me that my average on a recent 30k-line project is 3.1
                    > > lines/function for non-test code. Even so, many of the functions are more
                    > > complex than I'd like; I just haven't devoted the time to make them shorter.
                    >
                    > Yes ... that average is way lower than what I see, even among C++
                    > folks who are allegedly very good. I think there may be a thing in
                    > more, um, mature programmers who accept longer code, though I am
                    > old, if not mature, and I wrote tiny routines in C. Even assembler.
                    >
                    > I just don't get it, sometimes ... some people's kids ...
                    >
                    > Ron Jeffries
                    > www.XProgramming.com
                    > Fear is the mindkiller. --Bene Gesserit Litany Against Fear
                    >
                    >
                    >
                    > To Post a message, send it to: extremeprogramming@...
                    >
                    > To Unsubscribe, send a blank message to: extremeprogramming-unsubscribe@...
                    >
                    > ad-free courtesy of objectmentor.com
                    > Yahoo! Groups Links
                    >
                    >
                    >
                    >
                    >
                    >
                    >


                    --

                    C. Keith Ray
                    <http://homepage.mac.com/keithray/blog/index.html>
                    <http://homepage.mac.com/keithray/xpminifaq.html>
                    <http://homepage.mac.com/keithray/resume2.html>
                  • Ron Jeffries
                    ... Yes, I ve seen the same. I think that the C++ I see is worse than the Java / C# by a small margin. It might just be older. Or the programmers might ... but
                    Message 9 of 20 , May 3, 2006
                      On Wednesday, May 3, 2006, at 10:44:06 AM, Keith Ray wrote:

                      > I've seen Java code just with just as many large methods and large
                      > classes as C++.

                      > The mozilla project has some c++ methods that are several 1000's of
                      > lines long -- a very fertile source for writing about code smells and
                      > refactoring. ;-)

                      Yes, I've seen the same. I think that the C++ I see is worse than
                      the Java / C# by a small margin. It might just be older. Or the
                      programmers might ... but I'm generally older than any two of them,
                      and my code doesn't seem to be coming in larger methods lately ...

                      Ron Jeffries
                      www.XProgramming.com
                      Learn from yesterday, live for today, hope for tomorrow.
                      The important thing is to not stop questioning. --Albert Einstein
                    • Ian Collins
                      ... Yes, as others have said there is a lot of legacy C++ with stupidly long functions out there. But that code wasn t written test first. My code has lots of
                      Message 10 of 20 , May 3, 2006
                        Ron Jeffries wrote:

                        >
                        >Your example shows that it is /possible/ to write C++ in that style
                        >... but would you, and would a typical on-the-ground C++ programmer
                        >really write that way?
                        >
                        >
                        >
                        Yes, as others have said there is a lot of legacy C++ with stupidly long
                        functions out there. But that code wasn't written test first.

                        My code has lots of very short functions, a practice that is actively
                        encouraged in Stroustrup's "The C++ Programming Language".

                        Sort functions are very efficient in C++ as they tend to by inlined away
                        by the compiler, a fact many programmers tend to overlook.

                        Ian
                      • Ron Jeffries
                        Two articles this time, one on estimating the Shotgun Pattern project, and one showing some more of our spike code. Readers have been chiming in with estimates
                        Message 11 of 20 , Dec 3, 2006
                          Two articles this time, one on estimating the Shotgun Pattern
                          project, and one showing some more of our spike code.

                          Readers have been chiming in with estimates and sorting us out on
                          how to use the Internet to find useful Java image code.

                          Shooting for Estimates
                          Ron Jeffries
                          12/03/2006

                          Input from a few readers, and our initial estimates for the
                          shooting project.

                          http://www.xprogramming.com/xpmag/dbcShootingForEstimates.htm

                          Darker Before the Dawn
                          Ron Jeffries
                          12/03/2006

                          Our first spike took a bit longer than we had hoped, but we
                          successfully interpreted a BMP file. We worked to improve our
                          code, while people wrote to us to tell us how ignorant we are. Fun
                          all around.

                          http://www.xprogramming.com/xpmag/dbcDarkerBeforeTheDawn.htm

                          Ron Jeffries
                          www.XProgramming.com
                          Agility is not an inescapable law of purity
                          but a pragmatic principle of effectiveness. -- Marc Hamann
                        Your message has been successfully submitted and would be delivered to recipients shortly.