update (2019-11-08): added a bonus contribution from Bob, written in prolog Just recently I had to work on a huge flow-chart to determine farm types based on the animal transports to and from farm locations. I started out with a small proof of concept but didn’t like the way it turned out. I did some research and learned I was basically creating a so called arrow head (“Arrowhead” anti-pattern ).
UPDATE: Kamil Grzybek commented on my article and pointed me in this direction: a blog post about Async OOP 2: Constructors by Stephen Cleary. While I still my post, I realize it is a bad practice.
Last week I found some great articles about Domain Driven Design. While I have been trying out various patterns and design principles like Clean Architecture and Domain Driven Design I was still finding out how to implement domain events. While doing some exercises I came up with a solution to validate domain entities with asynchronous validations which I want to share.