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

Re: [XP] Re: refactoring

Expand Messages
  • William Wake
    ... No... think mathematical function not functioning in a manner useful to me . There s often a semantics for a programming language, independent of the
    Message 1 of 129 , Oct 1, 2005
      On 10/1/05, Ron Jeffries <ronjeffries@...> wrote:
      > Well, yes. And ... just /what/ is "functional behavior"? I can
      > refactor a program in such a way as to make it run for a year
      > instead of a millisecond. Is that "functional"?

      No... think "mathematical function" not "functioning in a manner useful to me".

      There's often a semantics for a programming language, independent of
      the machine it's implemented on. So, regardless of whether we're
      running on a 10 MHz machine or a 10 GHz machine, there's some sense in
      which we know that "for (int i = 0; i < 10; ..." is the same as "int i
      = 0; while (i < 10) ..."

      And this works reasonably well for single-threaded code in
      environments where the program can't introspect.

      Threads complicate things because the order of statements now matters
      in a way it didn't before. For example, you might think that "x = 0; y
      = 0;" could be rearranged to "y=0; x=0;". But another thread might be
      able to tell the difference by monitoring x and y.


      > My point was, and remains, that as we refactor, we have in mind
      > which "behavior" we intend to preserve, and which we do not.

      Yup.

      > A code [re]factoring is trickier. Although it seems to be as
      > formally defined as the algebraic one, it is driven by intent, even
      > more so than the algebraic ones are.
      >
      > Now, frankly, I think that none of this matters in real life.
      > Refactoring is a toolbox of code transformations which we choose,
      > using our intelligence, to accomplish goals which we also choose.
      > Its formal definition is perhaps quite useful to a few, but its
      > practical application as part of software development is, to me,
      > more valuable.

      Well, I certainly want the IDE folks doing a reasonable job of
      preserving behavior. But I'll accept the compromises that leave me a
      generally useful tool.

      --
      Bill Wake William.Wake@... www.xp123.com
    • aacockburn
      ... Thanks - I was typing fast and my mind went blank. Alistair
      Message 129 of 129 , Mar 6, 2008
        --- In extremeprogramming@yahoogroups.com, Tim Ottinger <linux_tim@...>
        wrote:
        >
        > "... of Illinois" (at Urbana/Champaign)
        >

        Thanks - I was typing fast and my mind went blank. Alistair
      Your message has been successfully submitted and would be delivered to recipients shortly.