<?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>Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx</link><description>Jeff has a good post here about code comments and that they shouldn't be used as crutches: Coding Horror: Coding Without Comments I agree with the article, but one thing I rarely hear mentioned is that it's often more interesting to comment the business</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Dew Drop - July 25, 2008 | Alvin Ashcraft's Morning Dew</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8771978</link><pubDate>Fri, 25 Jul 2008 14:59:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8771978</guid><dc:creator>Dew Drop - July 25, 2008 | Alvin Ashcraft's Morning Dew</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.alvinashcraft.com/2008/07/25/dew-drop-july-25-2008/"&gt;http://www.alvinashcraft.com/2008/07/25/dew-drop-july-25-2008/&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8772346</link><pubDate>Fri, 25 Jul 2008 18:16:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8772346</guid><dc:creator>Stephan Schmidt</dc:creator><description>&lt;p&gt;Excellent, excellent, excellent!&lt;/p&gt;
&lt;p&gt;(and no, this is not a SPAM comment ;-)&lt;/p&gt;
&lt;p&gt;(wouldn't a SPAM comment say it's not a SPAM comment?)&lt;/p&gt;
&lt;p&gt;(and no, this is really no SPAM comment, the post is excellent and I often wish there was a business comment in the code I read to know _why_ a developer wrote code in such a - sometimes complicated - way, so I don't violate a business requirement when refactoring or &amp;quot;fixing&amp;quot; the code.)&lt;/p&gt;
&lt;p&gt;Peace&lt;/p&gt;
&lt;p&gt;-stephan&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8772525</link><pubDate>Fri, 25 Jul 2008 20:21:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8772525</guid><dc:creator>Anand V</dc:creator><description>&lt;p&gt;I do not have much experience in writing system level code, but I agree to Jeff's post that determining whats happening from it is really difficult.&lt;/p&gt;
&lt;p&gt;On the other hand, when you are writing business applications, you would really want your code and test to do the talking. The code should be written as close to the Domain and the Test should act as a good specification such that you should never require any comments.&lt;/p&gt;
&lt;p&gt;Fine examples of this kind of effort are Domain Driven Design, Behavior Driven Development. An example API being jmock&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8772709</link><pubDate>Fri, 25 Jul 2008 22:06:38 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8772709</guid><dc:creator>Myles Braithwaite</dc:creator><description>&lt;p&gt;I am going to start write comments like that. Thanks&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8773355</link><pubDate>Sat, 26 Jul 2008 02:25:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8773355</guid><dc:creator>ChrisJ</dc:creator><description>&lt;p&gt;I use a bit of both, but never really thought much about it. Now that it's spelled out this way, it makes a lot of sense. &lt;/p&gt;
&lt;p&gt;Big up, mate!&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8773404</link><pubDate>Sat, 26 Jul 2008 02:40:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8773404</guid><dc:creator>Brad</dc:creator><description>&lt;p&gt;Folks -- business logic is described in specifications. Do you have documented specifications for software you write?&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8775216</link><pubDate>Sat, 26 Jul 2008 13:22:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8775216</guid><dc:creator>sumati</dc:creator><description>&lt;p&gt;nice list, thanks for sharing.&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8778049</link><pubDate>Sun, 27 Jul 2008 12:18:04 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8778049</guid><dc:creator>Nown O'Urbusiness</dc:creator><description>&lt;p&gt;It looks like you're putting data into the code. I separate data from processing logics.&lt;/p&gt;
&lt;p&gt;There are only so many working at companies where this &amp;quot;business commenting&amp;quot; would even make sense. I work with a completely general platform that doesn't have special-cases at all.&lt;/p&gt;
&lt;p&gt;Besides, your &amp;quot;business comments&amp;quot; are as much &amp;quot;code architecture comments&amp;quot; because they do comment the code and how it works, implicitly. They, too, will need to be updated when the code changes.&lt;/p&gt;
&lt;p&gt;I call shenanigans and whine over nothing.&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8778926</link><pubDate>Sun, 27 Jul 2008 16:37:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8778926</guid><dc:creator>Dave</dc:creator><description>&lt;p&gt;@Anand: &amp;quot;On the other hand, when you are writing business applications, you would really want your code and test to do the talking.&amp;quot;&lt;/p&gt;
&lt;p&gt;If you're looking at the code, you don't want to see something like &amp;quot;includeLabOwnerEmailPerBug1234()&amp;quot;. Use a comment: without it it won't be clear *why* you're doing something.&lt;/p&gt;
&lt;p&gt;Tests examine *what's* happening. Not *why*. And yes, you *could* name your test &amp;quot;ensureLabOwnerEmailedAsPerBug1234()&amp;quot;, and if your test methodology includes source-level references from the code under tests to the tests perhaps that's enough. I don't think it is, but at that point it's largely a matter of preference.&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8779865</link><pubDate>Sun, 27 Jul 2008 20:56:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8779865</guid><dc:creator>Mark</dc:creator><description>&lt;p&gt;Sometimes it is important to say why a bit of code was written this way. I can't tell from your ambiguous wording whether you were being dismissive of this practice or not, but certainly some readers will read it that way.&lt;/p&gt;
&lt;p&gt;If my code is:&lt;/p&gt;
&lt;p&gt;if ( $pid = fork ) { &lt;/p&gt;
&lt;p&gt;...&lt;/p&gt;
&lt;p&gt;I do want a comment there saying that I DID mean to say '=' and not '==' so that maintenance programmers, including myself a year later, get a hint that the code as written is not buggy (because, without a comment, it does look like a bug to people who don't know what is going on).&lt;/p&gt;
&lt;p&gt;Your suggestion of commenting business processes is a good one. But your sloppy writing risks leading people to think you are advocating throwing out the baby with the bath water.&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8782719</link><pubDate>Mon, 28 Jul 2008 09:01:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8782719</guid><dc:creator>Avi Pilosof</dc:creator><description>&lt;p&gt;@Mark: I'm not sure what baby I'm throwing out with which bathwater. As I said, I think both types of comments are valuable.&lt;/p&gt;
&lt;p&gt;@Brad: Specifications are great, but my experience has shown that they're generally not available at all or not up to date with the code. I wish it wasn't that way, but when it is, I rather have comments like that to protect the code from what seem like innocent changes.&lt;/p&gt;
&lt;p&gt;At the end, this isn't a right/wrong thing. It works for me in my environment; it may not work for you in yours...&lt;/p&gt;
</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8784687</link><pubDate>Mon, 28 Jul 2008 18:59:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8784687</guid><dc:creator>Sridhar Ratnakumar</dc:creator><description>&lt;p&gt;&amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://www.reddit.com/r/programming/comments/6tqre/no_your_code_is_not_so_great_that_it_doesnt_need/c04uc6y&amp;quot;&amp;gt;This"&gt;http://www.reddit.com/r/programming/comments/6tqre/no_your_code_is_not_so_great_that_it_doesnt_need/c04uc6y&amp;quot;&amp;gt;This&lt;/a&gt; reddit comment&amp;lt;/a&amp;gt; says it all.&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8784701</link><pubDate>Mon, 28 Jul 2008 19:02:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8784701</guid><dc:creator>Sridhar Ratnakumar</dc:creator><description>&lt;p&gt;.. and the replies in that thread make a lot of sense too!&lt;/p&gt;</description></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8792414</link><pubDate>Wed, 30 Jul 2008 23:44:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8792414</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;There's always a way to redesign the entire program to make these special cases go away. So, in theory, comments are almost unnecessary. However, in practice, the better designs may not become evident until years later. By that time, it's easier to use the easy fix and write a comment.&lt;/p&gt;
&lt;p&gt;Also, having a document that details the specification is great, but be honest, would you use it? If you were trying to track down a bug and found a line of code that looked *blatantly* wrong, would you read a 100 page document first to see if you should leave it alone or would you change it?&lt;/p&gt;
&lt;p&gt;There's nothing wrong with including bits of the specification as comments. Yes its redundant, but redundancy is *generally* a bad thing, its not *always* a bad thing. If redundancy was always a bad thing, your office would only have on bathroom.&lt;/p&gt;</description></item><item><title>http://littletutorials.com/2008/07/30/how-bad-comments-are-born-in-your-code/</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8810394</link><pubDate>Sun, 03 Aug 2008 04:20:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8810394</guid><dc:creator>TrackBack</dc:creator><description /></item><item><title>re: Code commenting? Try Business Commenting.</title><link>http://blogs.msdn.com/avip/archive/2008/07/25/code-commenting-try-business-commenting.aspx#8836970</link><pubDate>Wed, 06 Aug 2008 13:55:45 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8836970</guid><dc:creator>Jeff_NH</dc:creator><description>&lt;P&gt;Mostly agree with this and it is true today as it was 20 years ago when this was still well known and ignored by programmers.&lt;/P&gt;
&lt;P&gt;Having said that I would generally caution against comments that reference bugs, what we 'used to do', etc. I agree there are probably cases where that exact construct is reasonable but I think it is quite rare. &lt;/P&gt;
&lt;P&gt;Just as there is a tendency for people to do i++; // increment i&lt;/P&gt;
&lt;P&gt;there is also a tendency to suddenly start cluttering up the code with lots of inline comments about bug fixes and enhancements. This seems ok until you try to maintain code for 10 years and it is full of such clutter related to what used to be and what might have been that you can no longer follow the code. We have issue database, we have version control, most of the value of comments written in this way are provided by those assets.&lt;/P&gt;
&lt;P&gt;Certainly of there is a fragment of code that is particularly tricky where there the most natural way of writing it is wrong I could begin to see the wisdom of talking about the alternate approach, why it is wrong and slightly short circuiting the full discussion by reference to a full change record... Having said, I believe my 'rule' is essentially never do it for reasons similar to the never use goto rule.&lt;/P&gt;
&lt;P&gt;In both cases there are very valid reasons to use the construct (gotos and lots of discussion about when code changed as a result of a change request) but the typical programmer screws up the use of both of these at least an order of magnitude more often then they get it right.&lt;/P&gt;
&lt;P&gt;For example, this&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 1: // This used to delete items older than 30 days, but&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 2: // bug #65432 requested that an exception be made for&lt;/P&gt;
&lt;P&gt;&amp;nbsp; 3: // items that are of type X.&lt;/P&gt;
&lt;P&gt;Is interesting in many ways. It immediately brings to mind the question (for me) about why are you deleting items not of type X &amp;gt; 30 days old. What required/suggested that? What you appear to be doing here is using your bug/change tracking system as a requirements management system and then putting in the requirement ID in the code for traceability reasons. For an informal development process like this I'd much rather just see a statement that says (succinctly) why items of type X should be held.&lt;/P&gt;</description></item></channel></rss>