<?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"
	>
<channel>
	<title>Comments on: What&#8217;s your level of code assertions?</title>
	<atom:link href="http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/</link>
	<description>Web development and Internet trends</description>
	<pubDate>Tue, 06 Jan 2009 11:08:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.1</generator>
		<item>
		<title>By: Summer break - Robert&#8217;s talk - Web development and Internet trends</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-301965</link>
		<dc:creator>Summer break - Robert&#8217;s talk - Web development and Internet trends</dc:creator>
		<pubDate>Thu, 12 Jun 2008 23:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-301965</guid>
		<description>[...] What’s your level of code assertions? [...]</description>
		<content:encoded><![CDATA[<p>[...] What’s your level of code assertions? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: DOMAssistant 2.5.6 released - AJAX module post method has been fixed - Robert&#8217;s talk - Web development and Internet trends</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-184804</link>
		<dc:creator>DOMAssistant 2.5.6 released - AJAX module post method has been fixed - Robert&#8217;s talk - Web development and Internet trends</dc:creator>
		<pubDate>Mon, 14 Jan 2008 08:19:35 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-184804</guid>
		<description>[...] stripped the URL in AJAX GET requests as well. Something I knew, but that&#8217;s what I get for preaching about assertions but not applying it properly to my own code. I guess my intuition took overhand for a [...]</description>
		<content:encoded><![CDATA[<p>[...] stripped the <acronym title="Uniform Resource Locator">URL</acronym> in <acronym title="Asynchronous Javascript and XML">AJAX</acronym> GET requests as well. Something I knew, but that&#8217;s what I get for preaching about assertions but not applying it properly to my own code. I guess my intuition took overhand for a [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-180363</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Wed, 09 Jan 2008 12:59:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-180363</guid>
		<description>Jakob,

Absolutely, JsUnit is a good advice!

Mikael,

Yes, I think I use the "savage" approach from time to time as well. You just want to test the concept, and eventually, in the second or third stage, the code actually gets good.

But I guess this is one of the reason why agile development has become so popular. You want to try things out for a while, and then you're absolutely open to change your first impression, since you learned a number of things along the path.</description>
		<content:encoded><![CDATA[<p>Jakob,</p>
<p>Absolutely, JsUnit is a good advice!</p>
<p>Mikael,</p>
<p>Yes, I think I use the &#8220;savage&#8221; approach from time to time as well. You just want to test the concept, and eventually, in the second or third stage, the code actually gets good.</p>
<p>But I guess this is one of the reason why agile development has become so popular. You want to try things out for a while, and then you&#8217;re absolutely open to change your first impression, since you learned a number of things along the path.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mikael Bergkvist</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-180317</link>
		<dc:creator>Mikael Bergkvist</dc:creator>
		<pubDate>Wed, 09 Jan 2008 11:40:54 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-180317</guid>
		<description>I'm one of those coders that write the code until it just works regardless if it's *good* or *bad*, like a savage, sometimes (mostly) it's just horrible, and then I usually wait a while and then go back, fixing the stuff that's lazy, overly complicated, repeative or just plain wierd.
Mostly there are no assertions in the code at this stage.
Often I realise during the second stage, that the code I had written is nothing short of really horrible, and that it was probably just a lucky accident that it worked to begin with.
The first go-round is like a sketch for me, I'm just looking for it to do something that I want.
Then - after a while - I go back to the horror that is my coding, and essentially spend time doing nothing but 'saving  it' back to something that's not completely offensive to the human mind.  
I've tried to change my ways, but I always fall back into this procedure nomatter what I do.
However, this particular issue is one of those 'things' that always pop up somewhere during that second phase of rewriting.
Thanks for posting about it.</description>
		<content:encoded><![CDATA[<p>I&#8217;m one of those coders that write the code until it just works regardless if it&#8217;s *good* or *bad*, like a savage, sometimes (mostly) it&#8217;s just horrible, and then I usually wait a while and then go back, fixing the stuff that&#8217;s lazy, overly complicated, repeative or just plain wierd.<br />
Mostly there are no assertions in the code at this stage.<br />
Often I realise during the second stage, that the code I had written is nothing short of really horrible, and that it was probably just a lucky accident that it worked to begin with.<br />
The first go-round is like a sketch for me, I&#8217;m just looking for it to do something that I want.<br />
Then - after a while - I go back to the horror that is my coding, and essentially spend time doing nothing but &#8217;saving  it&#8217; back to something that&#8217;s not completely offensive to the human mind.<br />
I&#8217;ve tried to change my ways, but I always fall back into this procedure nomatter what I do.<br />
However, this particular issue is one of those &#8216;things&#8217; that always <acronym title="Short for POP3, the Post Office Protocol for email">POP</acronym> up somewhere during that second phase of rewriting.<br />
Thanks for posting about it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jakob Heuser</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179589</link>
		<dc:creator>Jakob Heuser</dc:creator>
		<pubDate>Tue, 08 Jan 2008 17:13:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179589</guid>
		<description>Assertions are at the core of unit testing. There's nothing quite as satisfying as writing your expected behavior, then writing the code itself.

JS has finally reached a point where it's testing frameworks are maturing properly. http://www.jsunit.net/ is one of the more prominent ones, and I believe YUI has also fleshed out their testing framework in the most recent version.</description>
		<content:encoded><![CDATA[<p>Assertions are at the core of unit testing. There&#8217;s nothing quite as satisfying as writing your expected behavior, then writing the code itself.</p>
<p>JS has finally reached a point where it&#8217;s testing frameworks are maturing properly. <a href="http://www.jsunit.net/" rel="nofollow">http://www.jsunit.net/</a> is one of the more prominent ones, and I believe YUI has also fleshed out their testing framework in the most recent version.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179549</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 08 Jan 2008 15:58:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179549</guid>
		<description>Brian,

Thank you!
I agree, to a certain extent. There re certain scenarios where assertions is just a given; not having them there wouldn't be doing your job properly. 

But there's definitely other cases where you want the code to fail, to know what assertions to apply accordingly. I like to stress test my code to know when things hit the brick wall, so I can make sure it won't when being deployed live.</description>
		<content:encoded><![CDATA[<p>Brian,</p>
<p>Thank you!<br />
I agree, to a certain extent. There re certain scenarios where assertions is just a given; not having them there wouldn&#8217;t be doing your job properly. </p>
<p>But there&#8217;s definitely other cases where you want the code to fail, to know what assertions to apply accordingly. I like to stress test my code to know when things hit the brick wall, so I can make sure it won&#8217;t when being deployed live.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brian Reindel</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179527</link>
		<dc:creator>Brian Reindel</dc:creator>
		<pubDate>Tue, 08 Jan 2008 15:26:27 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179527</guid>
		<description>Hey Robert,

This was a great read, and a post that can be easily understood by all levels of JavaScript programmers.

My only suggestion would be: do not begin with assertions, but be sure that your production-ready code contains assertions. The only reason I mention this, is that often I want to know when something went wrong, when it should not. Getting an "object undefined" error can be a helpful tool in debugging your scripts. However, if you do object detection from the get-go, nothing happens. The same is true with try/catch -- IMHO these should be used as "I might have forgot a use-case scenario insurance policy" on a live site.

Again, great post.</description>
		<content:encoded><![CDATA[<p>Hey Robert,</p>
<p>This was a great read, and a post that can be easily understood by all levels of JavaScript programmers.</p>
<p>My only suggestion would be: do not begin with assertions, but be sure that your production-ready code contains assertions. The only reason I mention this, is that often I want to know when something went wrong, when it should not. Getting an &#8220;object undefined&#8221; error can be a helpful tool in debugging your scripts. However, if you do object detection from the get-go, nothing happens. The same is true with try/catch &#8212; IMHO these should be used as &#8220;I might have forgot a use-case scenario insurance policy&#8221; on a live site.</p>
<p>Again, great post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Robert Nyman</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179347</link>
		<dc:creator>Robert Nyman</dc:creator>
		<pubDate>Tue, 08 Jan 2008 11:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179347</guid>
		<description>Anders,

Sounds like a great idea! I'm very impulsive myself, but there are times where I wish i would have sat down and thought things through properly first.

I think very few people are experts, but I hope that I reach a level of Proficient myself within certain areas

Morgan,

Thanks for the tip about FailFast!

Steven,

Yes, good semantic names in the code is always something to strive for. And &lt;code&gt;try...catch&lt;/code&gt; definitely has its place, but it usually tends to get overused.

Steven, Cory,

I'd say that helpful comments in the code within the right context can help other developers. However, unit tests are of course also a great way to learn.</description>
		<content:encoded><![CDATA[<p>Anders,</p>
<p>Sounds like a great idea! I&#8217;m very impulsive myself, but there are times where I wish i would have sat down and thought things through properly first.</p>
<p>I think very few people are experts, but I hope that I reach a level of Proficient myself within certain areas</p>
<p>Morgan,</p>
<p>Thanks for the tip about FailFast!</p>
<p>Steven,</p>
<p>Yes, good semantic names in the code is always something to strive for. And <code>try...catch</code> definitely has its place, but it usually tends to get overused.</p>
<p>Steven, Cory,</p>
<p>I&#8217;d say that helpful comments in the code within the right context can help other developers. However, unit tests are of course also a great way to learn.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Clark</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179005</link>
		<dc:creator>Steven Clark</dc:creator>
		<pubDate>Tue, 08 Jan 2008 04:43:10 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-179005</guid>
		<description>Cory are you referring to the function inputs and outputs making it into your internal documentation (comment above the function block)?

Your unit tests may show those conditions work. But someone scanning your code or having to make modifications will get a lot out of simply seeing what is expected as input and as output. They address a different need than unit testing.

By writing the inputs and outputs in there you have an internal documented record of what that function takes and returns.

I hope that explains better what I meant in my comment.</description>
		<content:encoded><![CDATA[<p>Cory are you referring to the function inputs and outputs making it into your internal documentation (comment above the function block)?</p>
<p>Your unit tests may show those conditions work. But someone scanning your code or having to make modifications will get a lot out of simply seeing what is expected as input and as output. They address a different need than unit testing.</p>
<p>By writing the inputs and outputs in there you have an internal documented record of what that function takes and returns.</p>
<p>I hope that explains better what I meant in my comment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cory Foy</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178929</link>
		<dc:creator>Cory Foy</dc:creator>
		<pubDate>Tue, 08 Jan 2008 03:01:08 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178929</guid>
		<description>Steven - why wouldn't you just write /unit tests/ to make sure those conditions are working? Even JavaScript has JSUnit.</description>
		<content:encoded><![CDATA[<p>Steven - why wouldn&#8217;t you just write /unit tests/ to make sure those conditions are working? Even JavaScript has JSUnit.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: &#187; Blog Archive &#187; Use Comment Blocks Before Your Functions - StevenClark.com.au</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178769</link>
		<dc:creator>&#187; Blog Archive &#187; Use Comment Blocks Before Your Functions - StevenClark.com.au</dc:creator>
		<pubDate>Mon, 07 Jan 2008 23:43:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178769</guid>
		<description>[...] these aren&#8217;t the tips I&#8217;m thinking of this morning. Robert Nyman&#8217;s post on code assertions got me thinking about writing maintainable functions. I&#8217;d like to bring your attention to the [...]</description>
		<content:encoded><![CDATA[<p>[...] these aren&#8217;t the tips I&#8217;m thinking of this morning. Robert Nyman&#8217;s post on code assertions got me thinking about writing maintainable functions. I&#8217;d like to bring your attention to the [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Steven Clark</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178726</link>
		<dc:creator>Steven Clark</dc:creator>
		<pubDate>Mon, 07 Jan 2008 22:58:20 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178726</guid>
		<description>Another really good habit to get into when writing functions - comment above the function of the expected inputs and outputs. This can save a lot of time when the next person comes along to maintain your code.

And meaningful names rather than variables like e, n or fp can go a long way to improving readability, and therefore maintainability.

Sorry, maybe that was slightly off topic.

I agree with your example in JavaScript re: try catch phrases for the purpose you've described but they have their place. I am not very strong in JavaScript though so my programming experience is not browser based.

I've just read 2 Jeremy Keith books as I've finally picked up JavaScript and assertions seem the natural best practice. Robust quality code is an objective that should always be a priority.</description>
		<content:encoded><![CDATA[<p>Another really good habit to get into when writing functions - comment above the function of the expected inputs and outputs. This can save a lot of time when the next person comes along to maintain your code.</p>
<p>And meaningful names rather than variables like e, n or fp can go a long way to improving readability, and therefore maintainability.</p>
<p>Sorry, maybe that was slightly off topic.</p>
<p>I agree with your example in JavaScript re: try catch phrases for the purpose you&#8217;ve described but they have their place. I am not very strong in JavaScript though so my programming experience is not browser based.</p>
<p>I&#8217;ve just read 2 Jeremy Keith books as I&#8217;ve finally picked up JavaScript and assertions seem the natural best practice. Robust quality code is an objective that should always be a priority.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morgan Roderick</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178460</link>
		<dc:creator>Morgan Roderick</dc:creator>
		<pubDate>Mon, 07 Jan 2008 17:57:53 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178460</guid>
		<description>I am using assertions more and more, across many technologies.

For javscript / dom, I've been using assertions for a looong time ... not wanting to throw exceptions in the face of users.

Recently, in my day job, I've taken up FailFast (&lt;a href="http://martinfowler.com/ieeeSoftware/failFast.pdf" rel="nofollow"&gt;http://martinfowler.com/ieeeSoftware/failFast.pdf&lt;/a&gt;) and am having a great time, building more robust code, that blows up in my face early, instead of when it reaches the production environment.

How &lt;em&gt;you&lt;/em&gt; implement FailFast, or use assertions, I leave up to youl. But, it's certainly made my life a little easier :-)</description>
		<content:encoded><![CDATA[<p>I am using assertions more and more, across many technologies.</p>
<p>For javscript / <acronym title="Document Object Model">DOM</acronym>, I&#8217;ve been using assertions for a looong time &#8230; not wanting to throw exceptions in the face of users.</p>
<p>Recently, in my day job, I&#8217;ve taken up FailFast (<a href="http://martinfowler.com/ieeeSoftware/failFast.pdf" rel="nofollow">http://martinfowler.com/ieeeSoftware/failFast.pdf</a>) and am having a great time, building more robust code, that blows up in my face early, instead of when it reaches the production environment.</p>
<p>How <em>you</em> implement FailFast, or use assertions, I leave up to youl. But, it&#8217;s certainly made my life a little easier <img src='http://www.robertnyman.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anders Ytterström</title>
		<link>http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178426</link>
		<dc:creator>Anders Ytterström</dc:creator>
		<pubDate>Mon, 07 Jan 2008 17:18:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.robertnyman.com/2008/01/07/whats-your-level-of-code-assertions/#comment-178426</guid>
		<description>I do my very best to use assertions. Now and then I catch my self over analyzing the code I currently work on. Because of that, I usually spend more time with pen and paper before even creating the files. This helps me to at least find 8 of 10 assertions which otherwise should have breaking my creative flow.

When it comes to javascript, Jeremy Keith's "Dom Scripting" got me interested in the first place. That book really emphasize the need of never taking anything for granted.

IMHO, I place myself somewhere at &lt;strong&gt;Proficient&lt;/strong&gt;, since I am not completely self going get.</description>
		<content:encoded><![CDATA[<p>I do my very best to use assertions. Now and then I catch my self over analyzing the code I currently work on. Because of that, I usually spend more time with pen and paper before even creating the files. This helps me to at least find 8 of 10 assertions which otherwise should have breaking my creative flow.</p>
<p>When it comes to javascript, Jeremy Keith&#8217;s &#8220;<acronym title="Document Object Model">DOM</acronym> Scripting&#8221; got me interested in the first place. That book really emphasize the need of never taking anything for granted.</p>
<p>IMHO, I place myself somewhere at <strong>Proficient</strong>, since I am not completely self going get.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
