Continuous Inspection Fight back the 7 deadly sins of the developer - - PowerPoint PPT Presentation

continuous inspection
SMART_READER_LITE
LIVE PREVIEW

Continuous Inspection Fight back the 7 deadly sins of the developer - - PowerPoint PPT Presentation

JUG Switzerland Continuous Inspection Fight back the 7 deadly sins of the developer ! Olivier Gaudin olivier.gaudin@sonarsource.com @gaudol Back in old times The genius The super hero Au fin fond de l'Univers, des annes et des


slide-1
SLIDE 1

Continuous Inspection

Fight back the 7 deadly sins

  • f the developer !

Olivier Gaudin

  • livier.gaudin@sonarsource.com

@gaudol

JUG Switzerland

slide-2
SLIDE 2

Back in old times

slide-3
SLIDE 3

The genius

slide-4
SLIDE 4

The super hero

Au fin fond de l'Univers, à des années et des années-lumière de la Terre, Veille celui que le gouvernement intersidéral appelle quand il n'est plus Capable de trouver une solution à ses problèmes, quand il ne reste plus Aucun espoir : le Capitaine FLAM !

slide-5
SLIDE 5

This is my toy

slide-6
SLIDE 6

Fear of changes

slide-7
SLIDE 7

Industrialisation has entered the game...

 Project under version control  Project under continuous

integration

 Technical and functional

traceability

slide-8
SLIDE 8

What is the mission of today's developer ?

?

slide-9
SLIDE 9

Sustainable development

slide-10
SLIDE 10

(Almost) Everything is maintenance !

Creation of an application

Maintenance

  • f an application
slide-11
SLIDE 11

Nothing is more important than code

But source code is nothing alone

slide-12
SLIDE 12

Old times are over

slide-13
SLIDE 13

Developing for others

slide-14
SLIDE 14

Methodology

slide-15
SLIDE 15

Transparency

slide-16
SLIDE 16

Software factories evolve

Makefile SCM Issue Tracker Continuous Integration IDE Refactoring VI / Emacs Unit Tests Continuous Inspection

slide-17
SLIDE 17

Pushed by requirements

Configuration Manager

 No change should be authorized to production

system without being in configuration manager

 The complete version of an application should

be found easily in the source control manager

slide-18
SLIDE 18

Pushed by requirements

Continuous Integration

 Projects in SCM can be built by anybody at any

time

 Executing unit tests is part of the build process  The output of a build is an artifact “ready to

be used”

 If one of those requirements is not fulfilled,

nothing is more important than fixing it

slide-19
SLIDE 19

Pushed by requirements

Continuous Inspection

 Any new code should ship with corresponding

unit tests

 No new method should exceed a pre-defined

level of complexity

 No cycle between packages should be

introduced

 ...

slide-20
SLIDE 20

BUT ...

 Insuring technical traceability

Configuration Manager

 Insuring functional traceability

Issue Manager

 Insuring build stability

Continuous Integration

 Insuring source code quality

Continuous Inspection (Sonar)

Maturity steps should be followed

slide-21
SLIDE 21

Quality versus Productivity

Extract from xprogramming.com

slide-22
SLIDE 22

The end does not justify the means

Doing the right software Doing the software right

slide-23
SLIDE 23

What is quality?

« A well-written program is a program where the cost of implementing a feature is constant throughout the program's lifetime. »

Itay Maman

slide-24
SLIDE 24

How to measure quality ?

slide-25
SLIDE 25

The technical debt

slide-26
SLIDE 26

The various types of Debt

Extract from http://martinfowler.com/bliki/TechnicalDebtQuadrant.html

slide-27
SLIDE 27

The 7 deadly sins

  • f the developer

Sins Technical Debt

slide-28
SLIDE 28

The 7 deadly sins ?

Applied to source code

 ?  ?  ?  ?  ?  ?  ?

slide-29
SLIDE 29

 Duplications  Bad distribution of complexity  Spaghetti Design  Lack of unit tests  No coding standards  Potential bugs  Not enough or too many comments

The 7 deadly sins ?

Applied to source code

slide-30
SLIDE 30

To get back on track

slide-31
SLIDE 31

Once and only once (Kent Beck)

Duplicated code is an opportunity to raise the level of abstraction and improve the design

slide-32
SLIDE 32

Bad distribution of complexity

 Do you choose :

 1 method with complexity of 30  10 methods with complexity of 3

slide-33
SLIDE 33

Architecture layers

Cycles are plain as the nose on one's face

slide-34
SLIDE 34

Insufficient unit tests

 Thank you for

adding a new case without regression...

slide-35
SLIDE 35

Coding standards

slide-36
SLIDE 36

Potential bugs

if (listeners == null) listeners.remove(listener); Sun java : JDK1.6.0, b105, sun.awt.x11.XMSelection lines 243-244

slide-37
SLIDE 37

A comment must be useful

Or not exist

 To reinforce the logic  To add some dynamics  Anti-patterns

slide-38
SLIDE 38

The mission of Sonar

Declare open the hunt of the developer's 7 deadly sins

slide-39
SLIDE 39

The mission of Sonar

Augment everybody's capability to reduce, reuse and recycle source code

More seriously

slide-40
SLIDE 40

The heart of Sonar

Code source

Java, Cobol, VB, PL/SQL, Flex, C, ...

Code source

Java, Cobol, VB, PL/SQL, Flex, C, ...

Sonar Runner Sonar Runner

Checkstyle

Squid

Jacoco PMD / CPD

Sonar DB Sonar web interface Sonar web interface 1 2 3

1- 2- http://sonar

4

Findbugs

Sonar Eclipse Sonar Eclipse

JUnit

mvn sonar:sonar

  • r

ant sonar

  • r

sonar-runner

5

slide-41
SLIDE 41

Sonar in numbers

X?,000 running instances 5,000

downloads per month (from 2000 in 2009)

1000+

subscribers to mailing lists

15

releases in 2 years

50+

extensions in the forge

slide-42
SLIDE 42

Demo

slide-43
SLIDE 43

Sonar is only a tool !

 What should happen in case new defects are

added ?

 How, when and who should make quality

standards evolve ?

 How to train new joiners ?  Any measure reported must be analysed

slide-44
SLIDE 44

The « Done, Done, Done, Done »

 Developed  Tested  Approved by the « Product

Owner »

 Technical debt under control

slide-45
SLIDE 45

Roadmap 2011

C# Track changes Expand rules and metrics Code Review Developer Activity Sonar-cpd Bridge Internal / External Quality Sonar IDE

slide-46
SLIDE 46

Questions & Answers

Thank You !

http://www.sonarsource.org http://www.sonarsource.com