SlideShare ist ein Scribd-Unternehmen logo
1 von 15
CODE QUALITY ASSURANCE

Jan 15, 2013

Bart Blommaerts
bart.blommaerts@hp.com
EMEA NG Java & WEB: HP Belgium

©2010 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without
notice
Agenda
•

Why do we need clean code?

•

What is clean code?

•

How do we write clean code?

•

How do we test clean code?

•

How do we measure clean code?

•

Disclaimer: clean code vs. great code

•

Q&A

2

HP Confidential

Jan 2013
Why do we need clean code?

3

HP Confidential

Jan 2013
Why do we need clean code?
Objectives
– Easy

to read and understand

– Unnecessary
– Maintaining
•

and extending code is easier

First step towards re-use!

– Project
•

code and noise are removed

lifecycle cost will be reduced

Cost of owning a mess ..

“Writing clean code is what you must do in order to call yourself a
professional. There is no reasonable excuse for doing anything less
than your best.”

Robert C. Martin

4

HP Confidential

Jan 2013
What is clean code?
•
•
•
•
•
•

5

HP Confidential

Simple and direct
Human readable
Efficient
No duplications: DRY
Made for the problem
Easy to enhance

Jan 2013
How do we write clean code?
•

SRP: Single responsibility principle
–
–

Stepdown Rule

–

•

Do One Thing

Restrict number of arguments (3 is a lot ..)

Boy Scout Rule
–
–

6

Leave code better than you found it
Don’t comment bad code, rewrite it

HP Confidential

Jan 2013
How do we write clean code?
•

Meaningful, self-explaining names
–
–

•

Purpose of a variable, class, method, ..
Avoid disinformation (eg. lblUserName)

Error Handling
–
–

7

Don’t return null

–

•

Use exceptions rather then return codes
Don’t pass null

Expresses intent

HP Confidential

Jan 2013
How do we test clean code?
•

SRP: Single responsibility principle
–

•

Boy Scout Rule
–

8

Unit test enabler

Add unit tests before refactoring

HP Confidential

Jan 2013
How do we test clean code?
•

Meaningful names
–

•

Understand what to test

Error Handling
–

@Test(expected=CleanCodeException.class)

Fix a bug only once. Write Unit tests when fixing bugs!

9

HP Confidential

Jan 2013
How do we measure clean code?
•

Sonar integration
–

•

http://sonar.elabs.eds.com:9000/

Maven:

<properties>
<sonar.jdbc.url>
jdbc:mysql://sonar.elabs.eds.com:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
</sonar.jdbc.url>
<sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver>
<sonar.jdbc.username>x</sonar.jdbc.username>
<sonar.jdbc.password>x</sonar.jdbc.password>
<sonar.host.url>http://sonar.elabs.eds.com:9000</sonar.host.url>
</properties>

10

HP Confidential

Jan 2013
How do we measure clean code?
•

Ant:

<!-- Sonar properties -->
<property name="sonar.jdbc.url"
value="jdbc:mysql://sonar.elabs.eds.com:3306/sonar?useUnicode=true&amp;characterEncoding=utf8" />
<property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" />
<property name="sonar.jdbc.username" value="x" />
<property name="sonar.jdbc.password" value="x" />
<property name="sonar.host.url" value="http://sonar.elabs.eds.com:9000" />
<!-- Sonar target -->
<target name="sonar" depends="compile">
<sonar:sonar workDir="." key="be.vlaanderen.vip:xfire" version="02.00"
xmlns:sonar="antlib:org.sonar.ant">
<sources>
<path location="${project.dir.src}" />
</sources>
</sonar:sonar>
</target>
<!-- Sonar task -->
<taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml">
<classpath>
<fileset dir="${project.dir.lib}">
<include name="sonar-ant-task-1.0.jar" />
</fileset>
</classpath>
</taskdef>

11

HP Confidential

Jan 2013
How do we measure clean code?
•

12

Demo!

HP Confidential

Jan 2013
Disclaimer: clean code vs. great code
•

Primary goal: making it work

•

SRP
–

–

•

But: no methods with 1 line of code

But: don’t write a huge amount of tiny classes

Boy Scout Rule
–

13

Don’t go overboard

HP Confidential

Jan 2013
Q& A

http://www.osnews.com/comics
14

HP Confidential

Jan 2013
THANKS FOR YOUR ATTENTION

©2010 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without
notice

Weitere ähnliche Inhalte

Was ist angesagt?

It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecGiulio De Donato
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)Peter Kofler
 
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Peter Kofler
 
Javascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsJavascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsChris Powers
 
Coding Dojo - Refactoring Tennis Kata
Coding Dojo - Refactoring Tennis KataCoding Dojo - Refactoring Tennis Kata
Coding Dojo - Refactoring Tennis KataAlin Pandichi
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaPeter Kofler
 
BDD with the Cucumber
BDD with the CucumberBDD with the Cucumber
BDD with the CucumberMücahit Kurt
 
Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Peter Kofler
 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScriptChris Powers
 
How to quickly add a safety net to a legacy codebase
How to quickly add a safety net to a legacy codebaseHow to quickly add a safety net to a legacy codebase
How to quickly add a safety net to a legacy codebaseNelis Boucké
 
Code Retreat Graz, Austria 2013
Code Retreat Graz, Austria 2013Code Retreat Graz, Austria 2013
Code Retreat Graz, Austria 2013Peter Kofler
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Peter Kofler
 
TDD as if You Meant It (2013)
TDD as if You Meant It (2013)TDD as if You Meant It (2013)
TDD as if You Meant It (2013)Peter Kofler
 
Integration of automation framework with ci tools
Integration of automation framework with ci toolsIntegration of automation framework with ci tools
Integration of automation framework with ci toolsvodQA
 
Software Craftsmanship Journeyman Tour (2013)
Software Craftsmanship Journeyman Tour (2013)Software Craftsmanship Journeyman Tour (2013)
Software Craftsmanship Journeyman Tour (2013)Peter Kofler
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Peter Kofler
 

Was ist angesagt? (20)

It's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspecIt's all about behaviour, also in php - phpspec
It's all about behaviour, also in php - phpspec
 
Pair Programming (2015)
Pair Programming (2015)Pair Programming (2015)
Pair Programming (2015)
 
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
Infinum Android Talks #19 - Stop wasting time fixing bugs with TDD by Domagoj...
 
Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)Coding Dojo Object Calisthenics (2016)
Coding Dojo Object Calisthenics (2016)
 
Javascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end DevsJavascript Tests with Jasmine for Front-end Devs
Javascript Tests with Jasmine for Front-end Devs
 
Coding Dojo - Refactoring Tennis Kata
Coding Dojo - Refactoring Tennis KataCoding Dojo - Refactoring Tennis Kata
Coding Dojo - Refactoring Tennis Kata
 
Code Quality for a Fresh Start
Code Quality for a Fresh StartCode Quality for a Fresh Start
Code Quality for a Fresh Start
 
GDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran CanariaGDCR15 in Las Palmas, Gran Canaria
GDCR15 in Las Palmas, Gran Canaria
 
Why I Love Ruby On Rails
Why I Love Ruby On RailsWhy I Love Ruby On Rails
Why I Love Ruby On Rails
 
BDD with the Cucumber
BDD with the CucumberBDD with the Cucumber
BDD with the Cucumber
 
Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)Idiomatic R for Rosetta Code (2013)
Idiomatic R for Rosetta Code (2013)
 
Detangling Your JavaScript
Detangling Your JavaScriptDetangling Your JavaScript
Detangling Your JavaScript
 
TDD with RSpec
TDD with RSpecTDD with RSpec
TDD with RSpec
 
How to quickly add a safety net to a legacy codebase
How to quickly add a safety net to a legacy codebaseHow to quickly add a safety net to a legacy codebase
How to quickly add a safety net to a legacy codebase
 
Code Retreat Graz, Austria 2013
Code Retreat Graz, Austria 2013Code Retreat Graz, Austria 2013
Code Retreat Graz, Austria 2013
 
Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)Brutal Coding Constraints (ITAKE 2017)
Brutal Coding Constraints (ITAKE 2017)
 
TDD as if You Meant It (2013)
TDD as if You Meant It (2013)TDD as if You Meant It (2013)
TDD as if You Meant It (2013)
 
Integration of automation framework with ci tools
Integration of automation framework with ci toolsIntegration of automation framework with ci tools
Integration of automation framework with ci tools
 
Software Craftsmanship Journeyman Tour (2013)
Software Craftsmanship Journeyman Tour (2013)Software Craftsmanship Journeyman Tour (2013)
Software Craftsmanship Journeyman Tour (2013)
 
Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)Coding Dojo: Naming with Dices (2021)
Coding Dojo: Naming with Dices (2021)
 

Ähnlich wie Code Quality Assurance

You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucksPeter Gfader
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Conceptswesovi
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleikram_ahamed
 
Clean Code III - Software Craftsmanship
Clean Code III - Software CraftsmanshipClean Code III - Software Craftsmanship
Clean Code III - Software CraftsmanshipTheo Jungeblut
 
Clean application development (talk)
Clean application development (talk)Clean application development (talk)
Clean application development (talk)Adam Culp
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentShawn Jones
 
Software Quality without Testing
Software Quality without TestingSoftware Quality without Testing
Software Quality without TestingNagarro
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEGavin Pickin
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017Ortus Solutions, Corp
 
Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is moreBen Lau
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1Blue Elephant Consulting
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and AutomationMahesh Salaria
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) reviewIda Aalen
 
Agile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce ApproachAgile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce ApproachAmpersand
 

Ähnlich wie Code Quality Assurance (20)

You cant be agile if your code sucks
You cant be agile if your code sucksYou cant be agile if your code sucks
You cant be agile if your code sucks
 
Software Testing Basic Concepts
Software Testing Basic ConceptsSoftware Testing Basic Concepts
Software Testing Basic Concepts
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
 
Clean Code Pt I
Clean Code Pt IClean Code Pt I
Clean Code Pt I
 
Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD Gateway to Agile: XP and BDD
Gateway to Agile: XP and BDD
 
Clean Code III - Software Craftsmanship
Clean Code III - Software CraftsmanshipClean Code III - Software Craftsmanship
Clean Code III - Software Craftsmanship
 
Tdd!
Tdd!Tdd!
Tdd!
 
Clean application development (talk)
Clean application development (talk)Clean application development (talk)
Clean application development (talk)
 
A Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven DevelopmentA Brief Introduction to Test-Driven Development
A Brief Introduction to Test-Driven Development
 
Software Quality without Testing
Software Quality without TestingSoftware Quality without Testing
Software Quality without Testing
 
Usable Software Design
Usable Software DesignUsable Software Design
Usable Software Design
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLEAN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE
 
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017
AN EXERCISE IN CLEANER CODE - FROM LEGACY TO MAINTAINABLE - CFObjective() 2017
 
Effective TDD - Less is more
Effective TDD - Less is moreEffective TDD - Less is more
Effective TDD - Less is more
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 
Test Driven Development and Automation
Test Driven Development and AutomationTest Driven Development and Automation
Test Driven Development and Automation
 
Tdd
TddTdd
Tdd
 
Software craftsmanship
Software craftsmanshipSoftware craftsmanship
Software craftsmanship
 
What designers can learn from (code) review
What designers can learn from (code) reviewWhat designers can learn from (code) review
What designers can learn from (code) review
 
Agile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce ApproachAgile & Test Driven Development: The Ampersand Commerce Approach
Agile & Test Driven Development: The Ampersand Commerce Approach
 

Mehr von Bart Blommaerts

Cloud-Native Architecture
Cloud-Native ArchitectureCloud-Native Architecture
Cloud-Native ArchitectureBart Blommaerts
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking PermissionBart Blommaerts
 
JavaDay 2017: 10 tips to become an awesome technical lead (v4)
JavaDay 2017: 10 tips to become an awesome technical lead (v4)JavaDay 2017: 10 tips to become an awesome technical lead (v4)
JavaDay 2017: 10 tips to become an awesome technical lead (v4)Bart Blommaerts
 
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)Bart Blommaerts
 
10 tips to become an awesome Technical Lead v2 (Devoxx PL)
10 tips to become an awesome Technical Lead v2 (Devoxx PL)10 tips to become an awesome Technical Lead v2 (Devoxx PL)
10 tips to become an awesome Technical Lead v2 (Devoxx PL)Bart Blommaerts
 
10 tips to become an awesome technical lead
10 tips to become an awesome technical lead10 tips to become an awesome technical lead
10 tips to become an awesome technical leadBart Blommaerts
 
Pragmatic Architecture (SATURN 2017)
Pragmatic Architecture (SATURN 2017)Pragmatic Architecture (SATURN 2017)
Pragmatic Architecture (SATURN 2017)Bart Blommaerts
 
Pragmatic Architecture, Today (v2)
Pragmatic Architecture, Today (v2)Pragmatic Architecture, Today (v2)
Pragmatic Architecture, Today (v2)Bart Blommaerts
 
Serverless as a Collaborative Economy Enabler
Serverless as a Collaborative Economy EnablerServerless as a Collaborative Economy Enabler
Serverless as a Collaborative Economy EnablerBart Blommaerts
 
Pragmatic Architecture, Today.
Pragmatic Architecture, Today.Pragmatic Architecture, Today.
Pragmatic Architecture, Today.Bart Blommaerts
 
The Serverless Cloud @ JAX London 2016
The Serverless Cloud @ JAX London 2016The Serverless Cloud @ JAX London 2016
The Serverless Cloud @ JAX London 2016Bart Blommaerts
 
The Collaborative Economy
The Collaborative EconomyThe Collaborative Economy
The Collaborative EconomyBart Blommaerts
 
JavaOne: Efficiently building and deploying microservices
JavaOne: Efficiently building and deploying microservicesJavaOne: Efficiently building and deploying microservices
JavaOne: Efficiently building and deploying microservicesBart Blommaerts
 
Developing applications for the cloud
Developing applications for the cloudDeveloping applications for the cloud
Developing applications for the cloudBart Blommaerts
 
HP Discover - Developing new applications for the cloud
HP Discover - Developing new applications for the cloudHP Discover - Developing new applications for the cloud
HP Discover - Developing new applications for the cloudBart Blommaerts
 

Mehr von Bart Blommaerts (17)

Cloud-Native Architecture
Cloud-Native ArchitectureCloud-Native Architecture
Cloud-Native Architecture
 
Innovation Without Asking Permission
Innovation Without Asking PermissionInnovation Without Asking Permission
Innovation Without Asking Permission
 
JavaDay 2017: 10 tips to become an awesome technical lead (v4)
JavaDay 2017: 10 tips to become an awesome technical lead (v4)JavaDay 2017: 10 tips to become an awesome technical lead (v4)
JavaDay 2017: 10 tips to become an awesome technical lead (v4)
 
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)
JavaOne 2017: 10 tips to become an awesome Technical Lead (v3)
 
10 tips to become an awesome Technical Lead v2 (Devoxx PL)
10 tips to become an awesome Technical Lead v2 (Devoxx PL)10 tips to become an awesome Technical Lead v2 (Devoxx PL)
10 tips to become an awesome Technical Lead v2 (Devoxx PL)
 
10 tips to become an awesome technical lead
10 tips to become an awesome technical lead10 tips to become an awesome technical lead
10 tips to become an awesome technical lead
 
Pragmatic Architecture (SATURN 2017)
Pragmatic Architecture (SATURN 2017)Pragmatic Architecture (SATURN 2017)
Pragmatic Architecture (SATURN 2017)
 
Pragmatic Architecture, Today (v2)
Pragmatic Architecture, Today (v2)Pragmatic Architecture, Today (v2)
Pragmatic Architecture, Today (v2)
 
Serverless as a Collaborative Economy Enabler
Serverless as a Collaborative Economy EnablerServerless as a Collaborative Economy Enabler
Serverless as a Collaborative Economy Enabler
 
Pragmatic Architecture, Today.
Pragmatic Architecture, Today.Pragmatic Architecture, Today.
Pragmatic Architecture, Today.
 
The Serverless Cloud @ JAX London 2016
The Serverless Cloud @ JAX London 2016The Serverless Cloud @ JAX London 2016
The Serverless Cloud @ JAX London 2016
 
The Collaborative Economy
The Collaborative EconomyThe Collaborative Economy
The Collaborative Economy
 
JavaOne: Efficiently building and deploying microservices
JavaOne: Efficiently building and deploying microservicesJavaOne: Efficiently building and deploying microservices
JavaOne: Efficiently building and deploying microservices
 
e-IB Bouwstenen: Magda
e-IB Bouwstenen: Magdae-IB Bouwstenen: Magda
e-IB Bouwstenen: Magda
 
Developing applications for the cloud
Developing applications for the cloudDeveloping applications for the cloud
Developing applications for the cloud
 
Java security
Java securityJava security
Java security
 
HP Discover - Developing new applications for the cloud
HP Discover - Developing new applications for the cloudHP Discover - Developing new applications for the cloud
HP Discover - Developing new applications for the cloud
 

Kürzlich hochgeladen

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality AssuranceInflectra
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 

Kürzlich hochgeladen (20)

Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance[Webinar] SpiraTest - Setting New Standards in Quality Assurance
[Webinar] SpiraTest - Setting New Standards in Quality Assurance
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 

Code Quality Assurance

  • 1. CODE QUALITY ASSURANCE Jan 15, 2013 Bart Blommaerts bart.blommaerts@hp.com EMEA NG Java & WEB: HP Belgium ©2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice
  • 2. Agenda • Why do we need clean code? • What is clean code? • How do we write clean code? • How do we test clean code? • How do we measure clean code? • Disclaimer: clean code vs. great code • Q&A 2 HP Confidential Jan 2013
  • 3. Why do we need clean code? 3 HP Confidential Jan 2013
  • 4. Why do we need clean code? Objectives – Easy to read and understand – Unnecessary – Maintaining • and extending code is easier First step towards re-use! – Project • code and noise are removed lifecycle cost will be reduced Cost of owning a mess .. “Writing clean code is what you must do in order to call yourself a professional. There is no reasonable excuse for doing anything less than your best.” Robert C. Martin 4 HP Confidential Jan 2013
  • 5. What is clean code? • • • • • • 5 HP Confidential Simple and direct Human readable Efficient No duplications: DRY Made for the problem Easy to enhance Jan 2013
  • 6. How do we write clean code? • SRP: Single responsibility principle – – Stepdown Rule – • Do One Thing Restrict number of arguments (3 is a lot ..) Boy Scout Rule – – 6 Leave code better than you found it Don’t comment bad code, rewrite it HP Confidential Jan 2013
  • 7. How do we write clean code? • Meaningful, self-explaining names – – • Purpose of a variable, class, method, .. Avoid disinformation (eg. lblUserName) Error Handling – – 7 Don’t return null – • Use exceptions rather then return codes Don’t pass null Expresses intent HP Confidential Jan 2013
  • 8. How do we test clean code? • SRP: Single responsibility principle – • Boy Scout Rule – 8 Unit test enabler Add unit tests before refactoring HP Confidential Jan 2013
  • 9. How do we test clean code? • Meaningful names – • Understand what to test Error Handling – @Test(expected=CleanCodeException.class) Fix a bug only once. Write Unit tests when fixing bugs! 9 HP Confidential Jan 2013
  • 10. How do we measure clean code? • Sonar integration – • http://sonar.elabs.eds.com:9000/ Maven: <properties> <sonar.jdbc.url> jdbc:mysql://sonar.elabs.eds.com:3306/sonar?useUnicode=true&amp;characterEncoding=utf8 </sonar.jdbc.url> <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver> <sonar.jdbc.username>x</sonar.jdbc.username> <sonar.jdbc.password>x</sonar.jdbc.password> <sonar.host.url>http://sonar.elabs.eds.com:9000</sonar.host.url> </properties> 10 HP Confidential Jan 2013
  • 11. How do we measure clean code? • Ant: <!-- Sonar properties --> <property name="sonar.jdbc.url" value="jdbc:mysql://sonar.elabs.eds.com:3306/sonar?useUnicode=true&amp;characterEncoding=utf8" /> <property name="sonar.jdbc.driverClassName" value="com.mysql.jdbc.Driver" /> <property name="sonar.jdbc.username" value="x" /> <property name="sonar.jdbc.password" value="x" /> <property name="sonar.host.url" value="http://sonar.elabs.eds.com:9000" /> <!-- Sonar target --> <target name="sonar" depends="compile"> <sonar:sonar workDir="." key="be.vlaanderen.vip:xfire" version="02.00" xmlns:sonar="antlib:org.sonar.ant"> <sources> <path location="${project.dir.src}" /> </sources> </sonar:sonar> </target> <!-- Sonar task --> <taskdef uri="antlib:org.sonar.ant" resource="org/sonar/ant/antlib.xml"> <classpath> <fileset dir="${project.dir.lib}"> <include name="sonar-ant-task-1.0.jar" /> </fileset> </classpath> </taskdef> 11 HP Confidential Jan 2013
  • 12. How do we measure clean code? • 12 Demo! HP Confidential Jan 2013
  • 13. Disclaimer: clean code vs. great code • Primary goal: making it work • SRP – – • But: no methods with 1 line of code But: don’t write a huge amount of tiny classes Boy Scout Rule – 13 Don’t go overboard HP Confidential Jan 2013
  • 15. THANKS FOR YOUR ATTENTION ©2010 Hewlett-Packard Development Company, L.P. The information contained herein is subject to change without notice