How To Validate Commands in a CQRS Application

Any of these sound familiar?

Rubbish in rubbish out.

Never trust user input.

If you’ve ever built any sort of professional application you will have had to validate user input. Whether it is to ensure a valid email address or something more complicated. There are tried and tested ‘rules’ for doing this safely while being nice the user.

  1. Validate on the client side – makes for a better user experience
  2. And validated on the server – never trust user input

But here’s a question..

If you issue commands rather than send in models, where should the validation occur?

The most obvious answer is in the domain model.

But this poses a problem… Continue reading

The LiveScribe 3 Smartpen [Product Review]

Could This Change the way you work?

The pen is mightier than the sword. Or so they say. However, this smart LiveScribe 3 pen may just be mightier.

Picture a typical meeting…

You’ve got a whiteboard, notepad, your phone and hopefully the right people in the room. You may even have some funky planning poker cards*.

All good so far.

Now if you are into domain driven design, the chance are you’re going to want to get involved in the meeting. Listen closely to the language used and try to deepen your understanding of the domain. Or at least that’s what you’re supposed to be doing! Continue reading

Are You Making These 10 DDD Mistakes?

Making mistakes is part of programming. Spotting them early can save you time. I’ve started to notice a common set of ‘DDD Mistakes’ which many of us seem to make. And yes, I’ve made them all at some point in my career. This is by no means the definitive list – I’m sure there are more. Continue reading

Download this infographic.

Embed Our Infographic On Your Site!

Is a CQRS Command = to a GoF Command?

Oh the irony.

The DDD community advocates for unambiguous language. And yet even our own terms are heavily overloaded. Whether it’s on stackoverflow like here or on the DDD/CQRS google group like here.

So, just to be clear …

… a CQRS command is not the same as the Gang Of Four Command Pattern.

But what are the differences and how best to use them? This is what I’ll cover in this post.
Continue reading

How to Send Emails the Right Way in a CQRS System

Title Image

Where do you put code for sending emails? Sounds simple right? The funny thing is that if you’re adding it to a CQRS system it can be a little tricky.

Why?

It all depends on when you send them. Too early and other processes may fail and you end up sending your email half cocked. And don’t forget event replay. Could be a bit embarrassing re-sending all the emails since your app launched. I was a hairs whisker away from doing just that once!

So, in a CQRS ES system, where do you put the code to send the emails? Continue reading

How to Upgrade CQRS Events Without Busting Your Event Stream

Events are at the heart of a CQRS Event Sourced system. Which is why changing or upgrading them can be problematic. In this post I’m going to cover a few principles to bear in mind, which should help you avoid hitting the rocks. Before I dive into  ‘how to upgrade CQRS events’ I’m going to recap the role Events play in the system. Continue reading

Business Rules – When to Break Them

The nice thing about programming is that everything is black and white.

Wrong!

When designing new features, we all go through a process of discovering requirements. If you are a good developer, you will start to ask questions and probe deeper to find the edge cases. Why? Because you know the edge cases can often take up 80% of the development time. But is that where 80% of the value is? Continue reading