No "Add Method Stub" When Passing or Assigning Delegates

I finally noticed the other day the “Add method stub” SmartTag wasn’t appearing for a new method name I type in.  I decided I’d have a closer look… When you’re practicing Test-Driven Development (TDD) you want to write a test for methods before you write the methods.  This means you write a test method that calls several other methods that don’t exist yet.  The Visual Studio IDE, in an effort to promote TDD, recognizes this and when you have your caret over a call to one of these methods a SmartTag shows up and you can select Generate method stub … Continue reading No "Add Method Stub" When Passing or Assigning Delegates

My Wishlist for C# 4

[Edit: fixed the not-ready-for-publication problems]  There seems to be more than few people blogging about what they hope C# 4 will do for them.  I haven’t seen one that really synchronizes with my thoughts, so I’d thought I’d post my own list. Variance A good story with regard to variance with generics is vital for upcoming versions of C# 4.  You could argue that this should have been done in 3, but, unfortunately, that wasn’t the focus.  I think this really needs to be done for 4; and if Eric Lippert’s blog is any indication, that may come true. Design … Continue reading My Wishlist for C# 4

Playing with LINQ

If you’re interested in seeing what you can do with LINQ and want to learn the syntax, there’s a wonderful new utility called LINQPad that is available.  It basically lets you type in LINQ statements (or create statements from tables) and see what the result would be with a given database.

Not Knowing Why Something is Better or Worse Means You Believe it’s Magic

In the software development field you often get zealous people evangelizing that certain techniques or methodologies have certain side effects or help produce certain results.  They often don’t detail the causation of the results to the particular technique or methodology.  Sometimes it comes in the form of “use that for this”, or “I use this to do that”; and sometimes it comes in the form of “this helps to do that” or “they didn’t use this so it must be bad”. There’s nothing wrong with taking the advice of someone you trust; but do yourself a favour and think about … Continue reading Not Knowing Why Something is Better or Worse Means You Believe it’s Magic

In progress

Other:Composite Reuse Principle – Favour composition over inheritance for achieving polymorphism.

Maxim’s of Object-Oriented Design – Layers

Good object oriented design is much more than simply modeling real-world concepts as classes (and when I say classes I mean “types” which could include “struct”), methods, and attributes.  Object-oriented design involves the interaction of the entire system, that interaction should also follow sound object-oriented principles and influence the design of the individual parts of the system. There’s various OO design principles for classes, like the single responsibility principle, high cohesion, low coupling, acyclic dependencies principle, separation of concerns, etc.  All of these principles build on and enhance either encapsulation or abstraction. There’s many design patterns for making easier to maintain … Continue reading Maxim’s of Object-Oriented Design – Layers

Testing the Units

In OO there’s levels of abstraction.  A class, for example, abstracts a read-world concept into a encapsulated bit of code.  A class is autonomous.  That class lives in world with other classes and interacts with them, but is autonomous. I believe development testing should account for these abstractions, not just the interactions or behaviour of the system.  One problem I see with Test-Driven Development (TDD) and Behaviour-Driven Development (BDD) is that practitioners simply just center on interaction of the parts of the system and really don’t do any “unit testing”.  They get caught up in the mantras that are TDD and BDD and fail … Continue reading Testing the Units

A Time and Place for Code Comments

I’ve dealt with more than one person who believes all code comments are bad. The first person I encountered who said that also asked me to explain why a particular algorithm was used instead of another because there were no comments explaining it. But, one of my primary principles is that you should get the compiler to do as much work as possible when it’s compiling.  This has to do with preferring compile-time errors over run-time errors; but it does have an effect on comments.  The result is that they should be avoided in preference to self-commenting code because the … Continue reading A Time and Place for Code Comments