Intro I wanted to play a little with Docker Compose so I created a little PoC that had the usual components of a web application: a frontend, a backend and a supporting database. Sample code to follow along here. Sample overview As I was just looking for the simplest thing just to make all the bits work together, I whipped out a pretty stupid scenario. The application basically lists some counters and increments each one as it’s selected.

Categories: infrastructure
Just added a new video, talking about the blog’s move from WordPress (and all that infrastructure I talked about in these series of posts) to a static site, generated using Jekyll and hosted using Netlify. A side note that I forgot to mention in the video: when using Jekyll, we need to set the environment variable JEKYLL_ENV to production, or stuff like Google Analytics and Disqus comments won’t work, as it’s disabled by default unless we’re in production.

Categories: infrastructure video
Tags: jekyll netlify
Intro This post will be simple and try to act as a discussion starter on unit testing static methods. I’m not the greatest fan of making static stuff, mainly because I’ve been burned by it in the past (the fact is that static was being used badly in those cases, but even so, if I can, I’ll avoid it) but I understand it’s the best way to do things sometimes.

Categories: dotnet testing
Just think how many times you had to write some code to handle errors, and that handling required more than just logging and proceed with life as if nothing happened. If retries are required, or a cool down time, that’s a good amount of logic to roll for those situations. Well, there’s a NuGet for that (I guess that’s our version of there’s an app for that). Polly is a “library that allows developers to express transient exception and fault handling policies such as Retry, Retry Forever, Wait and Retry, or Circuit Breaker in a fluent manner.

Categories: dotnet libraries
Castle Core is a library that provides some utilities but I’ll just talk about using one of them, the DynamicProxy. If the post on BenchmarkDotNet was in the race for golden shovel award, a post on Castle DynamicProxy is a sure winner, but I feel like it :) Castle DynamicProxy is a a “lightweight runtime proxy generator”, that enables you to do a kind of aspect oriented programming, allowing for some code to be executed before or after a method is invoked on a proxied interface.

Categories: dotnet libraries
(The redirect tag in the title means this post is just a share of another post) So, how do you use the HttpClient (.NET)? Like this? {% highlight csharp linenos %} using (var client = new HttpClient()) { var result = await client.GetAsync(“http://xpto.com/api/stuff"); //… } {% endhighlight %} Well, so do I. And it’s wrong. Check out this article that tells you all about why. tl;dr Use a singleton instance. Oh, and after that one, this is also a good (important) related read.

Categories: dotnet redirect