clean code

The Problem with Overusing Static Variables and Methods in Java

Static variables and methods are shared among all instances of a class and can be accessed without creating an object of that class. While static variables and methods can be useful in certain situations, overusing them can lead to code that is difficult to test, maintain, and extend. Here are some examples of bad practices… read more »

Quick Win Hints for Refactoring Java code

There are several quick wins that can be achieved through refactoring Java code: Overall, refactoring can help improve the quality of Java code, make it easier to maintain, and reduce the risk of introducing bugs. here are some examples of quick wins in refactoring Java code: Before refactoring: public void doSomething() { // code block… read more »

How to Write Clean, Unobfuscated Code in Java

Writing clean, easy-to-read code in Java is important for improving code readability, maintainability, and overall quality. Here are some tips for writing clean, unobfuscated code in Java: Here is an example: This class represents a person and contains two private fields: name and age. It also includes a constructor, getters and setters for the fields,… read more »

How to Write Obfuscated Java Code

To some people obfuscating programming code, including Java, means: Of course, obfuscating code is a terrible idea and usually means exactly the opposite to the above bullets, i.e. that the person who wrote it is easily replaceable and far from smart. That’s why even though it’s not impossible, it’s very likely to see obfuscated code… read more »

How to Get Rid of the Lombok Dependency and Its Annotations

If for some reasons you have decided that you don’t like Lombok any longer, you can follow these steps to remove it: There is also an automatic tool called Delombok to help do automate the removing of Lombok. Delombok is a command-line tool provided by the Project Lombok library that can be used to remove… read more »

What is Boilerplate Code and How to Reduce It In Java

In programming, boilerplate refers to sections of code that are repeated in many places throughout a project or across multiple projects. This code may be necessary, but it is often repetitive and can make the codebase harder to read and maintain. Examples of boilerplate code in Java might include getters and setters for class variables,… read more »

Worst Practices to Avoid in Java Programming

One of our latests posts was how to become a better programmer with the help of OpenGPT. Still, even without the help of AI, there are things you can do to become a better programmer and the most important is to avoid some bad practices. There are several practices in Java programming that are considered… read more »

How to Use OpenGPT to Become a Better Java Programmer

OpenGPT is very popular lately. If you haven’t heard about it yet, it is a language model developed by OpenAI that can generate human-like text based on a given prompt. While OpenGPT can be a useful tool for generating code snippets, including Java, it is not a replacement for actually learning how to code. Here… read more »

How to Become a Better Java Programmer Using SonarLint

One of the fastest ways to advance in Java programming is using SolarLint’s IDE extension. It helps you avoid common problems and ensures your code is clean. SonarLint is a linting tool for code quality analysis and improvement. It is a plugin for various Integrated Development Environments (IDEs), including Eclipse, IntelliJ, and Visual Studio, that… read more »

Why and How to Use Optional in Java

The Optional object type in Java was introduced with version 8 of Java. It is used when we want to express that a value might not be known (yet) or it’s not applicable at this moment. Before Java 8 developers might have been tempted to return a null value in this case. Ultimately, there are… read more »

Sidebar