Photo by Mitchell Luo on Unsplash

NullReferenceException is one of the most common exceptions we face when developing systems. This kind of exception is raised when trying to access some property or value from an object that is null.

We as developers sometimes forget to cover scenarios where the information could not exist, for example, when we try to recover a resource from a database through some unique id and this resource does not exists.

Let’s see how can we minimize the chances of this happen by “forcing” yourselves to deal with those kinds of scenarios by implementing the Maybe monad.

What is Maybe?

In a nutshell, Maybe is…

Photo by Michael Dziedzic on Unsplash

Applications that consume/produce any kind of data to remote servers (Apis) must have a policy to deal with transient faults. Transient faults are types of failures that are temporary and it’s likely to disappear soon, like package loss, network connectivity issues, etc.

Our application should not crash on behavior in the wrong way when some of these failures occur. We can rely on some patterns to avoid these kinds of behaviors, like Retry pattern, Circuit Break, Timeout, etc. In today’s post, we are going over how we can implement the retry pattern in C# using Polly and Flurl.

Installing the packages

In this…

Photo by Michael Dziedzic on Unsplash

Exceptions are part of any software and can happen any time even where we are absolutely sure that nothing can go wrong. Exceptions are inevitable, we all agree with that. We should always deal with them in our applications to avoid any kind of unrecoverable crash.

In order to avoid any chaotic scenario that could happen, we should handle our exceptions in a way that could help us deal with the particular problem, by logging that error, creating metrics, and other kinds of error monitoring.

In API applications, is very common we raise an exception in the process of validating…

Easily manage dialog opening and closing state

Photo by Ferenc Almasi on Unsplash.

Modals are UI elements that sit over the main window of the application and help users to make decisions without disrupting the current interaction flow. They also serve to provide feedback about actions triggered by the user and present some content without changing the current route/page of the app.

In this article, I will go over how we can use Redux in React to control whether the modal should or should not be visible. …

A better way to manage service dependencies

Photo by Shahadat Rahman on Unsplash

I would like to share an approach that I've been using on my Node.js projects recently. It’s been helping me to manage service dependencies in a better way.

What I have found is that combining the dependency injection pattern and some aspects of functional programming achieves a more testable, readable, and duplication-free codebase.

First, let's look at the traditional way of dealing with dependencies in our services.

Require Modules Directly at the Service

A common approach to declare service dependencies is to require them directly at the service file. …

Bruno Joaquim

Software developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store