Welcome to MSDN Blogs Sign in | Join | Help

August 2009 - Posts

I've been sitting in a lot of code reviews and code inspections where somebody suggests a change to optimize something. The response from the author is almost always; but that's premature optimization! End of argument... But I almost never hear somebody Read More...
This time we took the completed BankOCR Kata from last time and tried to refactor it using the object calisthenics rules . It was really fun and the dojo was quite different from the other dojos which has been more TDD focus. This time we had a lot of Read More...
This is my favorite rule. I think it's a forgotten guideline in OO design to tell objects what to do with their state rather than asking for their state. Applying this rule to code changed the way I had to write code most of all rules. Keeping classes Read More...
Yet another rule to keep your objects focused at a single responsibility. Any class with an instance variable that is a collection should have no other instance variables. When I first tried object calisthenics this was actually easier said than done. Read More...
This is another aspect of keeping your entities small I think. Classes with a lot of instance variables tend to have more than one responsibility. This rule may also help you create a more generic design if used correctly. For example consider you want Read More...
This is a funny rule when exercising this. No class should be more than 50 lines long and no package should have more than 10 files. I guess package is a java-ism and converting to .Net I's say no more than 10 classes in each name-space. This is the rule Read More...
This rule has a weird name I think. What it means is that whenever you abbreviate in a class or method name you should think about why you do that. The assumption is that if you feel you need to abbreviate something it means you're using it too much. Read More...
Not only is a long line with a lot of dots harder to understand. It usually means that your object is using not only the objects it knows but the objects their "friends" know too. Having only one dot per line does not only make your code more readable. Read More...
This rule states that no parameters should be a of a primitive type (e.g. int, double) nor a string. Instead new objects should be created to represent what the parameters are. Is the integer really representing money or a coordinate. This small classes Read More...
Some people think that the if branch should be the every thing is good branch and the else branch being the error case. Others think the if branch should be as short as possible since it makes it easier to understand what would bring us into the else Read More...
First of all a method with a lot of different indentation is harder to understand than a method with less indentation. I also think that each level of indentation typically means you're doing another thing. Look at this code: 1: public void Format() 2: Read More...
A few weeks ago I was introduced the the object calisthenics described by Jeff Bay in the book The ThoughtWorks Anthology . The object calisthenics is a way to practice writing object oriented code. The nine rules of are not intended to be used in your Read More...
A few days ago there was an article with 20 tips to write a good stored procedure (requires free registration to read). The problem is that there are really only 12 good tips (and 4 bad and 4 neither good or bad). So let me go over the tips one by one Read More...
Today I read this blog post about how all .Net applications create three exceptions upon start; System.ExecutionEngineException, System.StackOverflowException and System.OutOfMemoryException. The reason is that if these are not allocated from the start, Read More...
I've heard that some people don't think the CodingDojo site tells you a lot about what to expect in a coding dojo. It's more about practical things and listing a number of good problems to solve during the dojo. So I'll try to elaborate. In a coding dojo Read More...
Fourth MSFTCorpDojo today. MineSweeper and MicroPairing this time too.This time we, as a result of the retrospect from last time , we did BDD-style testing (I've added one of the test classes below as an example). We decided to start by implementing a Read More...
I recently experienced a weird behavior with FxCop. The classical " everything works fine on my machine but not on the build server " situation. In this case I got a few FxCop warnings from the build server but could not replicate when I ran FxCop locally Read More...
 
Page view tracker