Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #26967
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!usenetcore.com!Xl.tags.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!local2.nntp.ams.giganews.com!nntp.bt.com!news.bt.com.POSTED!not-for-mail |
|---|---|
| NNTP-Posting-Date | Tue, 17 Dec 2013 10:56:56 -0600 |
| Date | Tue, 17 Dec 2013 16:56:53 +0000 |
| From | lipska the kat <"lipskathekat at yahoo dot co dot uk"> |
| Organization | Trollbusters 3 |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130308 Thunderbird/17.0.4 |
| MIME-Version | 1.0 |
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: A little concept puzzle (involving refactoring) |
| References | <refactor-20131217165545@ram.dialup.fu-berlin.de> |
| In-Reply-To | <refactor-20131217165545@ram.dialup.fu-berlin.de> |
| Content-Type | text/plain; charset=ISO-8859-1; format=flowed |
| Content-Transfer-Encoding | 8bit |
| Message-ID | <lI6dnUvIQtnFHy3PnZ2dnUVZ7sWdnZ2d@bt.com> (permalink) |
| Lines | 68 |
| X-Usenet-Provider | http://www.giganews.com |
| X-AuthenticatedUsername | NoAuthUser |
| X-Trace | sv3-CRXGXc0DcP6yQgrcHY6qLtV8ZyANsbO/lW6Gx32XazXN0jFgQEjaelpxvh4gp1auIoNfhP3WP3ftU73!XGwHoL46EfRbkL8i+CmvmSsKeLFK4gun5tdfz8G7Ve6JbcoSFjIOrPbaA4/0vlY6lpOLGqGeJbBC |
| X-Complaints-To | abuse@btinternet.com |
| X-DMCA-Complaints-To | abuse@btinternet.com |
| X-Abuse-and-DMCA-Info | Please be sure to forward a copy of ALL headers |
| X-Abuse-and-DMCA-Info | Otherwise we will be unable to process your complaint properly |
| X-Postfilter | 1.3.40 |
| X-Original-Bytes | 2963 |
| Xref | csiph.com comp.lang.java.programmer:26967 |
Show key headers only | View raw
On 17/12/13 16:16, Stefan Ram wrote:
> 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?
<snip>
You're kidding right?
public class Refactor {
public static double cube(double i){
return i * i * i;
}
public static void main(String[] args) {
System.out.println(cube(3.6));
}
}
===> refactor cube <===
public class Refactor {
public static double cube(double i){
return Math.pow(i, 3);
}
public static void main(String[] args) {
System.out.println(cube(3.6));
}
}
--
Lipska the Kat©: Troll hunter, sandbox destroyer,
treacherous feline and farscape dreamer of Aeryn Sun
GNU/Linux user #560883 - http://www.linuxcounter.net
Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread
Re: A little concept puzzle (involving refactoring) lipska the kat <"lipskathekat at yahoo dot co dot uk"> - 2013-12-17 16:56 +0000
csiph-web