Presentation is loading. Please wait.

Presentation is loading. Please wait.

Clean Code and How to Achieve Zero Defects Jason Jolley Director, Application Development Micro Strategies, Inc.

Similar presentations


Presentation on theme: "Clean Code and How to Achieve Zero Defects Jason Jolley Director, Application Development Micro Strategies, Inc."— Presentation transcript:

1 Clean Code and How to Achieve Zero Defects Jason Jolley Director, Application Development Micro Strategies, Inc.

2 Achieving Zero Defects Is it possible?

3 Achieving Zero Defects Why is this so important?

4 What is Clean Code? Clean code is simple and direct. Clean code reads like well-written prose. -Grady Booch

5 Clean Code Basics Clear & Consistent Naming Avoid using Comments Keep functions less than 10 lines

6 Four Simple Rules Pass All Tests Clear, Expressive, & Consistent Duplicates No Behavior Or Configuration Minimal Methods, Classes, & Modules -Kent Beck

7 Test Driven Development Red Green Refactor

8 Test Driven Development Red Green Refactor

9 Test Driven Development You should have > 80% Coverage. If you don’t have at least 80%, try harder.

10 Code of Conduct 1.Only Ship Quality Software 2.Stable Productivity 3.Inexpensive Adaptability 4.Continuous Improvement 5.Fearless Competence 6.Extreme Quality

11 Code of Conduct 7.QA Will Find Nothing! 8.Automation 9.Honest Estimates 10.Say No When We Can't Commit 11.Continuous Aggressive Learning 12.Mentor Each Other 13.Not Be A Knowledge Silo

12 Accountability & Code Analysis Code Analysis can detect problem areas Continuous Integration and Code Analysis together provide an automated process to gain code metrics. Facilitates peer review

13 Project Code Analysis

14 Cyclomatic Complexity The count of the number of linearly independent paths through the source code M = E − N + 2P E=the number of edges of the graph N=the number of nodes of the graph P=the number of connected components *Source: Wikipedia

15 Cyclomatic Complexity AKA: The canary in the coal mine Any function with a complexity greater than 8 should be re-evaluated.

16 SOLID Principles The S ingle Responsibility Principle A class should have one, and only one, reason to change. The O pen Closed Principle You should be able to extend a classes behavior, without modifying it. The L iskov Substitution Principle Derived classes must be substitutable for their base classes. The I nterface Segregation Principle Make fine grained interfaces that are client specific. The D ependency Inversion Principle Depend on abstractions, not on concretions. http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod

17 Customizing Alfresco ActionExecutor classes Web Scripts Task Listeners Custom Service Classes

18 Customizing Alfresco ActionExecutor classes Web Scripts Task Listeners Custom Service Classes

19 Maintain Metrics Estimates to Actuals Coverage Complexity Violations Bugs Logged

20 The Big Picture Evangelize An Ethos of Craftsmanship and Accountability

21 In Summary The only way to go fast, is to go well. -Uncle Bob Martin

22 Resources Related Blog Posts http://www.jasonjolley.com http://www.jasonjolley.com


Download ppt "Clean Code and How to Achieve Zero Defects Jason Jolley Director, Application Development Micro Strategies, Inc."

Similar presentations


Ads by Google