Forget for a moment about correctness, efficiency, or performance. If your code has 10 nested ifs or nested loops, the computer will be able to process and run it the same way as if it had one or two. No matter how badly written is the code, once it is compiled or interpreted without failure, the computer can run it. However, developers should write code not only for computers to run but also for other developers to understand and continue evolving it.
Read MoreYour first SpringBoot app in 5 steps
SpringBoot is made to be powerful and easy! It’s very nice to work with and you will need only these 5 steps for your first app in a Maven project: Define the SpringBoot parent lib Define the dependency to the SpringBoot web library Define the Maven plugin for SpringBoot Create the main method Create a controller with an endpoint Parent SpringBoot lib This is the main and first step when creating a SpringBoot application.
Read More5 popular decorators from Java
As a software developer, you probably know the Decorator Design Pattern, described in GoF. If not, read this first. Java has some nice decorators that can make your life easier, or tougher, depending on the case. Below, you will see a list of five decorators present in Java that you didn’t even realize they were decorations. java.util.Collections.synchronizedList(List list) Java 8 provides many synchronizedX() methods, for lists, sets, maps, etc. They are analog.
Read More4 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 is being responsible for too many things.
Read MoreLombok 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
.
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 MoreBookStore WebServices
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 MoreWitsCounter
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 MoreBit 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 control (e.
Read More