Image for post
Image for post

When we right software we need to worry about so many things. For instance: Performance, Scalability, Security, and many other important concerns. There is also a need to worry about corner cases, error paths, and conde readability from other engineers. Which is not an easy task. So should we return null or not? Should we throw an exception or not? Null is considered to be a Billion of dollars mistake. Languages have some concepts to help us like Haskell has the Maybe Monad. Scala has Option. Rust has Result. Java has Optional. Since version 8, Java improved a lot and there is still a long head ahead but slowly getting there. Today I decided to do something different with you guys, let’s do a simple refactoring together in order to improve our code and understanding. So there is a video showing from zero to a hero like code step-by-step. This is the first refactoring video I make, hopefully, it will be interesting for you guys. Without further due, let’s get started!


Full code here on my github.

Diego Pacheco

Originally published at on May 19, 2020.

Brazilian, Software Architect, SWE(Java, Scala, Rust, Go) SOA & DevOps expert, Author. Working with EKS/K8S. (Opinions on my own)

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