Other articles

  1. Why You Should Do Code Katas

    Code katas are simple exercises that are meant to be repeated. They are great for learning a new language or tool. The goal is to learn something, not to complete them. In fact, if you don't finish a kata that is perfectly normal as long as you take something away …

  2. Anaemic Domain Models and Code Smells

    An anaemic domain model (ADM) is considered a code smell in many cases. An ADM is present when you have a entity representing your domain, but void of any behaviour. Any logic is separate and operated upon in isolation. Such domain models can be thought of as simple property bags …

  3. You Rarely Need Custom Exceptions

    Implementing custom exceptions usually gives a hint as to why you rarely need custom implementations. They are often nothing more than sub classes where the only difference is the type name and containing message.

    In this C# example there is a lot of code for nothing. When checking logs or …

  4. X% of Configuration is Never Used

    Code configuration is essentially for the likes of URLs, credentials or other per deployable settings. Sadly configuration seems to fall into examples where there is simply too much configuration, or the system has so many configuration points the actual code becomes far too complex for its own good.

    Too Much …

  5. Pulling the Plug on Date Time Parsing

    Date/time logic is hard. Throw in time zones along with daylight saving and it's even harder. Recently a suite of tests that had happily been running for months started failing. There were no code changes and all the tests were somehow related to date/time ranges.

    Despite this the …

  6. ReactJS and JSHint

    The ReactJS Getting Started Guide states that the recommended way of using React is combined with npm.

    This is great but poses a problem when trying to use JSHint. The default example outputs a single JS file containing both your code and the React library. The end result is the …

  7. Abstractions in Code, Details in Metadata

    I've programmed many games - each one was special in its own way. One in particular stands out early in my university studies, a top down shooter. It was not graphics, gameplay, or sound that made it stand out however. It was the lesson it taught me about software development.

    Level …

  8. Header Interfaces vs Role Interfaces

    In some languages such as C++ you must define header interfaces. These constructs define how a public type is exposed in terms of its public interface. Other languages take a different route. C# or Java do not require headers but they are still very much in circulation. This unfortunately brings …

  9. Static Code

    Static code is considered a bad thing by developers. This is especially true when working with legacy code. The use of static code is often seen as a smell and should not be used.

    This is not as black and white as it first seems. Static code can be problematic …

  10. Branch by Abstraction

    Feature toggles are great for new features or features that are either enabled or disabled. Branch by Abstraction offers the same benefits as feature toggles but the seam to introduce the change is the abstraction itself. Unlike Feature Toggles, the use of Branch by Abstraction allows a gradual transition to …

  11. FirstOrDefault in LINQ

    Explicit null checking is a code smell in most cases. It should be limited where possible, or pushed to the edge of the system. A common anti pattern I've noticed is the incorrect use of First() in LINQ, which I have used myself on many occasions in this manner.

    Assuming …

  12. Value Object Refactoring

    After extract method or extract class introducing a value object is one of the most powerful refactorings available. A value object encapsulates a value or concept within your domain. While the term is more formally known from Domain Driven Design, DDD is not a pre-requresite for use. Introducing a value …

  13. 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 …

  14. Caching

    The naive approach to implement caching is to just store everything in an in memory collection such as a hashtable. After all it works on my machine.

    I've worked on systems in the past that used this technique but:

    • Bring in two processes and this falls apart
    • No Time to …
  15. Dependency Injection (DI) Containers


    One place for configuration
    Rather than scattered through out the system. Most DI containers have some sort of "module" system where you group associated components together.
    Different types of lifestyle can be achieved. Per request, per thread, singleton and others. Usually other frameworks have the ability to plug …
  16. Ratcheting

    Some tasks in software development are mundane such as formatting and code conventions. Where possible tooling should take away some of this pain, however sometimes you need a developer to take on a task that requires a great deal of time and/or effort to complete. Tooling will only get …

  17. Characterization Tests

    Having worked with some truly awful codebases a common problem tends to arise every now and then. You need to make a change within some legacy component that most likely has limited or no automated tests around. This can be a scary process.

    There are a few techniques you can …

  18. 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 …

Page 1 / 2 »