The Decorator design pattern in software development

A decorator is like a picture frame. It wraps the main object, adding some other functionality to it. The main goal of the Decorator pattern is to enable the addition of functionalities or behaviors dynamically to objects. To enable additional functionalities or behaviors in classes, a simple inheritance could easily do the job and no design pattern would be necessary. However, pay attention to the term “dynamically”. It means that the decorator must be instantiated after the …

Read More

4 rules to write deadly fast and efficient unit tests in Java with Mockito

Unit testing in OOP is the test of the smallest testable piece of code: the class. It’s used to make sure a single class does what it’s supposed to do. After some years of experience, I got to see unit testing as a crucial part of the software development process, since they give me some important advices that I couldn’t identify before writing them. Not being able to write a good and simple unit test might be a sign of code smell, advising you that your code is too coupled or …

Read More

CodeSmell

This is a post written in Portuguese, as a free translation of Martin Fowler’s article CodeSmell. Translated on September 10, 2017. Este é um post escrito em Português, como uma tradução livre do artigo CodeSmell de Martin Fowler. Traduzido em 10 de Setembro de 2017.

Read More

Lombok Constructors

In the post Lombok Getters and Setters, we talked about the use of Lombok to provide quick and easy getters and setters. In this post, I will cover another great feature from Lombok, that provides quick and easy constructors. For this post, I will use Lombok v1.16.16.

Read More

Lombok Getters and Setters

If you are a starter developer, this post is for you. Who has never got fed up with all the generic purpose getters and setters we need to write? Even with the functionalities IDEs provide to automate it, we still have that amount of redundant code written in the classes.

Read More

BookStore WebServices

In this post I will explain step-by-step how to create a simple BookStore with RESTful WebServices. This code is also available in my GitHub page. Feel free to comment if you have any doubt or suggestion. 😄

Read More

Simple String Generator

It’s usually necessary to have a way to produce random strings programmatically: Produce random IDs for entities; Produce random passwords; Produce random patterns, etc. Today, I will show you a very quick way to create those strings for studying purpose or as a simple solution.

Read More

WitsCounter

Recently, I published a post of an application called WitsGenerator to provide random Wits data through a TCP port. Today I’m publishing another application related to the Oil & Gas business, but now it’s to count the amount of parameters being transmitted through Wits.

Read More

Bit Shift & Bitwise

Bit Shift and Bitwise are operators that make binary calculations perfectly straightforward. Some years ago, I had to refactor some logic using bit shift operations. That made me think that most developers had never seen or even understand what are bit shift and bitwise operations. These operators provide a great must-know solution for specific problems, like network calculations (IP & netmask); privileges processing based in bit fields; communication involving checksums, parity, flow …

Read More

Two's Complement

Have you ever thought about how numbers are represented in your computer? We all know that computers “talk” in binary, but how exactly does it work? In this post, I will briefly introduce Two’s Complement, which is the way signed integer numbers are represented. Signed data type are data types that support representation of negative and positive values.

Read More