In all our project, we use data classes which, by definition, contain data (fields) but no (business) logic. According to the best coding practices, a data class should preferably be immutable because immutability means thread safety. Main reference here is Joshua Bloch’s Effective Java book; this Yegor Bugayenko’s post is also very interesting reading. An immutable class has several interesting ...
Read More »Home »
Java EE schedulers
Java EE application servers have native scheduling support and, in most of the applications, there is no need to include external dependencies like the famous Quartz scheduler library. The Java EE 6 Timer Service, available on Java EE 6 and 7 full profile, give us many options to define the scheduling interval and what’s happen if we stop and restart ...
Read More »Tutorial: Correct SLF4J logging usage and how to check it
SLF4J is a very popular logging facade but, like all libraries we use, there is a chance that we use it in a wrong or at least in a not optimal way. In this tutorial we will list common logging errors and how we can detect them using FindBugs. We will also mention PMD and Sonar Squid checks when relevant. ...
Read More »The 5 Java logging rules
Logging is a critical factor that should be always kept into account during the software development. When something bad happens in production, the log files are usually the starting point of our fault analysis. And, often, they are the only information in our hands to understand what is happened and which is the root cause of the problem. It is ...
Read More »Tutorial: logging during tests
Logging is a popular solution to show what the software is doing while it is running. But what happens to the logging when we are unit testing our application with jUnit/TestNG ? During the automated tests execution, we are usually not interested to see the logging messages because our main interest is the test results. It would be nice to ...
Read More »