<?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: Who reads code samples?</title>
	<atom:link href="http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/</link>
	<description>Some days, I feel like writing</description>
	<lastBuildDate>Tue, 16 Feb 2010 01:51:33 -0500</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Heimy</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2218</link>
		<dc:creator>Heimy</dc:creator>
		<pubDate>Tue, 10 Jun 2008 13:16:26 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2218</guid>
		<description>Well, we have comments and documentation strings, you know? ;). Actually, I prefer this:

&lt;blockquote&gt;

def rbf(v1,v2,gamma=20):
    &quot;&quot;&quot;rbf(\overrightarrow{v_1},\overrightarrow{v_2},\gamma):
           e^{-\gamma\&#124;\overrightarrow{v_2}-\overrightarrow{v_1}\&#124;}&quot;&quot;&quot;

    dv=[v1[i]-v2[i] for i in range(len(v1))]
    l=veclength(dv)
    return math.e**(-gamma*l)

&lt;/blockquote&gt;

or even better, use Numpy or similar module/library available to your preferred language that provides linear algebra and, assuming v1 and v2 are already Numpy arrays:

&lt;blockquote&gt;

from numpy import linalg

def rbf(v1,v2,gamma=20):
    &quot;&quot;&quot;rbf(\overrightarrow{v_1},\overrightarrow{v_2},\gamma):
           e^{-\gamma\&#124;\overrightarrow{v_2}-\overrightarrow{v_1}\&#124;}&quot;&quot;&quot;

    return math.e**(-gamma * linalg.norm(v2 - v1))

&lt;/blockquote&gt;

Of course, then we need to understand TeX syntax or have it handy, but who doesn&#039;t? O:)</description>
		<content:encoded><![CDATA[<p>Well, we have comments and documentation strings, you know? <img src='http://blog.lphuberdeau.com/wordpress/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> . Actually, I prefer this:</p>
<blockquote>
<p>def rbf(v1,v2,gamma=20):<br />
    &#8220;&#8221;"rbf(\overrightarrow{v_1},\overrightarrow{v_2},\gamma):<br />
           e^{-\gamma\|\overrightarrow{v_2}-\overrightarrow{v_1}\|}&#8221;"&#8221;</p>
<p>    dv=[v1[i]-v2[i] for i in range(len(v1))]<br />
    l=veclength(dv)<br />
    return math.e**(-gamma*l)</p>
</blockquote>
<p>or even better, use Numpy or similar module/library available to your preferred language that provides linear algebra and, assuming v1 and v2 are already Numpy arrays:</p>
<blockquote>
<p>from numpy import linalg</p>
<p>def rbf(v1,v2,gamma=20):<br />
    &#8220;&#8221;"rbf(\overrightarrow{v_1},\overrightarrow{v_2},\gamma):<br />
           e^{-\gamma\|\overrightarrow{v_2}-\overrightarrow{v_1}\|}&#8221;"&#8221;</p>
<p>    return math.e**(-gamma * linalg.norm(v2 &#8211; v1))</p>
</blockquote>
<p>Of course, then we need to understand TeX syntax or have it handy, but who doesn&#8217;t? O:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Daerin the Cluer</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2204</link>
		<dc:creator>Daerin the Cluer</dc:creator>
		<pubDate>Mon, 09 Jun 2008 05:11:53 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2204</guid>
		<description>Math notation does not, as was claimed above, show the purpose of a function. It shows a sequence of calculations, just like what you might enter into a computer, except with markings that can&#039;t be produced with a keyboard, in a syntax where fonts and formatting are even more significant than Python&#039;s significant whitespace. 

The apparent advantage of math notation comes from the fact that mathematicians MEMORIZE the formulae they use on  a regular basis.  This is what gives you the ability to &quot;see what the formula does&quot;. You don&#039;t really see what it does, you simply remember the formula, just as I remember the word &quot;gaussian&quot;. Programmers let the computer memorize the formulae they use regularly, so their brains are free to think about more important things.</description>
		<content:encoded><![CDATA[<p>Math notation does not, as was claimed above, show the purpose of a function. It shows a sequence of calculations, just like what you might enter into a computer, except with markings that can&#8217;t be produced with a keyboard, in a syntax where fonts and formatting are even more significant than Python&#8217;s significant whitespace. </p>
<p>The apparent advantage of math notation comes from the fact that mathematicians MEMORIZE the formulae they use on  a regular basis.  This is what gives you the ability to &#8220;see what the formula does&#8221;. You don&#8217;t really see what it does, you simply remember the formula, just as I remember the word &#8220;gaussian&#8221;. Programmers let the computer memorize the formulae they use regularly, so their brains are free to think about more important things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eric the Read</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2151</link>
		<dc:creator>Eric the Read</dc:creator>
		<pubDate>Wed, 04 Jun 2008 01:40:59 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2151</guid>
		<description>Seems to me when your complaint gets down to specifics; it&#039;s more about poorly-edited code examples than code examples per se.  I agree with you that unless you&#039;re writing a book about authenticating to eBay or Facebook, you shouldn&#039;t have to wade through code explaining how to do that.  You&#039;re absolutely right; that sort of thing is for (well-commented) libraries.

While I agree a good programmer ought to be able to read mathematical notation if he&#039;s working in a mathematical arena, I consider that just the basic domain knowledge required for any specialized programming.  For me, I often find it easier to see patterns and relationships in code than some forumulae.  I don&#039;t find your assertions to the contrary very convincing.</description>
		<content:encoded><![CDATA[<p>Seems to me when your complaint gets down to specifics; it&#8217;s more about poorly-edited code examples than code examples per se.  I agree with you that unless you&#8217;re writing a book about authenticating to eBay or Facebook, you shouldn&#8217;t have to wade through code explaining how to do that.  You&#8217;re absolutely right; that sort of thing is for (well-commented) libraries.</p>
<p>While I agree a good programmer ought to be able to read mathematical notation if he&#8217;s working in a mathematical arena, I consider that just the basic domain knowledge required for any specialized programming.  For me, I often find it easier to see patterns and relationships in code than some forumulae.  I don&#8217;t find your assertions to the contrary very convincing.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis-Philippe Huberdeau</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2150</link>
		<dc:creator>Louis-Philippe Huberdeau</dc:creator>
		<pubDate>Wed, 04 Jun 2008 00:51:31 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2150</guid>
		<description>My point is that the representation highlights patterns better and allows to see the relationships much faster. You can then mix your own improvements and extend beyond the examples.

Being rusted in math is nothing insulting. When I go back to C, I am rusted too. Doesn&#039;t mean I shouldn&#039;t make the effort to understand it, even if it means getting a refresher. If you never did math, well the best you can do with those problems is copy the code anyway, so you could be saved a step by getting it online. This has nothing to do with notations. The theory is complex and you need some background to fully get the details. Sorry. I first started programming when I was a teenager. The great thing about programming is that anyone can learn it by themselves because there is plenty of documentation available. But face it, if you did not spend 7 years in school learning some of the theory, some things may be out of your reach until you spend some time learning on your own, the same way some things remain out of your reach when you get out of school. Some problems need more learning than others.

I don&#039;t get the point that the book should be trying to explain something to non-mathematicians. I am learning a lot reading it. I knew the functions before. I just never would have thought using them in that way. This is about applying theory to a different context.

It&#039;s not only about the math part of it. By chapter 7, you should have figured out how to load data in an array. No need to explain that code again for the specific problem. Put it online if you wish to save some time when trying it out, but no need to explain the details. No need to spend two pages explaining how to authenticate to ebay or Facebook webservices. The code is written and static. Put it in a library and tell people to use it for the sake of the example. Focus on the important topics, things that matter. This kind of redundancy annoys me. The same applies to math functions in code. If you add a single term, you don&#039;t need to rewrite the entire code again. With the math formula visible, you can quickly see the difference and it does not take half a page to display and a full page to explain.

Oh, and I don&#039;t know anything about Haskell, but I guess with a sufficient primer, it would do just as good. It&#039;s not against python, it&#039;s against the abusive amounts of code on pages that numb my brain and keep me away from focussing on what I want to learn.

Any clearer?</description>
		<content:encoded><![CDATA[<p>My point is that the representation highlights patterns better and allows to see the relationships much faster. You can then mix your own improvements and extend beyond the examples.</p>
<p>Being rusted in math is nothing insulting. When I go back to C, I am rusted too. Doesn&#8217;t mean I shouldn&#8217;t make the effort to understand it, even if it means getting a refresher. If you never did math, well the best you can do with those problems is copy the code anyway, so you could be saved a step by getting it online. This has nothing to do with notations. The theory is complex and you need some background to fully get the details. Sorry. I first started programming when I was a teenager. The great thing about programming is that anyone can learn it by themselves because there is plenty of documentation available. But face it, if you did not spend 7 years in school learning some of the theory, some things may be out of your reach until you spend some time learning on your own, the same way some things remain out of your reach when you get out of school. Some problems need more learning than others.</p>
<p>I don&#8217;t get the point that the book should be trying to explain something to non-mathematicians. I am learning a lot reading it. I knew the functions before. I just never would have thought using them in that way. This is about applying theory to a different context.</p>
<p>It&#8217;s not only about the math part of it. By chapter 7, you should have figured out how to load data in an array. No need to explain that code again for the specific problem. Put it online if you wish to save some time when trying it out, but no need to explain the details. No need to spend two pages explaining how to authenticate to ebay or Facebook webservices. The code is written and static. Put it in a library and tell people to use it for the sake of the example. Focus on the important topics, things that matter. This kind of redundancy annoys me. The same applies to math functions in code. If you add a single term, you don&#8217;t need to rewrite the entire code again. With the math formula visible, you can quickly see the difference and it does not take half a page to display and a full page to explain.</p>
<p>Oh, and I don&#8217;t know anything about Haskell, but I guess with a sufficient primer, it would do just as good. It&#8217;s not against python, it&#8217;s against the abusive amounts of code on pages that numb my brain and keep me away from focussing on what I want to learn.</p>
<p>Any clearer?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rgz</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2149</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Wed, 04 Jun 2008 00:20:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2149</guid>
		<description>Actually I don&#039;t get that picture at all unless I know that x = range(40) (or x = 0..40 for rubists) but that&#039;s besides the point.

But really, the expression doesn&#039;t look at all like the plot regardless of the language used to express it only looks, you give the impression that you  think that the formula inherently looks like the plot. This not what you are saying exactly, because you realize the only reason the formula suggest this shape to you is because you have a background in mathematics, where you have seen this plot-shape besides this formula-shape many times with many variations.

What you are saying -if I&#039;m getting you right- is that if you are capable of understanding this graphic is because you have studied it in a math class where you learned the formula and thus can spare the code.

 The implication being that if you didn&#039;t study (or can&#039;t remember) math  you have no business reading this book.because you won&#039;t understand what it says. Besides being rude, it&#039;s a weird claim to make about a book that tries to explain math to non-mathematicians.

 That is the reason you words are taken to an extreme, you are offending many people right know.

(Communicating you this is the purpose of this comment by the way, and of course you are free to offend as many people as you want.)

 Can you conceive of the possibility of there being other math notations besides the one you learned in school? (Or are you suggesting that indeed the traditional notation is indeed perfect and absolute instead or arbitrary?)
 If you can conceive of the possibility of alternate notation systems the you can conceive of the possibility of people learning math in those notations, so let them be.

 Slightly changing the topic, would you be any less anal about it if the author used Haskell instead of Python in the code samples?</description>
		<content:encoded><![CDATA[<p>Actually I don&#8217;t get that picture at all unless I know that x = range(40) (or x = 0..40 for rubists) but that&#8217;s besides the point.</p>
<p>But really, the expression doesn&#8217;t look at all like the plot regardless of the language used to express it only looks, you give the impression that you  think that the formula inherently looks like the plot. This not what you are saying exactly, because you realize the only reason the formula suggest this shape to you is because you have a background in mathematics, where you have seen this plot-shape besides this formula-shape many times with many variations.</p>
<p>What you are saying -if I&#8217;m getting you right- is that if you are capable of understanding this graphic is because you have studied it in a math class where you learned the formula and thus can spare the code.</p>
<p> The implication being that if you didn&#8217;t study (or can&#8217;t remember) math  you have no business reading this book.because you won&#8217;t understand what it says. Besides being rude, it&#8217;s a weird claim to make about a book that tries to explain math to non-mathematicians.</p>
<p> That is the reason you words are taken to an extreme, you are offending many people right know.</p>
<p>(Communicating you this is the purpose of this comment by the way, and of course you are free to offend as many people as you want.)</p>
<p> Can you conceive of the possibility of there being other math notations besides the one you learned in school? (Or are you suggesting that indeed the traditional notation is indeed perfect and absolute instead or arbitrary?)<br />
 If you can conceive of the possibility of alternate notation systems the you can conceive of the possibility of people learning math in those notations, so let them be.</p>
<p> Slightly changing the topic, would you be any less anal about it if the author used Haskell instead of Python in the code samples?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis-Philippe Huberdeau</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2147</link>
		<dc:creator>Louis-Philippe Huberdeau</dc:creator>
		<pubDate>Tue, 03 Jun 2008 22:02:16 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2147</guid>
		<description>Well, it&#039;s just that I don&#039;t really have the idea those defending code understand what I mean at all. Hard to have a dialogue when both parties talk about different issues. Plus, my words seem to have been taken as an extreme, which is not the case.

I&#039;ll try to illustrate better. When I see the gaussian formula, this is what I see (or I can plot it really easily):

&lt;img src=&quot;http://blog.lphuberdeau.com/gaussian.png&quot;/&gt;

When I look at code, I actually have to think for a while before I get to that picture. Without that picture in mind, you can read the code and understand how it executes, but understanding the execution and understanding the purpose is very far away. Certainly there are cases where you need code to show the execution, but when you try to correlate data, the purpose is much more important. It does not really matter how the code executes, what it does is important.

There are not so many common formula forms, but when you know them, you can get a much quicker grasp of the visual solution. It&#039;s much easier to see that the point of that weight multiplier is to give significant weight to points near and decrease quite fast, but never reach 0. I could decide to change this for a log and favor large distances. Can you actually get that kind of picture reading code? I think that if you do, you probably have enough background to understand the formula in the first place and spare yourself the code interpretation and transformation back to the formula.

This really does not apply to any kind of code.</description>
		<content:encoded><![CDATA[<p>Well, it&#8217;s just that I don&#8217;t really have the idea those defending code understand what I mean at all. Hard to have a dialogue when both parties talk about different issues. Plus, my words seem to have been taken as an extreme, which is not the case.</p>
<p>I&#8217;ll try to illustrate better. When I see the gaussian formula, this is what I see (or I can plot it really easily):</p>
<p><img src="http://blog.lphuberdeau.com/gaussian.png"/></p>
<p>When I look at code, I actually have to think for a while before I get to that picture. Without that picture in mind, you can read the code and understand how it executes, but understanding the execution and understanding the purpose is very far away. Certainly there are cases where you need code to show the execution, but when you try to correlate data, the purpose is much more important. It does not really matter how the code executes, what it does is important.</p>
<p>There are not so many common formula forms, but when you know them, you can get a much quicker grasp of the visual solution. It&#8217;s much easier to see that the point of that weight multiplier is to give significant weight to points near and decrease quite fast, but never reach 0. I could decide to change this for a log and favor large distances. Can you actually get that kind of picture reading code? I think that if you do, you probably have enough background to understand the formula in the first place and spare yourself the code interpretation and transformation back to the formula.</p>
<p>This really does not apply to any kind of code.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rgz</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2145</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Tue, 03 Jun 2008 21:31:02 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2145</guid>
		<description>1) Nowhere I asked you to keep your opinions for yourself, let alone -in your own blog- All I did is ask why  do you insist on keeping this position, is a valid thing to ask. 

 As far as I understand this is your position, that it doesn&#039;t matter how many people come and tell you that code is better for them and helps them understand the book, you still insist that traditional notation is best for everybody and so the book still should not include code samples, or at least not beyond the introductory chapters.

 2) Thanks, this is the actual answer to my question, you feel you waste your time reading the same thing twice, I would also feel I&#039;m wasting my time reading the same thing twice, when I find a multilingual instruction manuals I don&#039;t read it in as many languages I can, just the one I can read the best, this is only a suggestion, why don&#039;t you do the same? (This one is not actually a question. (This is not a sarcasm disclaimer either.))

3) And let me quote &quot;At this point, no one said they were reading all code samples, they only said they preferred it over maths.&quot;

 Oh come on! This is a petty rhetoric, I guess you are having a fun time dissecting the second paragraph in this comment, counting in how many ways it is not exactly and literally what you said.

 You are clearly not interested in a constructive dialog...</description>
		<content:encoded><![CDATA[<p>1) Nowhere I asked you to keep your opinions for yourself, let alone -in your own blog- All I did is ask why  do you insist on keeping this position, is a valid thing to ask. </p>
<p> As far as I understand this is your position, that it doesn&#8217;t matter how many people come and tell you that code is better for them and helps them understand the book, you still insist that traditional notation is best for everybody and so the book still should not include code samples, or at least not beyond the introductory chapters.</p>
<p> 2) Thanks, this is the actual answer to my question, you feel you waste your time reading the same thing twice, I would also feel I&#8217;m wasting my time reading the same thing twice, when I find a multilingual instruction manuals I don&#8217;t read it in as many languages I can, just the one I can read the best, this is only a suggestion, why don&#8217;t you do the same? (This one is not actually a question. (This is not a sarcasm disclaimer either.))</p>
<p>3) And let me quote &#8220;At this point, no one said they were reading all code samples, they only said they preferred it over maths.&#8221;</p>
<p> Oh come on! This is a petty rhetoric, I guess you are having a fun time dissecting the second paragraph in this comment, counting in how many ways it is not exactly and literally what you said.</p>
<p> You are clearly not interested in a constructive dialog&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Louis-Philippe Huberdeau</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2142</link>
		<dc:creator>Louis-Philippe Huberdeau</dc:creator>
		<pubDate>Tue, 03 Jun 2008 16:25:41 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2142</guid>
		<description>rgz: If you&#039;re not happy with my opinion, feel free not to read it. This is not slashdot, no need to flame.

When half the pages consist of code samples, some of which not being relevant because they are merely incremental, I feel I waste time reading.

At this point, no one said they were reading all code samples, they only said they preferred it over maths.</description>
		<content:encoded><![CDATA[<p>rgz: If you&#8217;re not happy with my opinion, feel free not to read it. This is not slashdot, no need to flame.</p>
<p>When half the pages consist of code samples, some of which not being relevant because they are merely incremental, I feel I waste time reading.</p>
<p>At this point, no one said they were reading all code samples, they only said they preferred it over maths.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: rgz</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2141</link>
		<dc:creator>rgz</dc:creator>
		<pubDate>Tue, 03 Jun 2008 16:18:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2141</guid>
		<description>Sorry but what is your complaint again? Is the weight of the paper used in the python samples causing you back pains? The code makes this book -for programmers- more readable -for programmers- and you are telling me this is a bad thing because...?

 You start by claiming nobody reads code samples (the article&#039;s title implies so). People come and state they do. You are proven wrong in one single step. Why are you still arguing?

 Time would be better spent discussing what language should have been used. If they are aiming at the widest audience Javascript would have been perfect.</description>
		<content:encoded><![CDATA[<p>Sorry but what is your complaint again? Is the weight of the paper used in the python samples causing you back pains? The code makes this book -for programmers- more readable -for programmers- and you are telling me this is a bad thing because&#8230;?</p>
<p> You start by claiming nobody reads code samples (the article&#8217;s title implies so). People come and state they do. You are proven wrong in one single step. Why are you still arguing?</p>
<p> Time would be better spent discussing what language should have been used. If they are aiming at the widest audience Javascript would have been perfect.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Lucian</title>
		<link>http://blog.lphuberdeau.com/wordpress/2008/06/01/who-reads-code-samples/comment-page-1/#comment-2140</link>
		<dc:creator>Lucian</dc:creator>
		<pubDate>Tue, 03 Jun 2008 15:26:17 +0000</pubDate>
		<guid isPermaLink="false">http://blog.lphuberdeau.com/wordpress/?p=150#comment-2140</guid>
		<description>I&#039;m decent at math, but even the first example is much clearer in python code, as non-idiomatic as it may be. The second one doesn&#039;t even compare.</description>
		<content:encoded><![CDATA[<p>I&#8217;m decent at math, but even the first example is much clearer in python code, as non-idiomatic as it may be. The second one doesn&#8217;t even compare.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
