Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #26966

Re: A little concept puzzle (involving refactoring)

From Joerg Meier <joergmmeier@arcor.de>
Newsgroups comp.lang.java.programmer
Subject Re: A little concept puzzle (involving refactoring)
Date 2013-12-17 17:35 +0100
Message-ID <m6qxtl8yy815.trlch3cqlct8.dlg@40tude.net> (permalink)
References <refactor-20131217165545@ram.dialup.fu-berlin.de>

Show all headers | View raw


On 17 Dec 2013 16:16:35 GMT, Stefan Ram wrote:

>   The behavior has changed - so that was not a refactor!

The behaviour has not changed: the behaviour is that it prints out a random
number. This behaviour is consistent over many calls and does not change
with the refactoring. By your definition, my Firefoxes behaviour is changed
all the time without even recompiling it! And following that logic, it is
impossible to ever refactor an NTP client!

Clearly, that definition makes no sense. The real issue here is that your
program is not written in a way that allows for proper unit testing, and as
a result, you can not confirm changes in behaviour because of your
inability to mock proper input.

The real solution is to use a supplied Random that can be initialized with
a fixed seed for mocking/testing, and then refactoring can be defined as
getting the exact same output (if you so wished).

Liebe Gruesse,
		Joerg

-- 
Ich lese meine Emails nicht, replies to Email bleiben also leider
ungelesen.

Back to comp.lang.java.programmer | Previous | Next | Find similar | Unroll thread


Thread

Re: A little concept puzzle (involving refactoring) Joerg Meier <joergmmeier@arcor.de> - 2013-12-17 17:35 +0100

csiph-web