tracking and improving software quality with sonarqube

25
Tracking and improving software quality with Sonar(Qube)

Upload: patroklos-papapetrou

Post on 09-May-2015

5.750 views

Category:

Technology


3 download

DESCRIPTION

Presentation at java day riga 2013, about code quality, technical debt and SonarQube

TRANSCRIPT

Page 1: Tracking and improving software quality with SonarQube

Tracking and improving software quality with Sonar(Qube)

Page 2: Tracking and improving software quality with SonarQube

SonarQube and me(Patroklos Papapetrou)● 15 years experience in software engineering● Agile team leader● Active member of the SonarQube user and

development list● SonarQube plugins contributor● Addicted to software quality and Continuous

Inspection● Co-author of SonarQube in Action

Page 3: Tracking and improving software quality with SonarQube

Overview● Code quality (what, why and when)

● The 7 Axes of quality and the Technical Debt

● SonarQube introduction

● SonarQube to the rescue (demo time)

Page 4: Tracking and improving software quality with SonarQube

private String _ugly_name; private String ANOTHER_$UGLY___NAME; private static String am_i_static;

public void please_work(ArrayList objects){ for (Object object : objects){ if (object == null){ String toString = object.toString(); } else am_i_static = object.toString(); doSomething(object); } } private void doSomething(Object object) throws NullPointerException { throw new NullPointerException(object.toString()); }

Page 5: Tracking and improving software quality with SonarQube

What is code quality?

Page 6: Tracking and improving software quality with SonarQube

What is code quality?

“It’s an indicator about how quickly

developers can add business value to a

software system”

Page 7: Tracking and improving software quality with SonarQube

Why measure?● Source code is the heart of each system

● Developers don’t write new software. They

maintain “legacy” systems

● A system is (almost) never “finished”

● You can’t improve if you don’t measure

● Broken window theory

Page 8: Tracking and improving software quality with SonarQube

The broken windows theory

Page 9: Tracking and improving software quality with SonarQube

When you should measure?

● From project day #0

● Continuously

● Prevent vs post-actions

● Prioritize and plan

Page 10: Tracking and improving software quality with SonarQube

What you should measure?

● Not just abstract numbers

● Evolution through time

● Metrics?

● Welcome to the 7 deadly sins of devs

Page 11: Tracking and improving software quality with SonarQube

The seven axes of quality

Page 12: Tracking and improving software quality with SonarQube

The seven axes of quality

Architecture & DesignCoding Rules

Test

Cov

erag

e

Potential Bugs

DuplicationsCom

plexity

Docum

entationTechnical Debt

Page 13: Tracking and improving software quality with SonarQube

Technical Debt

“If the debt grows large enough, eventually the company will spend more on servicing its debt than it invests in increasing

the value of its other assets”

Steve McConnell(author of code complete)

Page 14: Tracking and improving software quality with SonarQube

This is your source code when you don’t pay your

technical debt

Page 15: Tracking and improving software quality with SonarQube

“Good” & “Bad” Technical Debt

Page 16: Tracking and improving software quality with SonarQube

How to deal with Technical Debt

Page 17: Tracking and improving software quality with SonarQube

What SonarQube is / does● Free & open source “Code Quality Platform”

● Provides moment-in-time quality snapshots

● Gives trends of lagging and leading

indicators

● Tracks developers’ seven deadly sins (seven

axes of quality )

Page 18: Tracking and improving software quality with SonarQube

How does it work?● Analyzes source code and byte code

● Computes hundreds of metrics

● Associates metrics with analysis snapshots

● Shows the results in dashboards and

widgets accessible by any browser

Page 19: Tracking and improving software quality with SonarQube

SonarQube for everything● Initially developed only for Java projects

● Today supports over twenty languages

Commercial : ABAP, C, C++, Cobol, Natural, PL/SQL, Visual Basic

Open Source : C++, C#, Flex, Groovy, Android, Javascript, PHP, Python, XML,

Web(xhtml, jsp , jsf, )

Page 20: Tracking and improving software quality with SonarQube

For testers / QA staff. Which parts of the system lack unit testing?

… and for everyoneFor developers. Is my code “good”? How can I improve it?

For architects. Is the initial design “broken”? How about complexity?

For managers. Give me the numbers!! Are we going up or down?

Page 21: Tracking and improving software quality with SonarQube

Managing code quality

● Dashboards

● Historical data

● Differential views

● Compare service

● Code reviews

● Action plans

Page 22: Tracking and improving software quality with SonarQube

Managing code quality

DEMO TIME

Page 23: Tracking and improving software quality with SonarQube

The big picture● Track and reduce Technical Debt on an

ongoing basis. (Clean up kitchen every day)

● Engage all developers from project day #1

(Not only mums wash the dishes)

● Get alerted when Technical debt is beyond a

threshold (when someone is leaving the

kitchen in a mess)

Page 24: Tracking and improving software quality with SonarQube

I have a dream…

...that one day code quality management will be as much as important and essential is today source code management

Page 25: Tracking and improving software quality with SonarQube

Thank you

Patroklos Papapetrou @ppapapetrou76 http://www.linkedin.com/in/ppapapetrou