Example Code, Redux

Thursday, March 31, 2005

I’m still trying to rationalize the existence of example code. You know, the poison pills programmers copy and paste into an otherwise healthy body of software.

Sometime today, I was thinking back my first physics class, and of three key idealizations. These idealizations have helped students learn physics since the debut of Principia Mathematica in the 1680s.

The idealizations are:

  The immoveable object.
  The irresistible force.
  The frictionless surface.

Of course, nobody actually builds bridges or launches rockets using irresistible forces and frictionless surfaces, but the concepts do make the first chapters in a physics textbook easier, and we learn from them. If there are parallels to these idealizations in the sample code on MSDN, in books, and on this blog, they would be:

  The never-null parameter.
  The always-on network.
  The perfect string of user input.

We learn from them.


Comments
Darrell Thursday, March 31, 2005
The perfect string of user input, good one. :)
yipyip Thursday, March 31, 2005
But in physics, the student does proceed through more complex and more accurate models of the real world until one is able to build a bridge, as you say. Friction is introduced, for example, way back in high school.
<br>
<br>In software, where is the corresponding learning/training curve? Where does Joe self-taught or Bob university student go to develop his abilities from the frictionless ideal to the real-world mess?
<br>
<br>What I'm trying to say is that for the vast majority of people in the world who write software, they're not lucky enough to be mentored by competent, experienced people. So they turn to examples to see what they should be doing.
<br>
<br>But there are just about no examples between the &quot;immovable force&quot; and &quot;bridge building&quot; levels in software.
bill Saturday, April 2, 2005
You deserve a nobel prize - this post is brilliant!
Brian H. Madsen Saturday, April 2, 2005
Scott:
<br>
<br>What i found funny here is that you actually see people using the exact same code as is found in books in full faith that it's &quot;good&quot; code.
<br>
<br>If ever you confronted a developoer on the topic and you get the &quot;bleary/blank eyes of no compute&quot; from the developer, you know you've found yourself a person who simply does not know what he/she is coding up.
<br>
<br>shame really - i mean, example code is just that, examples..
<br>
<br>anyways, last comment..&quot;the perfect string of user input....&quot;...OMG!! i'm going to have to print that and hang it on my office wall!
Beth Friday, April 8, 2005
the never-null parameter. HA HA!
<br>
Tobin Titus Sunday, July 24, 2005
amen brother! thank you!
Comments are now closed.
by K. Scott Allen K.Scott Allen
My Pluralsight Courses
The Podcast!