1. Guard Clauses and Assertions

    Two simple techniques to increase code quality, resilience, and ease debugging scenarios is to use guard clauses effectively and ensure that assertions are used liberally.

    Guard Clauses

    • Any public method should perform guard clauses to ensure pre conditions are met.
    • Ensures the code's invariants are not broken.
    • Throw exceptions, because …
  2. Abstract Data Use Not Data Access

    Common data access abstractions I've come across and been guilty of implementing myself are the likes of:

    • IDatabase
    • IPersistentStore
    • IConnection
    • IDataStore
    • IRepository

    The problem is, these are not really abstractions. If anything they add an extra layer of indirection. One such benefit of this level of indirection is each concrete …

  3. Factory Obsession

    I have noticed a pattern over the years with developers of which I will refer to as factory obsession. Everything is a factory or builder object. To some, the use of new is banned.


    Consider a object that is responsible for some business logic and finally saves the result to …

  4. DDD Validation

    Validation within an application (specifically in terms of Domain Driven Design - DDD) can be solved in a variety of ways.

    • A validate method on the entity/value type in question
    • An IsValid property/accessor on the entity/value type in question
    • A separate service could be used

    Validate Method

    Adding …

  5. Developer Diaries

    A few weeks back I stumbled across a tweet which I unfortunately cannot find to give credit to. It talked about the benefit of keeping a developer diary.

    At the same time I was reading Getting Things Done (GTD). I felt inspired to take note of everything related to development …

  6. I Need to Stop Misusing Namespaces

    At the recent NSBCon one interesting question that came about was how to structure a project. The panel consisting of various speakers had no answer, after all this is dependant upon the project in question. Therefore there is no right or wrong answer.

    However one point they were in unison …

  7. The Correct Way to use var in C#

    The .NET community is not widely controversial, though there is a strong topic that appears to come up time and time again when I pair with other developers - how to use var in C#.

    The var keyword was introduced in .NET 3.5. Unlike other languages this is still a …

  8. Top Down vs Bottom Up

    Top down development has you starting at the highest point in the application that you can. From here you code down until there is nothing else left to develop. Once you reach this point you should be code complete. Along the way you may need to stub out areas that …

« Page 2 / 2