Expected Exceptions

Code, Software, and things that interest me

Xando pt. 3 - JSON

Previously we looked at events and commands, and this time we'll look at converting events (primarily) to and from JSON. The code can be used for commands too (with really minor modifications), but it's primarily made for dealing with events. First, let's take a look at the code used to represent events again: Here we have 4 different events. In and the data: and the data: The is a literal with the value ). So, how do we get from my JSON representation to an instance of ). So, how do we get from my JSON representation to an instance of...

Previously we looked at events and commands, and this time we'll look at converting events (primarily) to and from JSON. The code can be used for commands too (with really minor modifications), but it's primarily made for dealing with events. First...

Xando pt. 2 - Events, Commands and State

In the previous post we talked about some general concepts of CQRS and Event Sourcing. In this one I'd like to get a bit more hands on with the problem. Namely, I'm going to look at what events and commands we need for our user system, and what state we should keep to enable writing our business logic. So, let's start by analysing what a user can do. Or more more to the point, what a user can have done (which is a really weird sentence). Let's talk about events. Events In general, when dealing with database systems, most programmers knows that...

In the previous post we talked about some general concepts of CQRS and Event Sourcing. In this one I'd like to get a bit more hands on with the problem. Namely, I'm going to look at what events and commands we need for our user system, and what state...

Crazy things you can do with the F# ternary operator

I was working with two different monads in F# the other way, and writing code like the following: I did not want to use a builder for different reasons, therefore I was calling manually. However, while the code above works I was not happy with it and wanted to improve it. The obvious thing to do first is to swap the arguments using the pipe ( ) operator, in which case we end up with this: ) operator, in which case we end up with this: The result is definitely better, but I'm still not digging it. One of the things I don't like about this is...

I was working with two different monads in F# the other way, and writing code like the following: I did not want to use a builder for different reasons, therefore I was calling manually. However, while the code above works I was not happy with it...