Experienced Java/Java EE Engineer (Architect and developer) , team leader and agile enthusiast. Most of the projects where the employee has been involved in the last 10 years were based on J2EE architectures. He has been working as a team leader and project manager for the last 8 years. He was technical leader and member of the development team for major projects in public sector such as National Municipal Registry, Online. Patroklos is a DZone MVB and is not an employee of DZone and has posted 21 posts at DZone. You can read more from them at their website. View Full User Profile

To SonarQube or not to SonarQube?

02.17.2014
| 4840 views |
  • submit to reddit

This is the first question that a team leader, s/w director, customer, developer, architect, tester or whatever role exists in a development team should ask. It’s not yet another question about using another “quality tool”. You already have plenty of them installed. This is not a simple question to see how much you care about test coverage or to find which classes have the most issues. There is no competition and no prize about that! It’s the only question that you needto answer in order to show how much you care, how much you REALLY care about the overall quality of your code. If you have never used SonarQube or even heard about it, then this is your chance to find out how this little (but great) piece of software have changed our lives (as developers) and enhance our products.

Darkness. This is how I describe our development life before SonarQube. We had no insights of our code. We ran no unit tests. We did not know whether the current design allowed us to quickly add new features or make important changes, which made us apprehensive about any refactoring attempt. Coding rules; Issues; what the heck are these? Duplicate Code? God bless copy – paste. Testability, Stability, Changeability were terms we needed to look-up in a Chinese dictionary to find out their meaning. Bugs were discovered late in the development lifecycle causing some red-alert situations and releases seemed to be some kind of middle-age dragons that our support and test department had to fight before they come out to our customers. And then some kind of a miracle happened. I can’t remember how I reached SonarQube, but right now I am quite sure that, those 10 minutes I needed to read SonarQube’s features, changed our mindset.

Without any second thought I downloaded and installed it. Full of excitement I analyzed my favorite project and after a couple of minutes I was starring at my screen in front of my first ever SonarQube dashboard.My first feeling was an extreme disappointment:”Our code sucks!”. Soon I realized the possibilities of this unknown to me tool and I was stimulated about the potentials. Immediately I showed it to my team, shortly explaining them, the different metrics and their meaning about code quality. A new era has begun. Today, SonarQube tracks all our projects. Every morning team members check the project dashboard, especially the differential views from last analysis. We have configured thresholds for the most important metrics, so whenever new code reach a threshold, build is broken. We handle these builds just like all broken builds: Fix them ASP and restore the required quality. Before we begin a refactoring task we always consult SonarQube for signs of poor design. We continuously strive to focus on code quality from the first day of the project and SonarQube is the best ally we could ever hard. I love to see my bubbles(Motion Chart) changing colors and moving towards perfection. I love to see my projects treeview getting green from red. With a single view I can figure out which components need our further attention. Just pick up the red big-ones and start cleaning up your code!

Our new product releases are much more stable. From dragons are transformed to butterflies. Trust and confidence in our team has significantly grown. We feel no fear when we add new features or modify existing ones. In other words, this is our SonarQube life! Sometimes, I wonder how our code could “breathe” some years ago. SonarQube gave us the missing oxygen. I have answered the question to myself. I have chosen light instead of darkness. it’s your turn now!

Published at DZone with permission of Patroklos Papapetrou, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)