Other articles

  1. Testing your Composition Root

    Separating configuration from your code itself is a good practice. Unfortunately this can quite be quite complex in itself. In fact it is fair to say that in many cases the use of DI containers to achieve this can be overkill for a task that should be rather basic.

    Recently …

  2. Convention Based Tests

    Most projects have some form of convention. Examples would include:

    • Attributes/Properties for REST API's
    • Inheritance for third party base types
    • Assemblies/Packages for third party code that is loaded dynamically
    • Folder or namespace conventions
    • And many other forms of conventions

    In a few of these examples static analysis can …

  3. Finance For Software Developers

    Published: Wed 04 January 2017

    tags: tutorial

    Back at the start of 2016 I set about sorting my personal finances out, inspired by Soft Skills. The book makes a point to consider passive income as a viable solution to wealth building. The reason for this is simple, software developers tend to get paid well if working professionally …

  4. DDD - Events

    Published: Tue 01 November 2016

    tags: tutorial

    The act of something happening is one of the most crucial aspects of implementing Domain Driven Design (DDD). I missed the importance of domain events when first exploring DDD.


    Most requirements come in the form when something happens, do this. Something in this case would be an action, and …

  5. Constant Object Anti Pattern

    Most constants are used to remove magic numbers or variables that lack context. A classic example would be code littered with the number 7. What does this refer to exactly? If this was replaced with DaysInWeek or similar, much clarity is provided. You can determine that code performing offsets would …

  6. DDD - Bounded Contexts

    Published: Tue 14 June 2016

    tags: tutorial

    A single domain can grow large when applying Domain Driven Design. It can become very hard to contain a single model when using ubiquitous language to model the domain. Classic examples prevalent in many domains would be Customer or User models. A bounded context allows you to break down a …

  7. Given When Then Scenarios vs Test Fixtures

    There are two common ways of writing automated tests which apply from unit to acceptance tests. These are typically known as test fixtures and Given-When-Then scenarios.

    Test Fixture

    • Traditional method of writing tests.
    • The common JUnit/NUnit approach. Other languages have very similar concepts.
    • Single test fixture with multiple tests …
  8. 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 …

  9. The N+1 Problem

    Published: Mon 01 February 2016

    tags: tutorial

    The N+1 problem is when multiple queries are executed against a persistent store when a reduced amount could serve the same purpose. This degrades performance, uses more memory and can cause complexity to be added to the code that processes the results. Most sources of the problem come from …

  10. Application Validation and Domain Validation

    Published: Wed 13 January 2016

    tags: tutorial

    There are two types of validation in an application - application validation and domain validation. This applies whether or not you practice DDD. One of my mistakes in the past has been confusing or conflating these two responsibilities at the same time.

    Application Validation

    Application validation is anything technical or anything …

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

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

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

  14. Feature Toggles

    I'm a fan of regular releasing. My background and experience leads me to release as regularly as possible. There are numerous benefits to regular releases; limited risk, slicker release processes and the ability to change as requirements evolve.

    The problem with this concept is how can you release when features …

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

  16. Randomly Generated Values in Tests

    The use of randomly generated test data seems like a good thing at first glance. Having worked with several teams that have used this concept I generally discourage the practice. Consider a simple method that joins together two strings. A test using random values may look like this.


    Harder …
  17. 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 …

Page 1 / 2 »