An example using Roslyn to stop doing if return else statements. It’s bad for maintainability and it is error prone.
In one of my previous posts, I talked about Not every if–then-else statement, needs the else.. Today, we’ll explore the creation of an Analyzer using Roslyn API, that will analyze the source code looking for any Guard clause with If-Return-Else or If-Throw-Else.
Fixing “The term ‘Invoke-WebRequest’ is not recognized” error
I’ve decided to check out the code from Orchard2 to learn more about it and the new ASP.NET Core 1.0. Following the Getting Started points from their github’s page the third bullet point is to run the build.cmd. I did and the output was the following
, on Consumer-driven-design, Pact, Continuous delivery
Learn how Consumer-driven contracts with Pact can help you with dependencies between services when using microservices architecture.
Microservices are here to stay. When using a microservices architecture, theory says, we get a more flexible system. It’s easier to deploy, because instead of releasing the entire system, as in a monolithic application, we can release small parts of the system independently. We get hardware flexibility, because we may need different hardware specifications for different parts of the system. We get programming flexibility, because we can have a service using C# with WebAPI and another one using Node.js. The flexibility is wonderful and it all sounds great however, our ability to release the services independently is more often than not restricted by the dependencies between services. To evolve to microservices architecture smoothly, we need continuous delivery. This is very important for several reasons, for example:
Stop doing if return else statements. It’s bad for maintainability and it is error prone.
As a software engineer, I have the opportunity to review a lot of code from other engineers. One thing that makes me happy is that the number of people doing a defensive code is growing, but there is still room for improvement.