Coffee-Driven Development

Brewing Thoughts for Better Code and Stronger Teams
en nl

Specflow and Eventual Consistency

May 30, 2021 Testing

SpecFlow is a tool which can be used to describe test scenarios and automate the tests. Although I have been using SpecFlow for a while now I never used it for advanced examples where time might be an issue. Lets show a simple example scenario first. A scenario, written in Gherkin, looks like this:

Scenario: Add simple item with due date
    Given the user enters "wash my car"
    And the user adds a due date of "1-1-2022"
    When the user saves the item
    Then the item "wash my car" is added to the list
    And the due date is "1-1-2022"

This scenario is easy to implement, the item will be added and stored. That’s it. Easy to verify, no delays, straight forward. But what if you have some microservices with a queueing mechanism? A scenario where data will be queued before processing so we can’t exactly know when the data is processed?

Continue reading

Arrowhead anti-pattern challenge

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 ).

While it was nothing new, I never knew it was called arrowhead anti-pattern (or arrow anti-pattern).

Continue reading

Retry and fallback policies in C# with Polly

April 18, 2019

In this blog I will try to explain how one can create clean and effective policies to retry API calls and have fallbacks when requests are failing. With Polly it is possible to create complex and advanced scenarios for error handling with just a few lines of code.

This week I was connecting an eCommerce web application to an ERP system with REST APIs. There are multiple endpoints, all authenticated with OAuth. To make sure all calls to the APIs will have a high success rate I had to implement retry mechanisms for different scenarios.

Continue reading

Things I Learned This Week - #1

April 4, 2019 Testing Learnings

My plan was to write a quick post about some cool things I found and learned this week but I just learned too much (as I do every week). Below are just the highlights, I will try and write more posts like this, especially if I get some cool comments :)

Read about a REST Client, Unit Testing, TFS and more in this post!

Continue reading

Asynchronous Model Validation

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.

Continue reading
Older posts Newer posts