Your SlideShare is downloading. ×
Clean Code for Bay.NET User Group (2011-03-02)
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Clean Code for Bay.NET User Group (2011-03-02)


Published on

Bay.NET User Group South Bay Chapter presentation on Clean Code principles and best practices from March 3rd 2010.

Bay.NET User Group South Bay Chapter presentation on Clean Code principles and best practices from March 3rd 2010.

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. South Bay Clean CodeWhy Clean Code matters Mountain View, March 2nd 2011
  • 2. Theo Jungeblut• Senior Software Developer at Omnicell Inc. in Mountain View• Has been designing and implementing .NET based applications , components and frameworks for 8 years• Previously worked in factory automation with focus on component based software and framework development for 3 ½ years• Degree in Software Engineering and Network Communications
  • 3. Overview• Why Clean Code• Tools • Resharper • FxCop, StyleCop & StyleCop plugin for Resharper • GhostDoc & Spell Checker • Code Contracts, Pex & Moles• Clean Code Developer Initiative• Principles and Practices• Code Comparison• Q&A
  • 4. Does writing Clean Codemake us more efficient?
  • 5. What is Clean Code?
  • 6.
  • 7.
  • 8.
  • 9. .NET Tools and their ImpactTool name Positive Impact Negative ImpactResharper compiling -- -- -- VS responsiveness --FxCop code quality +++ compiling +StyleCop code quality compiling +StyleCop plugin compiling --- VS responsiveness --for ResharperGhost Doc automated docs potentially worse docSpell Checker fewer spelling errors performance --Code Contracts testability, quality +++ compiling ++Pex & Moles automated test limited
  • 10. Resharper“The single most impacting development addition to Visual Studio” Features: – Code Analysis – Code Templates – Code Generation – Code Cleanup – Many, many more…
  • 11. FxCop / Code AnalysisStatic Code Analysis: – Correctness – Library design – Internationalization and localization – Naming conventions – Performance – Security
  • 12. • Design-by-Contract programming• Improved testability• Static verification• API documentation
  • 13. Method OverviewCode Contracts User Manual, 5.3 Contract Ordering, page 22
  • 14. Runtime Checking LevelsCode Contracts User Manual, 6.2.1 Runtime Checking Level, page 24
  • 15. Argument ValidationCode Contracts User Manual,5.1 Argument Validation andContracts, page 18
  • 16. Microsoft Pex & Moles• Pex automatically generates test suites with high code coverage.• Moles allows to replace any .NET method with a delegate.
  • 17. Ghost Doc• Save keystrokes and time• Simplify documenting your code• Benefit of the base class documentation
  • 18. Spell Checker • Spelll chicking for texts and comments in VS
  • 19. Graphic by Michael Hönnig
  • 20. Keep it simple, stupid (KISS)
  • 21. Graphic by Nathan Sawaya courtesy of
  • 22. Don’t repeat yourself (DRY)
  • 23. Separation of Concerns (SoC)Single Responsibility Principle (SRP)
  • 24. Component-Oriented Programming (CoP)
  • 25. Dependency Inversion Principle (DIP)
  • 26. S Single Responsibility Principle O Open/Closed Principle L Liskov Substitution Principle I Interface Segregation Principle D Dependency Inversion PrincipleRobert C Martin:
  • 27. Source Code Conventions
  • 28. Let’s switch to the code
  • 29. Summary Clean CodeBeing more efficient through:• Simplification and Specialization (KISS, SoC, SRP)• Decoupling (Contracts, CoP, IoC or SOA)• Avoiding Code Blow (DRY, YAGNI)• Quality through Testability (all of them!)
  • 30. Q&AGraphic by Nathan Sawaya courtesy of
  • 31. ReferencesResharper / Code Analysis Contracts & Mole Plugin for Resharper Lego (trademarked in capitals as LEGO)
  • 32. for slides & code examples