Rubber ducking

Rubber ducking
Know-Nothing
Resident
Avatar

Usergroup: Sponsors
Joined: Jan 26, 2012

Total Topics: 21
Total Posts: 218
#1 - Quote - Permalink
Posted Mar 15, 2012 - 12:55 PM:
Subject: Rubber ducking
No, it's not dirty euphemism, at least as far as I know.

grin

This oddity of a title actually refers to a real practice (though mostly restricted to 'code monkey land', or perhaps 'professional writers-and-editors-ville') called 'rubber duck debugging', alternately known as the 'rubber duckie test'.

http://www.c2.com/cgi/wiki?RubberDucking

The term and practice have it's roots in an apocryphal story. The story goes that it was common practice for a certain very skilled programmer to keep a rubber duck near his computer at all times. If the programmer ran into a bug in his code, he would debug it by forcing himself to explain it out loud, line-by-line, to said plasticine paddler.

The fact that this programmer is rather inconsequential. It could be any inanimate object really. The basic premise is that meticulously explaining the code out loud reveals the incorrect piece of coding.

The method exploits cognitive dissonance. The programmer looks for any mismatch between his or her description of what the code is supposed to be doing, and his or her observation of what the code is actually doing.

Reading something aloud is perhaps thought of by many as something childish. Something we grow out of. However, speaking aloud forces you to slow down, clarify your reasoning and abstain from shortcuts that thought alone engages in without us even realizing it. A description of, and reflection upon, this 'slowdown effect' can be found in this excerpt from the link above:


Think of the duck as a "QwertySyndrome" for the mind. It was claimed that forcing the stream of text through the mangled organization of the keyboard slowed the typist enough to prevent the mechanical typewriter from jamming. Likewise, by forcing thoughts through the slow engine of the mouth, one can clearly express a single train of thoughts. The mind is then more capable of using the thoughts to solve the problem. I have always held this belief, more or less consciously

.... I still do seem to get the slowdown effect. Without that, my mind races too fast and in too many directions. It feels like I had about three layers of thought of which one would occasionally jump to the top and one would occasionally die and be replaced".



The link goes on to mention a particular 'Wikizen', who proposed an underlying maxim for this phenomenon:

"Once a problem is described in sufficient detail, its solution is obvious".

Said wikizen goes on to provide some examples:


If the stated problem is: "Our program is too slow," the solution is not obvious.

However, if the statement is: "Line 210 is called 10e9 times, and it has some no-ops," then the solution is obvious.

If the problem, as stated by your spouse, is: "You never listen to me," the solution is not obvious.

However, if the statement is: "You don't make eye contact enough when I'm talking to you," then the solution is obvious.



Generally put, if the solution isn't obvious, then the description isn't detailed enough.

This same wikizen goes on to consider problems like Fermat's last theorem:


"Fermat's last theorem was pretty sufficiently detailed. The solution is hard to consider obvious. That's math. Programming is special in that the tasks we undertake are simple in principle, but difficult in practice. In contrast, math is unsolvable in principle, but merely difficult in practice.

But the (an?) important thing is to be specific. "Prove Fermat's Last Theorem" is an insufficiently "tight" problem. Once you work out what it is that you need to do right now then, even in maths, it's often obvious (to someone who's mathematically inclined, anyway)".



Anyways, questions.

1) Can you think of any scenarios where this wikizen's maxim "once a problem is described in sufficient detail, it's solution is obvious" would not apply?

2) Do you agree with this maxim?

3) Are solutions merely 'adequately described problems'?


















Edited by Know-Nothing on Mar 15, 2012 - 1:00 PM. Reason: Format uglies
Sundkvistia
Newbie

Usergroup: Members
Joined: Mar 13, 2012

Total Topics: 0
Total Posts: 1
#2 - Quote - Permalink
Posted Mar 15, 2012 - 2:45 PM:

1) Can you think of any scenarios where this wikizen's maxim "once a problem is described in sufficient detail, it's solution is obvious" would not apply?
It would be one where the problem lack a solution within the margins of the problem deceleration.
If either it lacks one overall or the actual problem is outside of the one declared.
2) Do you agree with this maxim?
Depends. if the definition of 'described in sufficient detail' is that the answer should be obvious. Then so it is.
3) Are solutions merely 'adequately described problems'?
No, a solution(algorithm) demands a suggested course of action. A problem, no matter how much detail of it is explained, will still need some independent thinking to be turned into a solution.
wuliheron
Resident
Avatar

Usergroup: Sponsors
Joined: Jun 02, 2003
Location: Chesapeake, VA

Total Topics: 49
Total Posts: 466
#3 - Quote - Permalink
Posted Mar 15, 2012 - 7:03 PM:

Know-Nothing wrote:


1) Can you think of any scenarios where this wikizen's maxim "once a problem is described in sufficient detail, it's solution is obvious" would not apply?


Mother-in-laws.

Know-Nothing wrote:
2) Do you agree with this maxim?


Not at all. Einstein's E=MC^2 is what physicists call elegant simplicity, but it is not obvious.

Know-Nothing wrote:
3) Are solutions merely 'adequately described problems'?



There are no problems, only solutions.
John Lennon

Problems and solutions are relative terms and just can't have an up without a down, a front without a back. Emotionally it might make sense, but intellectually its meaningless gibberish.














[/quote]
Know-Nothing
Resident
Avatar

Usergroup: Sponsors
Joined: Jan 26, 2012

Total Topics: 21
Total Posts: 218
#4 - Quote - Permalink
Posted Mar 15, 2012 - 8:04 PM:

wuliheron wrote:


Mother-in-laws.


nod


Edited by Know-Nothing on Mar 15, 2012 - 9:13 PM
GregS
PF Addict
Avatar

Usergroup: Members
Joined: Dec 09, 2010
Location: Perth Australia

Total Topics: 34
Total Posts: 1515
#5 - Quote - Permalink
Posted Mar 15, 2012 - 9:38 PM:

The Rubber Duck works on a very sound philosophical basis. Other varieties of the same technique, ids simply explaining to another person what you are doing and how you are doing it. However, the time honoured method is to do the same thing in writing.

Unfortunately schooling Australia has taken over by the expression of emotions rather than thoughts and the result of this is that students are unacquainted with discovering ideas. We have embraced stupidity.

The underlying logic is that we unconsciously know far more than we can consciously appreciate. That the mind is in the habit of creating errors, that is fixed categories which appear as obvious and unassailable. These errors cause us to jump-logic, often without the slightest hint that this is happening. In just articulating the problem as fully as possible we stand more of a chance in spotting our own errors and then reposing the correct question.

The correct question has the correct answer embedded into it, but finding that is not simple. Why the rubber duck is important in programming is that the errors are formal ones given the limits of coding. The logical jumps therefore stand out when the code is explained line by line.

I do a little computer scripting and I always test the code in segments and put it together and it practically never works first time. Usually I have just jumped over a really simple and obvious routine. More often than not it is so simple, so obvious and so easily corrected it just escapes notice. I don't have a duck but conduct an internal conversation (both talking and listening to myself, often audibly mumbled). It seems to work for programming type errors about 90% or more of the time, but it is always the last thing I try (obviously because it so often works but also because it is laborious and I am lazy).

Know-Nothing
Resident
Avatar

Usergroup: Sponsors
Joined: Jan 26, 2012

Total Topics: 21
Total Posts: 218
#6 - Quote - Permalink
Posted Mar 16, 2012 - 9:28 AM:

GregS wrote:
The correct question has the correct answer embedded into it, but finding that is not simple. Why the rubber duck is important in programming is that the errors are formal ones given the limits of coding. The logical jumps therefore stand out when the code is explained line by line.


A very good point
cool

atticusII
Forum Veteran

Usergroup: Members
Joined: Jan 22, 2011

Total Topics: 11
Total Posts: 581
#7 - Quote - Permalink
Posted Mar 16, 2012 - 4:03 PM:

I've never heard this before, like GregS, I've heard similar maxims, it seems very similar to Sherlock Holmes's saying; "...when you have eliminated the impossible, whatever remains, however improbable, must be the truth."

1) Can you think of any scenarios where this wikizen's maxim "once a problem is described in sufficient detail, it's solution is obvious" would not apply?
In social or human terms, where personal experiences and interpretations play a part. Even in this example: If the problem, as stated by your spouse, is: "You never listen to me," the solution is not obvious.

However, if the statement is: "You don't make eye contact enough when I'm talking to you," then the solution is obvious.
Once you adopt the 'obvious' solution to the problem, what do you do when the persistent feelings of low regard or lack of attention are experienced by the wife?
This is too simplistic a maxim to apply to the entanglements of people learning about them self, their problems, their relationships and other people, over a lifetime.

2) Do you agree with this maxim? It's more a case of whether the maxim can be usefully applied to experience. I also think this is too bold a claim, sure, an answer becomes apparent but obvious? It seems a too certain sense of events or information and could lead to less critical or reflexive attention being invested in action.

3) Are solutions merely 'adequately described problems'? I'm not sure what you mean here? Though it is said that today's solutions are tomorrow's problems. Maybe this is because, as you say, we act on the problems described and encounter higher level problems or feedback about over-sights or expectations?

Know-Nothing
Resident
Avatar

Usergroup: Sponsors
Joined: Jan 26, 2012

Total Topics: 21
Total Posts: 218
#8 - Quote - Permalink
Posted Mar 16, 2012 - 5:59 PM:

atticusII wrote:

In social or human terms, where personal experiences and interpretations play a part. Even in this example: If the problem, as stated by your spouse, is: "You never listen to me," the solution is not obvious. However, if the statement is: "You don't make eye contact enough when I'm talking to you," then the solution is obvious.

Once you adopt the 'obvious' solution to the problem, what do you do when the persistent feelings of low regard or lack of attention are experienced by the wife?
This is too simplistic a maxim to apply to the entanglements of people learning about them self, their problems, their relationships and other people, over a lifetime.


The maxim presented by this anonymous wikizen, as Greg pointed out, seems to concern itself with the formal aspects of problems and not the normative aspects per se. In this way, it can quite rightly be considered simplistic.

The maxim may be useful in approaching an acceptable and more greatly informed course of action, but alone the maxim would be insufficient in dealing with the emotional, psychological or even moral / ethical aspects of a problem. Perhaps the maxim is best thought of as a 'first step' in resolving problems similar to this exampled domestic scenario?

atticusII wrote:
2) Do you agree with this maxim? It's more a case of whether the maxim can be usefully applied to experience. I also think this is too bold a claim, sure, an answer becomes apparent but obvious? It seems a too certain sense of events or information and could lead to less critical or reflexive attention being invested in action.


The use of the word 'obvious', I agree, is determentally strong. I like 'apparent' much better.

atticusII wrote:
3) Are solutions merely 'adequately described problems'? I'm not sure what you mean here? Though it is said that today's solutions are tomorrow's problems. Maybe this is because, as you say, we act on the problems described and encounter higher level problems or feedback about over-sights or expectations?


I don't myself adhere to such a definition of 'solution'. On normative issues, I take a stance where problems and solutions are perhaps more relative. On positive, or formal issues, I think this definition of solution is perhaps more tenable.

I do like that phrase though - "today's solutions are tomorrow's problems". Maybe what we experience as 'problems' are simply our anxieties in the face of the avalanche of conflicting solutions.
Banno
Tiff's bit of wruff.
Avatar

Usergroup: Sponsors
Joined: Aug 15, 2004
Location: Dow nunder

Total Topics: 467
Total Posts: 10012
#9 - Quote - Permalink
Posted Mar 16, 2012 - 6:13 PM:

Isn't "Rubber ducking" just Cartesian method? Take a problem, break it into its simplest components, solve each and so solve the original problem?

The Cynefin model helps in explaining where the method fails.

It will for simple problems, in which the cause and effect are obvious. It will also work of complicated problems, in which some analysis is required to uncover the cause and effect. It will not work with complex situations, in which the relation of cause and effect is only apparent in retrospect. In such cases, one must try a range of solutions and observe the results. It will not work in chaotic situations, in which there is no relation between cause and effect.
On Mar 16, 2012 - 6:16 PM, Know-Nothing responded: Just now looking up info on this 'Cynefin' model. Interesting stuff, Banno.
On Mar 16, 2012 - 6:17 PM, Banno responded: Indeed.
On Mar 16, 2012 - 6:25 PM, Know-Nothing responded: Quite.
atticusII
Forum Veteran

Usergroup: Members
Joined: Jan 22, 2011

Total Topics: 11
Total Posts: 581
#10 - Quote - Permalink
Posted Mar 16, 2012 - 6:39 PM:

Good post Know-Nothing and some food for futher thought. I do like this idea; Maybe what we experience as 'problems' are simply our anxieties in the face of the avalanche of conflicting solutions.
I certainly think there's something in this, how anxiety can stimulate haste, erratic efforts and responses.


On Mar 17, 2012 - 2:25 AM, Know-Nothing responded: In kind atticusII
=)
locked
Download thread as
  • 100/5
  • 1
  • 2
  • 3
  • 4
  • 5


Recent Internal Replies
On Mar 17, 2012 - 2:25 AM, Know-Nothing replied internally to atticusII's Good post Know-Nothi....
On Mar 16, 2012 - 6:25 PM, Know-Nothing replied internally to Banno's Isn't "Rubbe....
On Mar 16, 2012 - 6:17 PM, Banno replied internally to Banno's Isn't "Rubbe....
On Mar 16, 2012 - 6:16 PM, Know-Nothing replied internally to Banno's Isn't "Rubbe....

This thread is closed, so you cannot post a reply.