<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://devlicio.us/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>Derik Whittaker : Opinion, Methodology</title><link>http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/Methodology/default.aspx</link><description>Tags: Opinion, Methodology</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>Removing words like Convince, Convert and Persuade from our vocabulary</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/11/04/removing-words-like-convince-convert-and-persuade-from-our-vocabulary.aspx</link><pubDate>Tue, 04 Nov 2008 11:26:22 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:42882</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=42882</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=42882</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/11/04/removing-words-like-convince-convert-and-persuade-from-our-vocabulary.aspx#comments</comments><description>&lt;p&gt;One of the common&amp;nbsp;themes of this years KaizenConf was how to move a towards being a lean organization.&amp;nbsp; During most of the sessions and conversations that I was part I cannot tell you how often I heard words like Convince, Convert and Persuade said.&amp;nbsp; At first I had nothing against these words, but the more I thought about I know feel that we need to remove those words from our vocabulary when talking about moving a team or organization from one thing to another (in context of these conversations it is towards being lean).&lt;/p&gt; &lt;p&gt;Using terms like Convince and Convert has the feeling that &amp;#39;I am right and you are wrong&amp;#39;.&amp;nbsp; Even if you are not using terms like Convince and Convert in your dialog with people, I am going to guess that you have that as your goal, or your end game.&amp;nbsp; &lt;/p&gt; &lt;p&gt;I am here to suggest that we as a community need to change our focus from Convincing towards Demonstrating.&amp;nbsp; By changing our angle and our position to be more neutral and soft I feel we can archive our goal of bringing change easier and with less friction.&amp;nbsp; It is like that old saying &amp;#39;you can catch more fly&amp;#39;s with honey than vinegar.&lt;/p&gt; &lt;p&gt;Lets take a look at the subtle differences between Convincing and Demostrating.&lt;/p&gt; &lt;p&gt;When we are trying to Convince someone of something many times we give off the following vibes.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;That your way is wrong, and our is right  &lt;li&gt;That we are better and more knowledgeable  &lt;li&gt;That we are preaching&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;All of above tend to put people on the definsive and if someone is on the definsive they are less likely to be open minded and less likey to want to try to understand what it is you are trying to say.&lt;/p&gt; &lt;p&gt;When we are trying to demostrate something to someone we give off the following vibes.&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Heartflet attempt to share knowledge  &lt;li&gt;Cooperation  &lt;li&gt;Alternative to, not a replacement for their way of doing something  &lt;li&gt;Sincere intrest in helping them.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;When you speak to someone with the above vibe, you are essentally telling them that I have&amp;nbsp;an idea and I think that my idea can help you out.&amp;nbsp; If you attack it from this angle&amp;nbsp;you&amp;nbsp;may be surprised by the level of reception you can receive.&lt;/p&gt; &lt;p&gt;Remember, convincing someone is never easy, but demostrating alternatives and allowing them to make their own decision can be.&lt;/p&gt; &lt;p&gt;Keep up the good fight and happy demostrating.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=42882" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Unused code is the worst of the 7 Wastes of Software</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/08/06/unused-code-is-the-worst-of-the-7-wastes-of-software.aspx</link><pubDate>Wed, 06 Aug 2008 21:21:44 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:41708</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>32</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=41708</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=41708</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/08/06/unused-code-is-the-worst-of-the-7-wastes-of-software.aspx#comments</comments><description>&lt;p&gt;Today I was having another round of conversations with a buddy of mine about the concept of waste and unused code.&lt;/p&gt; &lt;p&gt;In agile there is a concept called &lt;a href="http://en.wikipedia.org/wiki/You_Ain%27t_Gonna_Need_It"&gt;YAGNI&lt;/a&gt; (You Ain&amp;#39;t Gonna Need It) that basically states that you should not add code that is not immediately needed as it is waste.&lt;/p&gt; &lt;p&gt;In Lean software this is known as one of the 7 Wastes of Software.&amp;nbsp; To quote from &amp;#39;Implementing Lean Software Development&amp;#39;&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&amp;#39;The worst of the seven wastes of software development is adding features (read that as simply code) that are not needed to get the customers&amp;#39; current job done.&amp;#39;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;The context of our conversation was around code generation.&amp;nbsp; Now I am NOT a huge fan of CodeGen as I have been on the wrong side of a project that used CodeGen.&amp;nbsp; What we were debating was if it was just better to CodeGen up all the CRUD logic (they are using data driven design, not a domain driven approach) prior to needing it or create it as you need it.&lt;/p&gt; &lt;p&gt;The conversation started with this statement from my buddy.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&amp;#39;If I had to go stub a select out for a table, I&amp;#39;d be like WTF. Whoever created this app sucks, they did not even create select procs for me&amp;#39;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;When he made this statement I knew I was in for a uphill battle, but I tried to convey my thoughts.&amp;nbsp; However, at the end of the conversation we agreed to disagree (but he is still wrong :)) and we went back to our neutral corners.&lt;/p&gt; &lt;p&gt;So, what are my thoughts on why unused code is waste:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;You are creating speculative code for a need that you may or may not ever realize.&amp;nbsp; And my experience tells me more often then not that code will not be needed.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;There is now more code to be maintained (in his case I have to modify/regen code if my db tables change) which leads to more work in the long run.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;There is now more code to test, which means more tests to fix/refactor when that code changes.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;There is now more code to refactor if you change directions later, and we all know you will change directions.&lt;br /&gt;&lt;/li&gt; &lt;li&gt;Your needs may/will change between the time you originally wrote the code and the time you needed it.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The only real responses he could make were:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Since this code is created via CodeGen, who cares if it changes I can ReGen it.&lt;br /&gt;&lt;font color="#ff0000"&gt;My response - This is a weak excuse as re-creating massive amounts of code is expensive and time consuming.&amp;nbsp; Also not mention everyone on the team may not necessarily know/understand how to do the CodeGen&lt;/font&gt;&lt;br /&gt;&lt;/li&gt; &lt;li&gt;I do not want to take time later to build the functionality out as I need it.&amp;nbsp; Especially when it comes to things like CRUD proc.&lt;br /&gt;&lt;font color="#ff0000"&gt;My response - This is about the lamest excuse ever.&amp;nbsp; Creating the functionality as needed, when needed, is the ONLY want to correctly solve your business problem.&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So, what lesson have learned here today.&amp;nbsp; Unused code is waste and there is no 2 ways about it.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt; &lt;p&gt;&lt;font color="#808080"&gt;&lt;strong&gt;[----- Remember to check out &lt;/strong&gt;&lt;strong&gt;&lt;a href="http://www.dimecasts.net"&gt;DimeCasts.Net&lt;/a&gt;&lt;/strong&gt;&lt;strong&gt; -----]&lt;/strong&gt;&lt;/font&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=41708" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Defensive Coding best practice</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2008/01/22/defensive-coding-best-practice.aspx</link><pubDate>Tue, 22 Jan 2008 13:05:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:39285</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>8</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=39285</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=39285</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2008/01/22/defensive-coding-best-practice.aspx#comments</comments><description>&lt;p&gt;&amp;lt;disclaimer&amp;gt; 
  &lt;br /&gt;This posting is purely my personal opinion.&amp;nbsp; I am sure many of you out there will disagree, if this is the case, let me know. 

  &lt;br /&gt;&amp;lt;/disclaimer&amp;gt;&lt;/p&gt;

&lt;p&gt;Today, during my bug hunting I stumbled across the dreaded &amp;#39;Null reference&amp;#39; exception.&amp;nbsp; This was not the original target of my hunt, but it quickly became wanted bug number one.&amp;nbsp; After some digging and debugging I found the the varmint.&amp;nbsp; The offending code was the following a null ref because someone made the mistake of assuming that an object would always be non-null.&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;listMain.Items.FindByText( listChild.SelectedItem.Text.Substring( 0, 1 ) ).Selected = true;

&lt;/pre&gt;

&lt;p&gt;Now let me explain the intent of this code.&amp;nbsp; There are 2 list boxes on the UI and when someone selects something in the second list box, the code is meant to filter down the code in the first list box.&amp;nbsp; However, the code above assumes that there will be a match for the &amp;#39;FindByText&amp;#39; method and this is where we have problems.&amp;nbsp; The author of this code decided that there will NEVER be a situation where the filter will not find a result.&amp;nbsp; Oops.&lt;/p&gt;

&lt;p&gt;The defensive coder would not make that assumption and would have added a few extra lines of code.&amp;nbsp; Below may be an example:&lt;/p&gt;

&lt;pre class="c-sharp" name="code"&gt;ListItem foundItem = listMain.Items.FindByText( listChild.SelectedItem.Text.Substring( 0, 1 ).ToUpper() );

if ( foundItem != null )
{
	foundItem.Selected = true;

	// Do something with the result	
} 
else 
{
	// Do something, either tell the user there was no data or anything else the business wants
}

&lt;/pre&gt;

&lt;p&gt;By adding the defensive code we can avoid the &amp;#39;Null Reference&amp;#39; exceptions that we all love.&amp;nbsp; We also make our code more robust by forcing the developer to thing about possible exception conditions.&amp;nbsp;&amp;nbsp; &lt;/p&gt;

&lt;p&gt;For more information about Defensive Coding, check out this link &lt;a href="http://en.wikipedia.org/wiki/Defensive_programming" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Till next time,&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=39285" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Best+Practice/default.aspx">Best Practice</category></item><item><title>Failing builds, the sound of silence</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/07/failing-builds-the-sound-of-silence.aspx</link><pubDate>Wed, 07 Nov 2007 13:00:48 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38803</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38803</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38803</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/07/failing-builds-the-sound-of-silence.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m sure that everyone has heard the&amp;nbsp;riddle &amp;#39;&lt;strong&gt;If a tree falls in a forest and no one is around to hear it, does it make a sound?&amp;#39;&lt;/strong&gt;.&amp;nbsp; This riddle is all about observation and knowledge of reality.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Well,&amp;nbsp;I have a riddle for software teams following TDD.&amp;nbsp; &lt;/p&gt; &lt;p&gt;&lt;strong&gt;&amp;#39;If a build fails and no-one fixes it, did it actually fail?&amp;#39;&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38803" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Humor/default.aspx">Humor</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Subclassing for Success</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/02/subclassing-for-success.aspx</link><pubDate>Fri, 02 Nov 2007 12:36:58 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38781</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>5</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38781</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38781</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/11/02/subclassing-for-success.aspx#comments</comments><description>&lt;p&gt;As someone how has been designing and developing WinForms based applications for the past 7+ years, I have learned that subclassing UI controls is a must.&amp;nbsp; You may be thinking, why would I want to subclass a text box?&amp;nbsp; Or a combo box?&amp;nbsp; The answer is simple, the better future proof your app.&amp;nbsp; &lt;/p&gt; &lt;p&gt;How many times have you been into the development cycle of your application and you found out that you needed/wanted to extend the text box that is being used.&amp;nbsp; By extend I am not necessary talking about adding functionality to it, but do something like having the control highlight the entire contents of the control&amp;nbsp;when the&amp;nbsp;it receives focus.&lt;/p&gt; &lt;p&gt;If you don&amp;#39;t have your controls subclassed, extending your control will be a pain in your ass.&amp;nbsp; Sure you could find EVERY use of the control and add the needed&amp;nbsp;code.&amp;nbsp; Or you could find and replace your control later with the subclassed control, but both of these suck.&lt;/p&gt; &lt;p&gt;When I start a new WinForms (same concept should work for Browser based as well) application, I will immediately add a Controls namespace and simply add my subclassed controls.&amp;nbsp; In many cases I never extend the control, but knowing that I can do so allows me to make better decisions later on.&amp;nbsp; &lt;/p&gt; &lt;p&gt;One example of where this has helped me in the past was on a project where about 6 months into development, the business owners decided that would like the UI controls (text box, check box, combo box, etc) to change background color when the control receives focus and then change back when it loses focus.&amp;nbsp; Because I had everything subclassed i was able to implement this request in a very short time frame and did not even have to open up a single form.&amp;nbsp; Had I not subclasses the controls I would have either pushed back heavily or it would have taken me much longer to implement this change.&lt;/p&gt; &lt;p&gt;Another good use is for things like data grids.&amp;nbsp; Whether you are using the out of the box data grid, or some third party grid like Infragistics or Janus, subclassing can save you a ton.&amp;nbsp; How many times have you developed an application where you wanted a standard look and feel for your grids.&amp;nbsp; Say every other line is gray, and there are no selection column.&amp;nbsp; If the control is not subclassed you are asking each developer to remember to make the look and feel customizations.&amp;nbsp; But, if it is subclassed, simply add the control to the form and you are done.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38781" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/WinForms/default.aspx">WinForms</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Backing in Unit Tests into an existing project</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx</link><pubDate>Tue, 09 Oct 2007 12:35:39 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38646</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>4</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38646</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38646</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/09/backing-in-unit-tests-into-an-existing-project.aspx#comments</comments><description>&lt;p&gt;Recently I was asked about backing in unit tests into an existing project.&amp;nbsp; In particular I was asked&amp;nbsp;A) was possible and B) is it worth it.&amp;nbsp; In short my answers to both these are Yes and Yes.&amp;nbsp; However, backing in unit tests is not without its challenges.&amp;nbsp; I thought today I would go express my experiences with doing exactly this and what types of hurdles I ran into.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Start off by only testing new code&lt;br /&gt;&lt;/strong&gt;When backing in tests, it is very important to accept the fact that a large percentage of your application is going to be untested.&amp;nbsp; Accepting this fact will help you move forward.&amp;nbsp; I would suggest that as you write new code (be it new modules, features or&amp;nbsp;whatever) you write them following the TDD practice.&amp;nbsp; This will be the simplest way to get the ball rolling.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Doing this is also an easy way to get other team members on board with the testing idea.&amp;nbsp; I know from personal experience that when we wanted to started following TDD on a project that was 2 years in, many of the other developers thought it was a waste because we have so much that is untested.&amp;nbsp; They thought it would take too much time/effort to write test for existing code.&amp;nbsp; I agree with this.&amp;nbsp; So only test going forward&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Add tests to existing code only when changes are needed&lt;br /&gt;&lt;/strong&gt;I know I just said above to only test new code, and this is true.&amp;nbsp; However, when you are making changes to existing code test those changes.&amp;nbsp; Again, you don&amp;#39;t have to try to test all the existing code, only the path ways you are adding/changing.&amp;nbsp; &lt;/p&gt; &lt;p&gt;If you follow this, over time you will start to build a nice suite of tests that tests not only new code, but some existing code as well.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Mock as much as possible&lt;br /&gt;&lt;/strong&gt;Mocking is a great tool.&amp;nbsp; I like to mock code that I don&amp;#39;t have control over, or when I have no faith the code will work reliably.&amp;nbsp; This is especially&amp;nbsp;important&amp;nbsp;in a project that does not have tests.&amp;nbsp; &lt;/p&gt; &lt;p&gt;An example would be this.&amp;nbsp; Lets say you&amp;nbsp;are&amp;nbsp;adding a new feature to an application that needs to call into some sort of calculation engine.&amp;nbsp; Since this calculation engine is not tested and you have no real faith that it will work&amp;nbsp;reliably,&amp;nbsp;mock it.&amp;nbsp; &amp;nbsp;You should know that given a valid set of inputs you expect to receive a given response.&amp;nbsp; By mocking this you remove all risk of the calculation engine failing thus causing your tests to fail.&amp;nbsp; &lt;/p&gt; &lt;p&gt;*** I can hear you now,&amp;nbsp;you want&amp;nbsp;your test to fail when the calculation engine fails.... No you don&amp;#39;t.&amp;nbsp; Unless your test is actually testing the calculation engine, you don&amp;#39;t care if it passes or fails.&amp;nbsp; You just need to call it. ***&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Take this as a learning experience&lt;br /&gt;&lt;/strong&gt;Take this time as a way to learn to write good solid tests.&amp;nbsp; This will be of great benefit later in your next project.&amp;nbsp; Also, you will also learn how to write better code that is more acceptable to testing (hum... sounds like another good post).&amp;nbsp; Remember, in order to become good at something you must first be bad at it.&amp;nbsp; But with practice you will become better and you will be a better developer because of it.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Be patient&lt;br /&gt;&lt;/strong&gt;Testing is painful at first.&amp;nbsp; It is a shift in your development mind set.&amp;nbsp; Be patient, it gets better.&amp;nbsp; This is no different then learning anything else.&amp;nbsp; It will take time, but eventually you will become comfortable with TDD and it will become second nature.&amp;nbsp; You never know, you may end up like me and find it odd when you are NOT writing tests.&lt;/p&gt; &lt;p&gt;I hope this helps.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38646" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category></item><item><title>Why I believe IN and WRITE unit tests</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx</link><pubDate>Tue, 02 Oct 2007 00:27:25 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38554</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>12</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38554</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38554</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/10/01/why-i-believe-in-and-write-unit-tests.aspx#comments</comments><description>&lt;p&gt;In my last post I think I struck a cord with some people in my post &amp;#39;Unit tests taking too much time&amp;#39;.&amp;nbsp; My intent was NOT to sound like an elitist Agilist or any else of that nature.&amp;nbsp; My intent was simply to put a post out there about the misperception (in my opinion) about how writing unit tests take too much time.&lt;/p&gt; &lt;p&gt;I thought I would put my &amp;#39;retort&amp;#39; on why I believe in&amp;nbsp;and write unit tests.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows&amp;nbsp;ME to write better code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I believe that when&amp;nbsp;I truly follow TDD practices&amp;nbsp;my code comes out simpler.&amp;nbsp; I have also found, that my code tends to follow&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/YAGNI" target="_blank"&gt;YAGNI&lt;/a&gt;&amp;nbsp;more so then when I don&amp;#39;t follow TDD practices.&lt;/p&gt; &lt;p&gt;Here is an example from my past experience.&amp;nbsp; On a prior project I needed to build a &amp;#39;search engine&amp;#39; into our app (this was not an actual search engine, more like a hunt path engine).&amp;nbsp; When I first started out writing code I started out by creating all these classes and logic that I thought I would need.&amp;nbsp; After about 3-4 hours of coding I was dead in the water.&amp;nbsp; I was not able to solve my problem in a simple manner and I was frustrated.&amp;nbsp; I decided to take a step back and start over.&amp;nbsp; &lt;/p&gt; &lt;p&gt;This time though I&amp;nbsp;started out by writing test to mimic what I actually needed.&amp;nbsp; I continued to follow the principles of &lt;a href="http://en.wikipedia.org/wiki/Test-driven_development" target="_blank"&gt;TDD&lt;/a&gt; (btw, TDD is more then just about writing tests), within an hour or so I had my solution pretty much good to go.&amp;nbsp; All those classes and methods I THOUGHT I would need I did NOT.&amp;nbsp; I was able to scrap about 50% of the code/classes that I thought I needed.&amp;nbsp; And guess what, now I have a test suit to test my new code.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to find more bugs during the development process&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;It has been my experience that I find more bugs while writing tests.&amp;nbsp; This is due to the fact that I not only follow TDD, but I also do my best to implement the &lt;a href="http://en.wikipedia.org/wiki/Fail-fast" target="_blank"&gt;Fail Fast Principle&lt;/a&gt;.&amp;nbsp; When I am writing my tests I have the ability to create tests that easily walk though the different pathways of my code (I attempt to hit 100% code coverage as well).&amp;nbsp; If I were not writing tests I would have to do this via the application, and&amp;nbsp;this is much more painful and it less likely that I would actually do it.&lt;/p&gt; &lt;p&gt;By writing my tests and testing my code during the development process I know that I have reduced my bug count significantly.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Makes ME feel more comfortable making changes&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is the beauty of TDD, I am not afraid to make any critical changes to my code because I KNOW that I have tests to verify if I screwed anything up.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Have you ever run across some code that &amp;#39;you were scared&amp;#39; to change?&amp;nbsp; If you had tests for that code I bet you would a WHOLE LOT LESS scared to make any changes.&amp;nbsp; I know that I am.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; On a prior project a consultant I was working with needed to make changes to some &amp;#39;smelly&amp;#39; logic.&amp;nbsp; This just happened to be a week or so before a scheduled release.&amp;nbsp; Beacuse he had NO confidence that the changes he would make would NOT break the application, he convinced the business to NOT make the changes. &amp;nbsp;I bet you a dollar that had there been unit tests he would have been much more willing to make the changes.&amp;nbsp; In this case the fact of NOT having tests may have caused the business to lose out on features it needed.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Improves MY code&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;Because following TDD practices&amp;nbsp;forces you to write your failing code before your passing code,&amp;nbsp;I tend to implement my intent much cleaner and simpler.&amp;nbsp; I also know that because I am writing tests along the way my code is solid.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows ME to better convey intent&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;I know that tests are not a&amp;nbsp;substitution for&amp;nbsp;quality comments that convey intent, but they sure are the next best thing.&amp;nbsp; It is really nice to be able to point someone towards a suite of tests to &amp;#39;demo&amp;#39; how to use a component.&lt;/p&gt; &lt;p&gt;A case in point for this is as follows.&amp;nbsp; A few weeks ago at work I wrote an API to allow the querying of some data via our imaging system at work.&amp;nbsp; Turns out that an outside party needed to use this API for integration into on of our 3rd party applications.&amp;nbsp; When he came to me asking for &amp;#39;how do I use this&amp;#39;, I simply emailed him my suite of tests.&amp;nbsp; In this suite I had pretty much any conceivable use for the API.&amp;nbsp; To date the vendor has not asked me how to implement the API.&lt;/p&gt; &lt;p&gt;&lt;strong&gt;Allows MY tests to be automated and rerunable&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;This is a nice side effect of having tests.&amp;nbsp; Because we use&amp;nbsp;both NUnit and CruiseControl I can run my tests on every check in.&amp;nbsp; This is cool because now I (and the team) know if changes&amp;nbsp;I made&amp;nbsp;breaks some other part of the system.&amp;nbsp; I would rather know now then before QA hits it.&amp;nbsp; &lt;/p&gt; &lt;p&gt;The above are simply my opinion, if you don&amp;#39;t share the same opinions, let me know.&lt;/p&gt; &lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38554" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Agile/default.aspx">Agile</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/TDD/default.aspx">TDD</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Standard questions to be asked when logging bugs</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/21/standard-questions-to-be-asked-when-logging-bugs.aspx</link><pubDate>Tue, 21 Aug 2007 12:51:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38252</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>2</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38252</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38252</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/21/standard-questions-to-be-asked-when-logging-bugs.aspx#comments</comments><description>
&lt;p class="MsoNormal"&gt;In my last post (&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx"&gt;here&lt;/a&gt;)
I spoke about different do’s and don’ts when it comes to logging bugs.&lt;span&gt;&amp;nbsp; &lt;/span&gt;What I really did not hit on was the
different types of questions I feel should be asked when logging bugs.&lt;br /&gt;&lt;br /&gt;Here are my questions, in no particular order.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Platform&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Application Version #&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Environment&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Title&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Short Description&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Details Steps&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Data used during testing&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Module/Sub Subsystem (if applicable)&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Is Reproducible&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Screen Shot (if applicable)&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family:Symbol;"&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;Attachments ( if applicable)&lt;/li&gt;
&lt;/ul&gt;











&lt;p class="MsoNormal"&gt;The above is the list of data I think is valuable in order
to property address and fix bugs.&lt;span&gt;&amp;nbsp; &lt;/span&gt;&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Did I miss any?&lt;/p&gt;

&lt;p class="MsoNormal"&gt;Till next time,&lt;/p&gt;

&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/21/standard-questions-to-be-asked-when-logging-bugs.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/21/standard-questions-to-be-asked-when-logging-bugs.aspx" alt="kick it on DotNetKicks.com" border="0" /&gt;&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38252" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Best+Practice/default.aspx">Best Practice</category></item><item><title>Logging Bugs: Do's and Don'ts</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx</link><pubDate>Mon, 20 Aug 2007 00:40:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:38244</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=38244</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=38244</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx#comments</comments><description>&lt;p&gt;All software that is being developed WILL have bugs, sorry, but this IS a fact.&amp;nbsp; Now I know some people and&amp;nbsp;companies don&amp;#39;t like to call them glitches&amp;nbsp;in software bugs.&amp;nbsp; They would rather call them issues or defects.&amp;nbsp; For all I care we can call them &amp;#39;WizBangs&amp;#39;, just call them something and LOG THEM.&lt;/p&gt;
&lt;p&gt;However, logging &amp;#39;WizBangs&amp;#39; (ok, I will call them bugs from here on) is not as simple as it may sound.&amp;nbsp; I would like to go over some of MY Do&amp;#39;s and Don&amp;#39;ts in this post.&amp;nbsp; If you don&amp;#39;t like my list, or would like to add to it, drop me a line.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;When to log Items:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; log everything.&amp;nbsp; Just because&amp;nbsp;the bug&amp;nbsp;may seem trivial or simple or only happen &amp;#39;every now and again&amp;#39; does not mean that it should be ignored.&amp;nbsp; Even it you are not sure it is an issue, LOG IT.&amp;nbsp; Better to have close off an non-issue then fail to report a major bug in hiding&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; assume that someone else is going to fix the issue.&amp;nbsp; Also, don&amp;#39;t assume this issue is too trivial or minor to report.&amp;nbsp; Wouldn&amp;#39;t it suck to find out after the application went lived that &lt;b&gt;you&lt;/b&gt; failed to report a critical bug because you thought it was not a &amp;#39;big deal&amp;#39;?&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;Providing information on the log:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;i&gt; &lt;/i&gt;&lt;/b&gt;provide detailed information about the bug.&amp;nbsp; Save yourself the headache later and provide as much information as you possible can.&amp;nbsp; This should include, but not limited to items such as Build Version, Environment, Platform, Short Description of issue, Severity, Detailed steps to reproduce.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; make provide a single sentence that says something like &amp;#39;Unable to perform XYZ in the ABC process&amp;#39;.&amp;nbsp; This type of information will provide nothing of real value to the next guy.&amp;nbsp; Sure, this would be a great line for the title of the bug.&amp;nbsp; But by no means is this enough information to fix the bug.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;What types of items to log:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; Log Everything.&amp;nbsp; Enough said&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; make assumptions&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;&lt;i&gt;When to log bugs:&lt;/i&gt;&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;Do&lt;/b&gt; log them as soon as possible.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;Don&amp;#39;t&lt;/b&gt; put it off.&amp;nbsp; If you dont log the bug as soon as you find it you WILL forget something about what you did to cause it.&amp;nbsp; For the sake of your fellow co-workers log it now before you forget.&lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;The plain and simple truth about logging bugs is, it sucks!!!!&amp;nbsp; However, it is a necessary part of&amp;nbsp;most developers jobs.&amp;nbsp; If you take some time and put in a little effort, you will be rewarded with great riches.&amp;nbsp; Ok, maybe not great riches, but it will make fixing the bugs much easier.&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;&lt;br /&gt;&lt;a href="http://www.dotnetkicks.com/kick/?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx"&gt;&lt;img alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://devlicio.us/blogs/derik_whittaker/archive/2007/08/19/logging-bugs-the-do-s-and-don-ts.aspx" border="0" /&gt;&lt;/a&gt; &lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=38244" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Featured/default.aspx">Featured</category></item><item><title>Switch Statements with Enums best practice</title><link>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/26/switch-statements-with-enums-best-practice.aspx</link><pubDate>Tue, 26 Jun 2007 12:08:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:30379</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>7</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/rsscomments.aspx?PostID=30379</wfw:commentRss><wfw:comment xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://devlicio.us/blogs/derik_whittaker/commentapi.aspx?PostID=30379</wfw:comment><comments>http://devlicio.us/blogs/derik_whittaker/archive/2007/06/26/switch-statements-with-enums-best-practice.aspx#comments</comments><description>Over the years I have come to the conclusion when working with switch statements that switches on enum values, a DEFAULT block MUST be required. Not only should it be required, I think it should throw a developer exception. *** NOTE *** My stance on this...(&lt;a href="http://devlicio.us/blogs/derik_whittaker/archive/2007/06/26/switch-statements-with-enums-best-practice.aspx"&gt;read more&lt;/a&gt;)&lt;img src="http://devlicio.us/aggbug.aspx?PostID=30379" width="1" height="1"&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Methodology/default.aspx">Methodology</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Best+Practice/default.aspx">Best Practice</category></item></channel></rss>