Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer...
Transcript of Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer...
![Page 1: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/1.jpg)
Code Quality Assurance
Peter Kofler, ‘Code Cop’
FH Technikum Wien, Dec. 2010
![Page 2: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/2.jpg)
![Page 3: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/3.jpg)
Peter Kofler
• Ph.D. (Appl. Math.)
• Professional SoftwareDeveloper for 11 years
• Lead Developer at System One
• “fanatic about code quality”
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 4: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/4.jpg)
![Page 5: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/5.jpg)
Zero-Defect Mindset(MSF)
![Page 6: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/6.jpg)
![Page 7: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/7.jpg)
![Page 8: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/8.jpg)
![Page 9: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/9.jpg)
Robert C. Martin(“Uncle Bob”)
![Page 10: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/10.jpg)
![Page 11: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/11.jpg)
SoftwareCraftsmanship
![Page 12: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/12.jpg)
Craftsmanship
Engineering
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 13: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/13.jpg)
CraftsmanshipOver Crap
![Page 14: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/14.jpg)
Mindset
![Page 15: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/15.jpg)
The Prime FactorsKata
![Page 16: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/16.jpg)
The Requirements.
• Write a class named “PrimeFactors”that has one static method: generate.
–The generate method takes an integerargument and returns a List<Integer>.
–That list contains the prime factors innumerical sequence.
http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 17: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/17.jpg)
Demo
![Page 18: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/18.jpg)
Keep the bar green to keep the code clean
![Page 19: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/19.jpg)
Unit Testing
• test individual units
• isolate each part
• show that the individual parts are
correct
• regression testing
• sort of living documentation
• executed within a frameworkhttp://en.wikipedia.org/wiki/Unit_testing
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 20: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/20.jpg)
xUnit Frameworks
• e.g.
• Smalltalk - SUnit
• Java - JUnit, TestNG
• .NET - NUnit, Typemock
• C++ - CppUTest
• Groovy, PHP, Python, Ruby, Scala, etc.http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 21: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/21.jpg)
TESTINGI FIND YOUR LACK OF TESTS DISTURBING.
![Page 22: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/22.jpg)
Test-Driven Development
• add a test
• run all tests and see if the new one fails
• write some code
• run all tests and see them succeed
• refactor code
• „Red Green Refactor“http://en.wikipedia.org/wiki/Test_Driven_Development
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 23: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/23.jpg)
A minute ago alltheir code worked
![Page 24: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/24.jpg)
![Page 25: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/25.jpg)
Testing isa mindset
![Page 26: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/26.jpg)
Youhave to want it
![Page 27: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/27.jpg)
![Page 28: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/28.jpg)
Code Coverage
comprehensiveness of tests
![Page 29: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/29.jpg)
Beware!
comprehensiveness ≠ quality!
![Page 30: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/30.jpg)
Some Code Coverage Tools
• Java - EMMA, Cobertura, Clover
• .NET - NCover, PartCover
• C++ - Covtool, gcov
• Ruby - rcov
• commercial products
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 31: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/31.jpg)
Demo
![Page 32: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/32.jpg)
Demo
![Page 33: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/33.jpg)
![Page 34: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/34.jpg)
Daily BuildsNightly Builds
![Page 35: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/35.jpg)
ContinuousIntegration
![Page 36: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/36.jpg)
Continuous Integration
• Maintain a code repository
• Automate the build
• Make the build self-testing
• Everyone commits every day
• Every commit should be built
• Keep the build fast
• Everyone can see the results of the buildhttp://en.wikipedia.org/wiki/Continuous_integration
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 37: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/37.jpg)
Immediate Feedbackand
Early Warning
![Page 38: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/38.jpg)
![Page 39: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/39.jpg)
Some CI Servers
• Java - CruiseControl, Hudson
• .NET - CruiseControl.NET, Hudson
• C++ - Hudson (Shell/Make)
• Ruby - CruiseControl.rb
• commercial products - TeamCity, ALA
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 40: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/40.jpg)
![Page 41: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/41.jpg)
Good Enough?
![Page 42: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/42.jpg)
Demo
![Page 43: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/43.jpg)
![Page 44: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/44.jpg)
Check What?
• Lexical analysis–naming, coding conventions, design idioms
• Flow/path analysis–null-pointer, dead code (conditional)
• Dependency analysis–architectural/design flaws
• Verification–mathematical proof of correctness
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 45: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/45.jpg)
Some Static Analysis Tools
• Java - Checkstyle, Findbugs, PMD
• .NET - FxCop, (ReSharper, NDepend)
• C++ - (Sp)Lint
• Ruby - Roodi, Dust, Flog, Saikuro
• commercial products
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 46: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/46.jpg)
Good Enough?
![Page 47: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/47.jpg)
ThankYou
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 48: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/48.jpg)
www.code-cop.org
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 49: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/49.jpg)
Links #1
Mindset
• http://codebetter.com/blogs/darrell.norton/archive/2003/12/03/4222.aspx (Zero-Defect Mindset)
• http://www.sqnz.org.nz/documents/ShipHappens/Software%20Quality%20Group%20Presentation_frame.htm (Zero-Defect Mindset)
• http://en.wikipedia.org/wiki/Fixing_Broken_Windows
• http://pragprog.com/the-pragmatic-programmer
• http://en.wikipedia.org/wiki/Robert_Cecil_Martin
• http://www.clean-code-developer.de/
• http://en.wikipedia.org/wiki/Software_craftsmanship
Kata
• http://butunclebob.com/ArticleS.UncleBob.ThePrimeFactorsKata
• http://en.wikipedia.org/wiki/Kata_(programming)
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 50: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/50.jpg)
Links #2
Test
• http://en.wikipedia.org/wiki/Unit_testing
• http://en.wikipedia.org/wiki/XUnit
• http://en.wikipedia.org/wiki/List_of_unit_testing_frameworks
• http://en.wikipedia.org/wiki/Test_Driven_Development
Code Coverage
• http://en.wikipedia.org/wiki/Code_coverage
• http://www.ibm.com/developerworks/java/library/j-cq01316/
Continuous Integration
• http://hudson-ci.org/
• http://www.codinghorror.com/blog/archives/000818.html
• http://www.stevemcconnell.com/ieeesoftware/bp04.htm
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 51: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/51.jpg)
Links #3
Continuous Integration
• http://www.joelonsoftware.com/articles/fog0000000023.html
• http://en.wikipedia.org/wiki/Continuous_integration
Static Code Analysis
• http://en.wikipedia.org/wiki/Static_code_analysis
• http://en.wikipedia.org/wiki/List_of_tools_for_static_code_analysis
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY
![Page 52: Code Quality Assurance · Peter Kofler •Ph.D. (Appl. Math.) •Professional Software Developer for 11 years •Lead Developer at System One •“fanatic about code quality”](https://reader035.fdocuments.in/reader035/viewer/2022070907/5f7af443e44b15494e7571ef/html5/thumbnails/52.jpg)
CC Images
• spray face: http://www.flickr.com/photos/iangallagher/4115047191/
• broken egg: http://www.flickr.com/photos/nickwheeleroz/2475011402/
• broken windows: http://www.flickr.com/photos/sketchglass/4281424410/
• shoe maker: http://www.flickr.com/photos/tbatty/1450209613/
• shoe factory: http://www.flickr.com/photos/94693506@N00/4643248587/
• red-green: http://www.flickr.com/photos/30830597@N08/3630649274/
• Darth Vader: http://rubystammtisch.at/
• covered car: http://www.flickr.com/photos/paulk/3166328163/
• works: http://www.codinghorror.com/blog/archives/000818.html
• Agnes: http://www.youbrokethebuild.com/
• microscope: http://www.flickr.com/photos/gonzales2010/8632116/
• questions: http://www.flickr.com/photos/seandreilinger/2326448445/
PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY