<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx</link><description>In my youth I once attended a lecture given by Brian Kernighan on the subject of code quality, which was very influential on my attitudes towards writing legible code. One of the things that Kernighan recommended was to endeavour write code that was so</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#9636211</link><pubDate>Sat, 23 May 2009 02:08:25 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9636211</guid><dc:creator>Tom Allen</dc:creator><description>&lt;p&gt;30 years ago my brother, Mark, worked on a new HP desktop calculator called the 9825. &amp;nbsp;it had a new feature and a new button with a symbol much like &amp;quot;=&amp;gt;&amp;quot;; he named it the &amp;quot;gazinta&amp;quot; key. &amp;nbsp;(as in, &amp;quot;goes in to&amp;quot;). &amp;nbsp;Why not create a new name for this feature and call it &amp;quot;gazinta&amp;quot;?&lt;/p&gt;
&lt;p&gt;+tom&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9636211" width="1" height="1"&gt;</description></item><item><title>VCS Team Links for May 22, 2008</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8533282</link><pubDate>Thu, 22 May 2008 22:04:24 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8533282</guid><dc:creator>Charlie Calvert's Community Blog</dc:creator><description>&lt;p&gt;Rather than place the links to the most recent C# team content directly in Community Convergence, I have&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8533282" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8519390</link><pubDate>Mon, 19 May 2008 21:02:43 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519390</guid><dc:creator>Tim</dc:creator><description>&lt;p&gt;So how well does the &amp;quot;c&amp;quot; read over the phone? What does see mean? Vision? Sea? Si (Spanish)? Yes dot name? The Atlantic ocean dot name? Or is it the Gulf of Mexico we're talking about?&lt;/p&gt;
&lt;p&gt;What is it with lambda expressions (and linq) that dictate that we should start writing unreadable code?&lt;/p&gt;
&lt;p&gt;Do you use variable names like &amp;quot;c&amp;quot; and &amp;quot;s&amp;quot; elsewhere?&lt;/p&gt;
&lt;p&gt;Especially with linq, when I look a query with all those single character variables I have to unnecessarily use extra brain cycles to map what those meaningless single char variables mean. I should be able to understand what every part of a lambda expression is doing without having to go back and map what those variables refer to.&lt;/p&gt;
&lt;p&gt;With intellisense and Resharper there's just no excuse to be writing code like that.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8519390" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8519209</link><pubDate>Mon, 19 May 2008 19:17:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519209</guid><dc:creator>Parker Hillius</dc:creator><description>&lt;p&gt;For a predicate, (Customer c)=&amp;gt;c.Age &amp;gt; 21: &amp;quot;customer see such that see dot age is greater than twenty-one&amp;quot;&lt;/p&gt;
&lt;p&gt;I would say &amp;quot;customer c where c dot age is greater than twenty-one&amp;quot;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8519209" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8519014</link><pubDate>Mon, 19 May 2008 16:14:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8519014</guid><dc:creator>Richard</dc:creator><description>&lt;p&gt;@Stephan:&lt;/p&gt;
&lt;p&gt;I suppose you could read it how it lexes. So &amp;quot;if a is greater than 5, then foo of a, dedent. bar of a&amp;quot;. Though what you say doesn't have to be a literal transcription of the syntax -- I think I'd probably say &amp;quot;end if&amp;quot; or similar...&lt;/p&gt;
&lt;p&gt;As for (Customer c) =&amp;gt; (c.Age &amp;gt; 5), I think I'd say &amp;quot;lambda customer see to see dot age greater than five&amp;quot;. I might not say the &amp;quot;lambda&amp;quot; if it's clear what I mean without it.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8519014" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8517535</link><pubDate>Sat, 17 May 2008 19:21:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8517535</guid><dc:creator>Stephan Leclercq</dc:creator><description>&lt;p&gt;Just another &amp;quot;silly&amp;quot; question :-) how would you read Python code indentation over the phone ?&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8517535" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8517494</link><pubDate>Sat, 17 May 2008 18:52:55 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8517494</guid><dc:creator>Eric Lippert</dc:creator><description>&lt;p&gt;So if you were reading a recipe to someone over the phone, you wouldn't say &amp;quot;add two tablespoons of baking powder&amp;quot;, you'd say &amp;quot;add two T-B-S-P-S of baking powder&amp;quot;?&lt;/p&gt;
&lt;p&gt;My point, and Kernighan's point, which I seem to not have made very clear, was not about actually solving the problem of reading code over the phone to someone who is not fluent in the language. No one actually has to do that!&lt;/p&gt;
&lt;p&gt;Rather, it was intended to be a thought experiment that makes you think about whether the logic and structure of the code is sufficiently clear that it could be read aloud and understood WITHOUT having to write it down on the other end. &lt;/p&gt;
&lt;p&gt;So, for example, were I to read the code&lt;/p&gt;
&lt;p&gt;for (int i = 0; i &amp;lt; 10 ; ++i) Console.WriteLine(i);&lt;/p&gt;
&lt;p&gt;I'd read that aloud as &amp;quot;for eye from zero to nine, console dot writeline eye&amp;quot;. That gets across the meaning of the code, which, after all, is what we're attempting to communicate. And then when reading it aloud, one might notice that&lt;/p&gt;
&lt;p&gt;foreach(int i in Range(0, 10)) Console.WriteLine(i); &lt;/p&gt;
&lt;p&gt;would ALSO be read aloud the same way. Which is good, because these two blocks of code express the same idea.&lt;/p&gt;
&lt;p&gt;It is precisely those expressions which cannot be read aloud and understood without spelling them out character by character and writing them down on the other end which are sufficiently hard to understand to warrant at least considering rewriting them to be more understandable. &amp;nbsp;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8517494" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8517405</link><pubDate>Sat, 17 May 2008 17:52:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8517405</guid><dc:creator>ANARCHY-TV.COM</dc:creator><description>&lt;p&gt;Your method would only work with a C programmer who was on the *exact* same wavelength as you. &amp;nbsp;Even many C programmers would be clueless as to what you are say. &amp;nbsp; So like your method abnd logic = FAIL. &amp;nbsp; &lt;/p&gt;
&lt;p&gt;What if you were reading the same code to a secretary, or your Dilbert managemetn boss, or a high school teenager taking a programming class, or your mother learning to program? &amp;nbsp;They would have no clue what you were talking about.&lt;/p&gt;
&lt;p&gt;Reading over the telephone, you need to spell it out exactly as its keyboard character names.... &amp;nbsp; below is how I would do it in English, other languages of course would vary to their approapriate keyboard symbol names:&lt;/p&gt;
&lt;p&gt;sea &amp;lt;pause&amp;gt; equals sign &amp;lt;pause&amp;gt; greater than sign &amp;lt;pause&amp;gt; sea &amp;lt;pause&amp;gt; plus sign &amp;lt;pause&amp;gt; one&lt;/p&gt;
&lt;p&gt;I stress the inclusion of pauses of silence, to give the person on the other side to process the symbol in their brain, locate it on the keyboard, and press it, and mainly, to deliminate each individual symbol from the previous and the next, for many symbols are expressed not as a single word (ie, asterix) but as a string of words (ie, greater than symbol)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8517405" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8517238</link><pubDate>Sat, 17 May 2008 15:31:21 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8517238</guid><dc:creator>Anthony Jones</dc:creator><description>&lt;p&gt;For over a decade (and then some) I've written code in VB and I never found a use for Imp or Eqv even when I tried to invent one. &amp;nbsp;Perhaps thats the reason they're not in VB.NET ;)&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8517238" width="1" height="1"&gt;</description></item><item><title>re: Reading Code Over the Telephone</title><link>http://blogs.msdn.com/b/ericlippert/archive/2008/05/16/reading-code-over-the-telephone.aspx#8516907</link><pubDate>Sat, 17 May 2008 11:11:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8516907</guid><dc:creator>Olmo</dc:creator><description>&lt;p&gt;I usualy translate &lt;/p&gt;
&lt;p&gt;{ParameterList} =&amp;gt; {Lambda Body}&lt;/p&gt;
&lt;p&gt;for &lt;/p&gt;
&lt;p&gt;given a {ParameterList}, {Lambda Body}&lt;/p&gt;
&lt;p&gt;with nothing in the middle but a comma. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8516907" width="1" height="1"&gt;</description></item></channel></rss>