<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Code Reads #4: Dijkstra&#8217;s &#8220;Notes on Structured Programming&#8221;</title>
	<atom:link href="http://www.wordyard.com/2006/11/06/dijkstra-notes/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/</link>
	<description>Technology, politics, culture</description>
	<lastBuildDate>Tue, 16 Mar 2010 18:43:15 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Scott Rosenberg&#8217;s Wordyard &#187; Blog Archive &#187; Code Reads #11: &#8220;Notes on Postmodern Programming&#8221;</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-2483</link>
		<dc:creator>Scott Rosenberg&#8217;s Wordyard &#187; Blog Archive &#187; Code Reads #11: &#8220;Notes on Postmodern Programming&#8221;</dc:creator>
		<pubDate>Wed, 02 Apr 2008 16:36:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-2483</guid>
		<description>[...] Edsger Dijkstra&#8217;s &#8220;Notes on Structured Programming&#8221; (which we looked at back in Code Reads #4). So we&#8217;re on notice that this paper will draw heavily on the postmodern aesthetic of [...]</description>
		<content:encoded><![CDATA[<p>[...] Edsger Dijkstra&#8217;s &#8220;Notes on Structured Programming&#8221; (which we looked at back in Code Reads #4). So we&#8217;re on notice that this paper will draw heavily on the postmodern aesthetic of [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code Read 4 - Dijkstra&#8217;s Notes on Structured Programming &#187; Skillful Software</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-339</link>
		<dc:creator>Code Read 4 - Dijkstra&#8217;s Notes on Structured Programming &#187; Skillful Software</dc:creator>
		<pubDate>Mon, 28 May 2007 12:49:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-339</guid>
		<description>[...] W. Dijkstra&#8217;s &#8220;Notes on Structured Programming&#8220;, which is Code Read 4, stuck me as shockingly prescient - or perhaps it is just that we creators of software are very [...]</description>
		<content:encoded><![CDATA[<p>[...] W. Dijkstra&#8217;s &#8220;Notes on Structured Programming&#8220;, which is Code Read 4, stuck me as shockingly prescient &#8211; or perhaps it is just that we creators of software are very [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Code Read 4 - Dijkstra&#8217;s Notes Part Two &#187; Skillful Software</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-338</link>
		<dc:creator>Code Read 4 - Dijkstra&#8217;s Notes Part Two &#187; Skillful Software</dc:creator>
		<pubDate>Mon, 28 May 2007 12:49:05 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-338</guid>
		<description>[...] &#8220;Notes on Structured Programming&#8221; is definitely a meal. Its quite a lot for one Code Read. So I broke it into two parts. First, we had the appetizers, now here&#8217;s the main [...]</description>
		<content:encoded><![CDATA[<p>[...] &#8220;Notes on Structured Programming&#8221; is definitely a meal. Its quite a lot for one Code Read. So I broke it into two parts. First, we had the appetizers, now here&#8217;s the main [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel Neely</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-337</link>
		<dc:creator>Joel Neely</dc:creator>
		<pubDate>Tue, 19 Dec 2006 19:50:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-337</guid>
		<description>Boris, I must respond to two points, complex addition and black-box testing.

First, a single test cannot possibly suffice to demonstrate the correctness of a method intended to add complex numbers. For example (with apologies for the formatting; apparently WordPress kills leading whitespace):

public class Complex {
  public final int real;
  public final int imag;
  public Complex (int r, int i) {
    real = r;
    imag = i;
  }
  public Complex add(Complex c) {
    return new Complex(this.real + c.real, 0);
  }
}

This implementation is broken, yet it can survive an enormous number of tests (those which use only pure-real values, as well as those which add complex conjugates). A subtler form of breakage is illustrated by:

  public Complex add(Complex c) {
    short r = (short)(this.real + c.real);
    short i = (short)(this.imag + c.imag);
    return new Complex(r, i);
  }

which works nicely for small enough values, but breaks as soon as sufficiently-large values are introduced.

I think we&#039;d both agree that the flaws above are obvious as soon as one looks at the code (assuming one knows Java, of course ;-). I hope we&#039;d also agree that if one takes a black-box, try-and-see-what-happens approach, it could take a while to find that a problem exists, and even more time  to describe the circumstances in which the problem manifests itself.

It is important to remember that Dijkstra was writing in a time where (as one of my collegues put it) &quot;code your brains out and then debug it until it works&quot; was all too common an approach. I believe that reading a representative sample of his work (not just the one or two highly-publicized and controversial pieces) supports the view that Dijkstra was focusing almost entirely on the problems of correct DESIGN. I don&#039;t believe he was oblivious to the rest of the software development process, but I believe that he was working to make demonstrably-correct design the foundation of the rest of the process.

As to black boxes, Dijkstra didn&#039;t advocate of formal mathematical examination of completed designs. Instead, he argued forcefully (perhaps even stridently) in favor of letting the requirements of the proof drive the design decisions. From where I sit, there&#039;s a strong connection to the contemporary practice of test-driven development. While I am aware that there are still significant differences between formal proofs and operational tests, I see a common theme of &quot;let the obligation to verify the end product guide the way it is designed and built&quot;.

Although some of the challenges of computing in the 60s and 70s are not at the top of our list of concerns in 2006, I freely admit that I am inspired and motivated every time I go back and re-consider the visions many of the computing pioneers articulated. In some aspects we&#039;ve come a long way since those days, but in some others we have learned very little.</description>
		<content:encoded><![CDATA[<p>Boris, I must respond to two points, complex addition and black-box testing.</p>
<p>First, a single test cannot possibly suffice to demonstrate the correctness of a method intended to add complex numbers. For example (with apologies for the formatting; apparently WordPress kills leading whitespace):</p>
<p>public class Complex {<br />
  public final int real;<br />
  public final int imag;<br />
  public Complex (int r, int i) {<br />
    real = r;<br />
    imag = i;<br />
  }<br />
  public Complex add(Complex c) {<br />
    return new Complex(this.real + c.real, 0);<br />
  }<br />
}</p>
<p>This implementation is broken, yet it can survive an enormous number of tests (those which use only pure-real values, as well as those which add complex conjugates). A subtler form of breakage is illustrated by:</p>
<p>  public Complex add(Complex c) {<br />
    short r = (short)(this.real + c.real);<br />
    short i = (short)(this.imag + c.imag);<br />
    return new Complex(r, i);<br />
  }</p>
<p>which works nicely for small enough values, but breaks as soon as sufficiently-large values are introduced.</p>
<p>I think we&#8217;d both agree that the flaws above are obvious as soon as one looks at the code (assuming one knows Java, of course ;-). I hope we&#8217;d also agree that if one takes a black-box, try-and-see-what-happens approach, it could take a while to find that a problem exists, and even more time  to describe the circumstances in which the problem manifests itself.</p>
<p>It is important to remember that Dijkstra was writing in a time where (as one of my collegues put it) &#8220;code your brains out and then debug it until it works&#8221; was all too common an approach. I believe that reading a representative sample of his work (not just the one or two highly-publicized and controversial pieces) supports the view that Dijkstra was focusing almost entirely on the problems of correct DESIGN. I don&#8217;t believe he was oblivious to the rest of the software development process, but I believe that he was working to make demonstrably-correct design the foundation of the rest of the process.</p>
<p>As to black boxes, Dijkstra didn&#8217;t advocate of formal mathematical examination of completed designs. Instead, he argued forcefully (perhaps even stridently) in favor of letting the requirements of the proof drive the design decisions. From where I sit, there&#8217;s a strong connection to the contemporary practice of test-driven development. While I am aware that there are still significant differences between formal proofs and operational tests, I see a common theme of &#8220;let the obligation to verify the end product guide the way it is designed and built&#8221;.</p>
<p>Although some of the challenges of computing in the 60s and 70s are not at the top of our list of concerns in 2006, I freely admit that I am inspired and motivated every time I go back and re-consider the visions many of the computing pioneers articulated. In some aspects we&#8217;ve come a long way since those days, but in some others we have learned very little.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joel Neely</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-336</link>
		<dc:creator>Joel Neely</dc:creator>
		<pubDate>Tue, 19 Dec 2006 18:42:16 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-336</guid>
		<description>I&#039;d like to suggest that the &quot;imaginary hardware&quot; metaphor is actually highly similar to contemporary software development best practice. Although different writers/methodologies use varying terminology, one can view object-oriented programming from the perspective that each object is an &quot;imaginary computer&quot; with a specific set of responsibilities. A component at one level can be understood by how it utilizes the components &quot;below&quot; it, based on the FACT that each of them discharges its responsibilities (rather than on the MEANS by which they do so).

The extent to which these objects clearly separate the FACT/what from the MEANS/how (AKA interface from implementation, in some OOP approaches) is the extent to which we can replace a flawed component with a correct one, or replace a working component with another that is optimized differently (speed-vs-memory tradeoffs, etc.)

The extent to which these imaginary machines offer more general services, rather than special-cased ones, is the extent to which they are likely to be reusable in solving future problems.</description>
		<content:encoded><![CDATA[<p>I&#8217;d like to suggest that the &#8220;imaginary hardware&#8221; metaphor is actually highly similar to contemporary software development best practice. Although different writers/methodologies use varying terminology, one can view object-oriented programming from the perspective that each object is an &#8220;imaginary computer&#8221; with a specific set of responsibilities. A component at one level can be understood by how it utilizes the components &#8220;below&#8221; it, based on the FACT that each of them discharges its responsibilities (rather than on the MEANS by which they do so).</p>
<p>The extent to which these objects clearly separate the FACT/what from the MEANS/how (AKA interface from implementation, in some OOP approaches) is the extent to which we can replace a flawed component with a correct one, or replace a working component with another that is optimized differently (speed-vs-memory tradeoffs, etc.)</p>
<p>The extent to which these imaginary machines offer more general services, rather than special-cased ones, is the extent to which they are likely to be reusable in solving future problems.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cleo Saulnier</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-335</link>
		<dc:creator>Cleo Saulnier</dc:creator>
		<pubDate>Mon, 13 Nov 2006 03:08:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-335</guid>
		<description>Most of Dijkstra&#039;s paper sounded quite ancient except for the section by the name of &quot;On a program model&quot;.  He did not mean virtual machines in the contemporary sense.  In fact, a virtual machine like JVM or .net is actually the anti-thesis of what he was talking about.  What Dijkstra was talking about is that every sub-layer is responsible for making the upper layer work.  There is currently nothing like it in existance. This is the only section that had my heart beating faster because he was 37 years ahead of him time and still counting as it&#039;s still not available.  The simplest way to describe it is emulator on top of emulator, but where each level is finally converted to the actual hardware platform used (where the platform matters not).

Unfortunaly, most of his paper reflected on the complexity that control statements bring.  Even with his &quot;input; manipulation; output;&quot; program model, he could not get away from control statements.  He was on the verge of a great discovery 37 years ago.  He was going in the right direction all those years ago, but could not see the truth.

Had he used his &quot;input; manipulation; output;&quot; program model and left behind the notion of control statements, we would have quite a different world today.  The answers were available back then and this paper proves it.  Unfortunately, I believe that Dijkstra could not conceive of the &quot;manipulation&quot; part being anything other than using control statements.  This is a serious blow to the computing field.

I say now that this is the turning point in history that &quot;should have been&quot;.  Instead, we went down the wrong path.  I can say conclusively that we are at least 37 years behind the times as it relates to software development.  It is sad to see that he had the answers right before his eyes, but could not see it.  However, it is unfair to put responsability on one man.  No one else has been able to see the truth since... until now.  But it&#039;ll take another 30 years to become accepted even when it is finally revealed.</description>
		<content:encoded><![CDATA[<p>Most of Dijkstra&#8217;s paper sounded quite ancient except for the section by the name of &#8220;On a program model&#8221;.  He did not mean virtual machines in the contemporary sense.  In fact, a virtual machine like JVM or .net is actually the anti-thesis of what he was talking about.  What Dijkstra was talking about is that every sub-layer is responsible for making the upper layer work.  There is currently nothing like it in existance. This is the only section that had my heart beating faster because he was 37 years ahead of him time and still counting as it&#8217;s still not available.  The simplest way to describe it is emulator on top of emulator, but where each level is finally converted to the actual hardware platform used (where the platform matters not).</p>
<p>Unfortunaly, most of his paper reflected on the complexity that control statements bring.  Even with his &#8220;input; manipulation; output;&#8221; program model, he could not get away from control statements.  He was on the verge of a great discovery 37 years ago.  He was going in the right direction all those years ago, but could not see the truth.</p>
<p>Had he used his &#8220;input; manipulation; output;&#8221; program model and left behind the notion of control statements, we would have quite a different world today.  The answers were available back then and this paper proves it.  Unfortunately, I believe that Dijkstra could not conceive of the &#8220;manipulation&#8221; part being anything other than using control statements.  This is a serious blow to the computing field.</p>
<p>I say now that this is the turning point in history that &#8220;should have been&#8221;.  Instead, we went down the wrong path.  I can say conclusively that we are at least 37 years behind the times as it relates to software development.  It is sad to see that he had the answers right before his eyes, but could not see it.  However, it is unfair to put responsability on one man.  No one else has been able to see the truth since&#8230; until now.  But it&#8217;ll take another 30 years to become accepted even when it is finally revealed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-334</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Sun, 12 Nov 2006 09:48:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-334</guid>
		<description>Is it only my impression or Dijkstra really tries hard to make our profession as boring and mechanistic as it gets, refusing to address creativity, art, intuition and code esthetics :) ?</description>
		<content:encoded><![CDATA[<p>Is it only my impression or Dijkstra really tries hard to make our profession as boring and mechanistic as it gets, refusing to address creativity, art, intuition and code esthetics :) ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Slesinsky</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-333</link>
		<dc:creator>Brian Slesinsky</dc:creator>
		<pubDate>Wed, 08 Nov 2006 08:18:19 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-333</guid>
		<description>Having read further into the paper, I think the place where Dijkstra differs from modern programming practice is where he demonstrates a component&#039;s correctness using a proof.  That&#039;s pretty far from the mainstream these days - it&#039;s something academics study, but certainly not something that the average web programmer does.  (Although, refactoring is pretty closely related in that it&#039;s a series of mechanical steps to transform one program into another without changing what it does.)

I think the reason proofs have largely failed is that few customers or managers understand them.  The point is not to convince ourselves but rather to convince a boss or a customer, and a working demo is far more convincing.  It reminds me of a  famous Knuth quote: &quot;&quot;Beware of bugs in the above code; I have only proved it correct, not tried it.&#039;&#039;

On the other hand, I am pretty sympathetic towards making a language easy to prove things in; one of the reasons I like Java is that it seems easy to (informally) prove things to myself about some unfamiliar code I&#039;m reading.  But the &quot;hip&quot; programmers aren&#039;t into that - the cool thing to do seems to be to come up with increasingly obscure magic incantations in Ruby.</description>
		<content:encoded><![CDATA[<p>Having read further into the paper, I think the place where Dijkstra differs from modern programming practice is where he demonstrates a component&#8217;s correctness using a proof.  That&#8217;s pretty far from the mainstream these days &#8211; it&#8217;s something academics study, but certainly not something that the average web programmer does.  (Although, refactoring is pretty closely related in that it&#8217;s a series of mechanical steps to transform one program into another without changing what it does.)</p>
<p>I think the reason proofs have largely failed is that few customers or managers understand them.  The point is not to convince ourselves but rather to convince a boss or a customer, and a working demo is far more convincing.  It reminds me of a  famous Knuth quote: &#8220;&#8221;Beware of bugs in the above code; I have only proved it correct, not tried it.&#8221;</p>
<p>On the other hand, I am pretty sympathetic towards making a language easy to prove things in; one of the reasons I like Java is that it seems easy to (informally) prove things to myself about some unfamiliar code I&#8217;m reading.  But the &#8220;hip&#8221; programmers aren&#8217;t into that &#8211; the cool thing to do seems to be to come up with increasingly obscure magic incantations in Ruby.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Scott Rosenberg</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-332</link>
		<dc:creator>Scott Rosenberg</dc:creator>
		<pubDate>Tue, 07 Nov 2006 19:58:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-332</guid>
		<description>Brian: Of course you&#039;re right about virtual machines. I think that in reading Dijkstra I was thinking in a more literal-minded way about his own explanation of how he ended up working this way, writing for actual machines that simply weren&#039;t yet available. That just threw me right off the path of thinking about the technique of writing to a machine that is always going to remain an abstraction. Sometimes, for me at least, a powerful image or metaphor obscures something simple and obvious!</description>
		<content:encoded><![CDATA[<p>Brian: Of course you&#8217;re right about virtual machines. I think that in reading Dijkstra I was thinking in a more literal-minded way about his own explanation of how he ended up working this way, writing for actual machines that simply weren&#8217;t yet available. That just threw me right off the path of thinking about the technique of writing to a machine that is always going to remain an abstraction. Sometimes, for me at least, a powerful image or metaphor obscures something simple and obvious!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Boris</title>
		<link>http://www.wordyard.com/2006/11/06/dijkstra-notes/comment-page-1/#comment-331</link>
		<dc:creator>Boris</dc:creator>
		<pubDate>Tue, 07 Nov 2006 16:10:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.wordyard.com/?p=1160#comment-331</guid>
		<description>Dijkstra claims that to prove the correctness of a function will take an inifinte number of tests. Suppose though, I have a function that sums two complex numbers. For Dijsktra the only sufficient test will be running it on inifinite set of complex number, but for us, it is clear that one simple test will be sufficient.
It may be hard to understand but the act of writing the program itself is an attempt to prove that it is correct - with no math involved.
Dijkstra misses the point that testing comes ususally as an add-on of the prove which was already made by programmer in his head. It is not black box which is being tested. The difference between math and real programming is that right/wrong is not a black/white issue here but rather kind of scale. Even initially without any testing the program is quite correct enough - remember there are a lot of code out there which was not properly tested. Some basic test will throw it up the scale. The basic assumption is that something goes wrong it will go wrong totally, so that event simple tests will reveal it. And if it won&#039;t then it will be acceptable trade off for time and effort consuming mathematical proving of its correctness.</description>
		<content:encoded><![CDATA[<p>Dijkstra claims that to prove the correctness of a function will take an inifinte number of tests. Suppose though, I have a function that sums two complex numbers. For Dijsktra the only sufficient test will be running it on inifinite set of complex number, but for us, it is clear that one simple test will be sufficient.<br />
It may be hard to understand but the act of writing the program itself is an attempt to prove that it is correct &#8211; with no math involved.<br />
Dijkstra misses the point that testing comes ususally as an add-on of the prove which was already made by programmer in his head. It is not black box which is being tested. The difference between math and real programming is that right/wrong is not a black/white issue here but rather kind of scale. Even initially without any testing the program is quite correct enough &#8211; remember there are a lot of code out there which was not properly tested. Some basic test will throw it up the scale. The basic assumption is that something goes wrong it will go wrong totally, so that event simple tests will reveal it. And if it won&#8217;t then it will be acceptable trade off for time and effort consuming mathematical proving of its correctness.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
