S
Stefan Ram
Here is a little puzzle about the definition of concepts:
/The behavior/ of a program I call what can be observed
from the outside by running the program.
/A refactor/ I call a modification of the source code of
a program that does not change the behavior of the program.
Now, let's test these concepts!
public class Main
{ public static void main( final java.lang.String[] args )
{ final double value = java.lang.Math.random();
java.lang.System.out.println( value ); }}
0.8262472065326088
Now apply the modification
»renameLocalVariable("value","number")«:
public class Main
{ public static void main( final java.lang.String[] args )
{ final double number = java.lang.Math.random();
java.lang.System.out.println( number ); }}
0.4774192830734339
The behavior has changed - so that was not a refactor!
Should we see it this way or modify our definitions?
PS: Here's a quotation from the book »Refactoring« by Martin
Fowler at al.:
»Refactoring is the process of changing a software
system in such a way that it does not alter the external
behavior of the code yet improves its internal structure.«
/The behavior/ of a program I call what can be observed
from the outside by running the program.
/A refactor/ I call a modification of the source code of
a program that does not change the behavior of the program.
Now, let's test these concepts!
public class Main
{ public static void main( final java.lang.String[] args )
{ final double value = java.lang.Math.random();
java.lang.System.out.println( value ); }}
0.8262472065326088
Now apply the modification
»renameLocalVariable("value","number")«:
public class Main
{ public static void main( final java.lang.String[] args )
{ final double number = java.lang.Math.random();
java.lang.System.out.println( number ); }}
0.4774192830734339
The behavior has changed - so that was not a refactor!
Should we see it this way or modify our definitions?
PS: Here's a quotation from the book »Refactoring« by Martin
Fowler at al.:
»Refactoring is the process of changing a software
system in such a way that it does not alter the external
behavior of the code yet improves its internal structure.«