Here is one thing you can do to improve your project readability today

Here is one thing you can do to improve your project readability today

Sometimes adding comments in your code base is inevitable especially when involving long processes. Ideally, it's best to structure your classes, methods and variables names to be as descriptive as possible. But this might not always be straightforward.

Working on such types of projects, here's what I found. Replacing the comments with loggers is more effective. Not only can you read what's supposed to happen, but you can also closely follow when the program is run. Moreover, if you're logging to files with timestamps, you know precisely what's happening behind the scenes even after the project has run.

Furthermore, you only have one place to maintain such description. In the example below, it's better to replace the comments.

This looks much cleaner and better organised.

Bonus points

You can also replace your print lines or console logs with loggers. Another win win situation.

Consider replacing the text in the println below with solely the logger.

Even after debugging an issue, you don't have to come back to your codes and manually remove these print lines. Next time you run this method, this value appears in the logger. And in case you don't want any logger for example for security purposes - with having a separate dedicated logger, you can easily activate or disable it. Or even better: with minimal configuration, you can also log to files locally or in remote servers.