SlideShare a Scribd company logo
1 of 32
Download to read offline
7/17/2012




                                                     Writing High Quality Code
                                                             Agile 2012
                            www.ToBeAgile.com
                                                          © Copyright 2009-2012 To Be Agile   DB20120717
                               info@ToBeAgile.com
                       www.techniquesofdesign.com
                       info@techniquesofdesign.com        COPYRIGHT © TECHNIQUES OF DESIGN        DB20111207




                                 Thank you for being here




                                                                                                           2




http://ToBeAgile.com                                                                                                  1
7/17/2012




                       I am David Bernstein




                                                             3




                       Standing on the shoulders of giants




                                                             4




http://ToBeAgile.com                                                    2
7/17/2012




                       What is quality?




                           Service        Products
                                                     ?
                                                     Software




                                                                5




                       What makes software good?




                                                                6




http://ToBeAgile.com                                                       3
7/17/2012




                       Correctness is not enough




                                                   7




                       Remember when?




                                                   8




http://ToBeAgile.com                                          4
7/17/2012




                       Things change




                                             9




                       Dealing with change




                                             10




http://ToBeAgile.com                                     5
7/17/2012




                       What makes code easy to change?




                                                              11




                       What makes code difficult to change?




                                                              12




http://ToBeAgile.com                                                      6
7/17/2012




                       Code pathologies




                                                      13




                       Rigidity – hard to repurpose




                                                      14




http://ToBeAgile.com                                              7
7/17/2012




                       Viscosity – difficult to change




                                                           15




                       Complexity – unsure how to change




                                                           16




http://ToBeAgile.com                                                   8
7/17/2012




                       Opaque – difficult to understand




                                                           17




                       Brittleness – expensive to change




                                                           18




http://ToBeAgile.com                                                   9
7/17/2012




                       Pathologies scare us




                                                        19




                       It’s harder on larger projects




                                                        20




http://ToBeAgile.com                                               10
7/17/2012




                       Quality in software




                                              21




                       6 software qualities




                                              22




http://ToBeAgile.com                                     11
7/17/2012




                       Cohesive




                                               1




                                                   23




                       Language and software




                                                   24




http://ToBeAgile.com                                          12
7/17/2012




                       Class cohesion




                                         25




                       Method cohesion




                                         26




http://ToBeAgile.com                                13
7/17/2012




                       Pathologies of poor cohesion




                                                          27




                       Non-redundant




                                                      2




                                                          28




http://ToBeAgile.com                                                 14
7/17/2012




                       Finding redundancy




                                             29




                       Types of redundancy




                                             30




http://ToBeAgile.com                                    15
7/17/2012




                       Can non-identical code be redundant?




                                                              31




                       Can identical code be non-redundant?




                                                              32




http://ToBeAgile.com                                                     16
7/17/2012




                       Redundant intent




                                                 33




                       Code investment or debt




                                                 34




http://ToBeAgile.com                                        17
7/17/2012




                       Pathologies of redundancy




                                                       35




                       Encapsulated




                                                   3




                                                       36




http://ToBeAgile.com                                              18
7/17/2012




                       What can be encapsulated?




                                                   37




                       What you don’t know…




                                                   38




http://ToBeAgile.com                                          19
7/17/2012




                       …can’t hurt you




                                               39




                       Encapsulate by policy




                                               40




http://ToBeAgile.com                                      20
7/17/2012




                       Optimization




                                                 41




                       Can you encapsulate it?




                                                 42




http://ToBeAgile.com                                        21
7/17/2012




                       Many ways to encapsulate




                                                           43




                       Pathologies of poor encapsulation




                                                           44




http://ToBeAgile.com                                                  22
7/17/2012




                       Assertive




                                                   4




                                                       45




                       Assertive or inquisitive?




                                                       46




http://ToBeAgile.com                                              23
7/17/2012




                       Object therapy




                                                                       47




                       “With great state comes great responsibility”




                                                                       48




http://ToBeAgile.com                                                              24
7/17/2012




                       Winston Churchill, Spiderman’s Uncle




                                                              49




                       Pathologies of inquisitiveness




                                                              50




http://ToBeAgile.com                                                     25
7/17/2012




                       Testable




                                                   5




                                                       51




                       Testability guides design




                                                       52




http://ToBeAgile.com                                              26
7/17/2012




                       Pathologies of poor testability




                                                             53




                       Explicit




                                                         6




                                                             54




http://ToBeAgile.com                                                    27
7/17/2012




                       Good and bad coupling




                                               55




                       Bad coupling




                                               56




http://ToBeAgile.com                                      28
7/17/2012




                       Coupling


                           Type

                           Interface

                           Abstract

                           Concrete




                                                                       57




                       Coupling example


                                                 Abstract Coupling



                             Type Coupling
                           Interface Coupling




                                                No Concrete Coupling



                                                                       58




http://ToBeAgile.com                                                              29
7/17/2012




                       Pathologies of bad coupling




                                                     59




                       The six code qualities…




                                                     60




http://ToBeAgile.com                                            30
7/17/2012




                        – Cohesive
                        – non-Redundant
                        – Encapsulated
                        – Assertive
                        – Testable
                        – Explicit




                                          61




                       …spells CREATE




                                          62




http://ToBeAgile.com                                 31
7/17/2012




                       Code qualities guide us




                                                                                          63




                       Thank You!

                          We have just scratched the surface, to learn more:
                           – Read my blog: http://ToBeAgile.com/blog
                           – Follow me on Twitter (@ToBeAgile)
                           – Attend my one of my Certified Scrum Developer trainings
                          Public Certified Scrum Developer Essentials classes:
                           – October 15 – 19, 2012 in Redwood City, CA
                          Public Agile Software Developer Essentials classes:
                           – December 10 – 14, 2012 Online (8:00 am-12:00 pm PT)
                          Private classes available for groups of 8 or more developers
                           – Learn more at http://ToBeAgile.com


                                                                                          64




http://ToBeAgile.com                                                                                 32

More Related Content

More from drewz lin

Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
drewz lin
 
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013
drewz lin
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13
drewz lin
 
Owasp2013 johannesullrich
Owasp2013 johannesullrichOwasp2013 johannesullrich
Owasp2013 johannesullrich
drewz lin
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
drewz lin
 
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2
drewz lin
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
drewz lin
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
drewz lin
 
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
drewz lin
 
Appsec usa roberthansen
Appsec usa roberthansenAppsec usa roberthansen
Appsec usa roberthansen
drewz lin
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
drewz lin
 
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_editsAppsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_edits
drewz lin
 
Appsec2013 presentation
Appsec2013 presentationAppsec2013 presentation
Appsec2013 presentation
drewz lin
 
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitationsAppsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
drewz lin
 
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martinAppsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martin
drewz lin
 
Amol scadaowasp
Amol scadaowaspAmol scadaowasp
Amol scadaowasp
drewz lin
 
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usaAgile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usa
drewz lin
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013
drewz lin
 
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架
drewz lin
 
新浪微博稳定性经验谈
新浪微博稳定性经验谈新浪微博稳定性经验谈
新浪微博稳定性经验谈
drewz lin
 

More from drewz lin (20)

Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-kearyWeb security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
 
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013
 
Phu appsec13
Phu appsec13Phu appsec13
Phu appsec13
 
Owasp2013 johannesullrich
Owasp2013 johannesullrichOwasp2013 johannesullrich
Owasp2013 johannesullrich
 
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
 
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2
 
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolfDefeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
 
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equalCsrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
 
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
 
Appsec usa roberthansen
Appsec usa roberthansenAppsec usa roberthansen
Appsec usa roberthansen
 
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaolaAppsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
 
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_editsAppsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_edits
 
Appsec2013 presentation
Appsec2013 presentationAppsec2013 presentation
Appsec2013 presentation
 
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitationsAppsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
 
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martinAppsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martin
 
Amol scadaowasp
Amol scadaowaspAmol scadaowasp
Amol scadaowasp
 
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usaAgile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usa
 
Vulnex app secusa2013
Vulnex app secusa2013Vulnex app secusa2013
Vulnex app secusa2013
 
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架
 
新浪微博稳定性经验谈
新浪微博稳定性经验谈新浪微博稳定性经验谈
新浪微博稳定性经验谈
 

Writing high quality code for agile2012

  • 1. 7/17/2012 Writing High Quality Code Agile 2012 www.ToBeAgile.com © Copyright 2009-2012 To Be Agile DB20120717 info@ToBeAgile.com www.techniquesofdesign.com info@techniquesofdesign.com COPYRIGHT © TECHNIQUES OF DESIGN DB20111207 Thank you for being here 2 http://ToBeAgile.com 1
  • 2. 7/17/2012 I am David Bernstein 3 Standing on the shoulders of giants 4 http://ToBeAgile.com 2
  • 3. 7/17/2012 What is quality? Service Products ? Software 5 What makes software good? 6 http://ToBeAgile.com 3
  • 4. 7/17/2012 Correctness is not enough 7 Remember when? 8 http://ToBeAgile.com 4
  • 5. 7/17/2012 Things change 9 Dealing with change 10 http://ToBeAgile.com 5
  • 6. 7/17/2012 What makes code easy to change? 11 What makes code difficult to change? 12 http://ToBeAgile.com 6
  • 7. 7/17/2012 Code pathologies 13 Rigidity – hard to repurpose 14 http://ToBeAgile.com 7
  • 8. 7/17/2012 Viscosity – difficult to change 15 Complexity – unsure how to change 16 http://ToBeAgile.com 8
  • 9. 7/17/2012 Opaque – difficult to understand 17 Brittleness – expensive to change 18 http://ToBeAgile.com 9
  • 10. 7/17/2012 Pathologies scare us 19 It’s harder on larger projects 20 http://ToBeAgile.com 10
  • 11. 7/17/2012 Quality in software 21 6 software qualities 22 http://ToBeAgile.com 11
  • 12. 7/17/2012 Cohesive 1 23 Language and software 24 http://ToBeAgile.com 12
  • 13. 7/17/2012 Class cohesion 25 Method cohesion 26 http://ToBeAgile.com 13
  • 14. 7/17/2012 Pathologies of poor cohesion 27 Non-redundant 2 28 http://ToBeAgile.com 14
  • 15. 7/17/2012 Finding redundancy 29 Types of redundancy 30 http://ToBeAgile.com 15
  • 16. 7/17/2012 Can non-identical code be redundant? 31 Can identical code be non-redundant? 32 http://ToBeAgile.com 16
  • 17. 7/17/2012 Redundant intent 33 Code investment or debt 34 http://ToBeAgile.com 17
  • 18. 7/17/2012 Pathologies of redundancy 35 Encapsulated 3 36 http://ToBeAgile.com 18
  • 19. 7/17/2012 What can be encapsulated? 37 What you don’t know… 38 http://ToBeAgile.com 19
  • 20. 7/17/2012 …can’t hurt you 39 Encapsulate by policy 40 http://ToBeAgile.com 20
  • 21. 7/17/2012 Optimization 41 Can you encapsulate it? 42 http://ToBeAgile.com 21
  • 22. 7/17/2012 Many ways to encapsulate 43 Pathologies of poor encapsulation 44 http://ToBeAgile.com 22
  • 23. 7/17/2012 Assertive 4 45 Assertive or inquisitive? 46 http://ToBeAgile.com 23
  • 24. 7/17/2012 Object therapy 47 “With great state comes great responsibility” 48 http://ToBeAgile.com 24
  • 25. 7/17/2012 Winston Churchill, Spiderman’s Uncle 49 Pathologies of inquisitiveness 50 http://ToBeAgile.com 25
  • 26. 7/17/2012 Testable 5 51 Testability guides design 52 http://ToBeAgile.com 26
  • 27. 7/17/2012 Pathologies of poor testability 53 Explicit 6 54 http://ToBeAgile.com 27
  • 28. 7/17/2012 Good and bad coupling 55 Bad coupling 56 http://ToBeAgile.com 28
  • 29. 7/17/2012 Coupling  Type  Interface  Abstract  Concrete 57 Coupling example Abstract Coupling Type Coupling Interface Coupling No Concrete Coupling 58 http://ToBeAgile.com 29
  • 30. 7/17/2012 Pathologies of bad coupling 59 The six code qualities… 60 http://ToBeAgile.com 30
  • 31. 7/17/2012 – Cohesive – non-Redundant – Encapsulated – Assertive – Testable – Explicit 61 …spells CREATE 62 http://ToBeAgile.com 31
  • 32. 7/17/2012 Code qualities guide us 63 Thank You!  We have just scratched the surface, to learn more: – Read my blog: http://ToBeAgile.com/blog – Follow me on Twitter (@ToBeAgile) – Attend my one of my Certified Scrum Developer trainings  Public Certified Scrum Developer Essentials classes: – October 15 – 19, 2012 in Redwood City, CA  Public Agile Software Developer Essentials classes: – December 10 – 14, 2012 Online (8:00 am-12:00 pm PT)  Private classes available for groups of 8 or more developers – Learn more at http://ToBeAgile.com 64 http://ToBeAgile.com 32