Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Back to the Basics: Principles for Constructing Quality Software


Published on

Using an analogy to the building codes followed by architects and contractors in the construction of buildings, Rick Spiewak explores the fundamental principles for developing and delivering high quality, mission-critical systems. Just as buildings are constructed using different materials and techniques, we use a variety of languages, methodologies, and tools to develop software. Although there is no formal "building code" for software, software projects should consider-and judiciously apply-the recognized "best" practices of static analysis, automated unit testing, code re-use, and peer reviews. Rick takes you on a deep dive into each of these techniques where you'll learn about their advantages, disadvantages, costs, challenges, and more. Learn to recognize when you should apply the practices, gaining an appreciation and understanding of how you can achieve better quality without increasing costs or lengthening the development to delivery cycle time.

Published in: Technology, Business
  • Be the first to comment

Back to the Basics: Principles for Constructing Quality Software

  1. 1.           BW12 Concurrent Session  11/7/2012 3:45 PM              "Back to the Basics: Principles for Constructing Quality Software"       Presented by: Rick Spiewak The MITRE Corporation             Brought to you by:        340 Corporate Way, Suite 300, Orange Park, FL 32073  888‐268‐8770 ∙ 904‐278‐0524 ∙ ∙
  2. 2. Rick Spiewak The MITRE Corporation A lead software systems engineer at The MITRE Corporation, Rick Spiewak works at the Electronic Systems Center at Hanscom Air Force Base as part of the Battle Management Systems Group, concentrating on mission planning. In the computer software industry for more than forty years, Rick has developed software and managed software development for data acquisition systems, transaction processing, data communications, and networking. With a focus on the software quality improvement process, Rick has spoken on this topic at a number of conferences and been published in CrossTalk and MSDN magazines.
  3. 3. Back to the Basics: Principles for Constructing Quality Software 2012 Better Software Conference East 7 November 2012 November, Approved for Public Release; Distribution Unlimited. Case Number: 12-3430 Rick Spiewak The MITRE Corporation © 2012-The MITRE Corporation. All rights reserved. What is Software Quality Management?: An Application of the Basic Principles of Quality Management “Quality is free. It’s not a gift, but it is free. free What costs money are the unquality things – all the actions that involve not doing jobs right the first time.” 1 1 “Quality Is Free: The Art of Making Quality Certain”, Philip B. Crosby. McGraw-Hill Companies (January 1, 1979) 2 1
  4. 4. What is Software Quality Management?: An Application of the Basic Principles of Quality Management “You can’t inspect quality into a product. product ” 2 Harold F. Dodge, as quoted in “Out of the Crisis”, W. Edwards Deming. MIT, 1982 2 3 What is Software Quality Management?: An Application of the Basic Principles of Quality Management “Trying to improve software quality by increasing the amount of testing is like trying to lose weight by weighing yourself more often.” 3 3 “Code Complete 2” Steve McConnell. Microsoft Press 2004 4 2
  5. 5. Back to the Basics ■Define quality: – “Meeting the requirements.” – Not: “Exceeding the customer’s expectations.” ■ Q lit improvement requires changes in processes Quality i t i h i – Fixing problems earlier in the process is more effective and less costly than fixing them later. – The causes of defects must be identified and fixed in the processes – Fixing defects without identifying and fixing the causes does not improve product quality Setting higher standards will help drive better development practices 5 Two Ways to Get Started ■Classical Quality Management: start fresh in identifying and fixing process defects which may be unique to your organization ■Richard Hamming: “How do I obey Newton’s rule? He said, ‘If I have seen further than others, it is because I’ve stood on the shoulders of giants.’ These days we stand on each other’s feet” If we want to profit from the work of pioneers in the field of software quality, we owe it to ourselves and them to stand on their shoulders. 6 3
  6. 6. Phases of Software Development ■Requirements Definition ■Architecture ■Design ■Construction ■Testing ■Documentation ■Training Training ■Deployment ■Sustainment 7 What’s Wrong With Software Construction? ■Historically a “write-only” exercise: If it doesn’t break, no one else reads it ■Ad-hoc or absent standards Ad h b t t d d ■Testing as a separate exercise ■Re-work (patch) to fix defects (“bugs”) ■Features take precedence over quality ■Definition of quality is not rigorous Standards d b t St d d and best practices are not ti t uniformly followed because they are not normally stated as requirements 8 4
  7. 7. What’s Missing in Software Construction? If we built buildings this way…. They i h Th might not stand up d Or, we might not 9 Buildings are not built this way Building construction has standards! Typical Building Code Requirements: ■ Building Heights and Areas ■ Types of Construction ■ Soils and Foundations ■ Fire-Resistance and Fire Protection Systems ■ Means of Egress ■ Accessibility ■ Exterior Walls ■ Roof Assemblies ■ Rooftop Structures ■ Structural Design ■ Materials (Concrete, Steel, Wood, etc.) ■ Electrical, Mechanical, Plumbing…. 10 5
  8. 8. Missing: the “Building Code” for software ■There is a lack of external standards ■Created ad hoc by each organization y g ■No penalty for inadequate standards ■Best practices are often discarded under cost and schedule pressure 11 Shoulders of Giants ■Where do building codes come from? – Not from a blank sheet of paper! ■Starting Point: The International Code Council® – V tt d by local authorities Vetted b l l th iti – May rely on standards developed by various independent standards organizations. ■Example- The Building Code of New York State: “The Building Code of New York State combines language from the 2006 International Building C Code®, and New York modifications developed by f the State Fire Prevention and Building Code Council and its Building Code Technical Subcommittee.” 12 6
  9. 9. A Concrete Example ■Do we send engineers into a warehouse with a tub of concrete? ■Or – S O Standing on the shoulders of giants… f – The American Concrete Institute® ■New York State Building Code: “1903.1 General. Materials used to produce concrete, concrete itself and testing thereof shall comply with the applicable standards listed in ACI 318.” 13 How Do We Apply This to Software? ■Don’t invent our own standards ■Identify industry best practices ■Enforce best practices –Requirements –Rules This is how to make sure our software doesn’t fall down! 14 7
  10. 10. Improving Development Practices: ■ Uniform Coding Standards – References – Tools – Practices ■ Automated Unit Testing – Design for test – Tools for testing – An Enterprise approach ■ Root Cause Analysis and Classification – Analytic methods – Taxonomy Top level categories : • • • • • • • • • • ■ Code Reuse 0xxx Planning 1xxx Requirements and Features 2xxx F 2 Functionality as Implemented ti lit I l t d 3xxx Structural Bugs 4xxx Data 5xxx Implementation 6xxx Integration 7xxx Real-Time and Operating System 8xxx Test Definition or Execution Bugs 9xxx Other – Development techniques – Reliable sources 15 Improving Development Practices: Uniform Coding Standards ■ References – .NET ■ Framework Design Guidelines: Conventions, g , Idioms, and Patterns for Reusable .NET Libraries ■ Practical Guidelines and Best Practices for Microsoft Visual Basic and C# Developers – Java ■ Effective Java Programming ■ The Elements of Java Style Language Guide ■ Tools and Techniques – Static Code Analysis ■ .NET: FxCop, Visual Studio ■ Java: FindBugs, ParaSoft JTest – Code Review (with audit) 16 8
  11. 11. Improving Development Practices: Tools Static Analysis with FxCop for .NET ■ Microsoft developed free tool ■ Equivalent version in Visual Studio ■ Analyzes managed (.NET) code ■ Language independent ■ Applied to compiled code ■ Applies Microsoft best practices ■ Rules also documented in: “Framework Design Guidelines” 17 Improving Development Practices: Coding Standards – Code Review ■Preparation –inspection of code by developer inspection –may uncover defects, inspire changes ■Review by other programmers –sharing of ideas, improved techniques –uncovers defects or poor techniques ■Determining, fixing causes of defects ■Customer audit –provides assurance of execution 18 9
  12. 12. Improving Development Practices: Automated Unit Testing ■Design Impact – Design for Test – Test Driven Development ■Tools and Techniques – .NET ■ NUnit/NCover/NCover ■ Visual Explorer Studio – Java ■ JUnit/Cobertura (etc ) (etc.) ■Enterprise Impact – Uniform Developer Usage – Use by Test Organizations 19 Improving Development Practices: Root Cause Analysis ■ A CMMI 5 practice area – but this should be a requirement regardless of CMMI level. ■Find the cause – “Five Whys” – Kepner-Trego Problem Analysis – IBM: Defect Causal Analysis ■Fix the cause => change the process ■Fix the problem: use the changed process ■How t P H to Preserve K Knowledge? l d ? Top level categories : – Classify Root Causes – Look for patterns – Metrics: Statistics, Pareto Diagrams • • • • • • • • • • 0xxx Planning 1xxx Requirements and Features 2xxx Functionality as Implemented 3xxx Structural Bugs 4xxx Data 5xxx Implementation 6xxx Integration 7xxx Real-Time and Operating System 8xxx Test Definition or Execution Bugs 9xxx Other 20 10
  13. 13. Improving Development Practices: Root Cause Classification ■Beizer Taxonomy – Classification of Root Causes of Software Defects –D Developed by Boris Beizer l db B i B i – Published in “Software Testing Techniques 2nd Edition” – Modified by Otto Vinter – Based on the Dewey Decimal System – Extensible Classification – “A Beizer categorisation can be performed at a rate of 5 minutes per bug” * ■Orthogonal D f t Cl O th l Defect Classification ifi ti ■Defect Causal Analysis * PRIDE report, section 5.1 21 Classifying Root Causes: Beizer* Taxonomy Top level categories : • 0xxx Planning • 1xxx Requirements and Features • 2xxx Functionality as Implemented • 3xxx Structural Bugs • 4xxx Data • 5xxx Implementation • 6xxx Integration • 7xxx Real-Time and Operating System • 8xxx Test Definition or Execution Bugs • 9xxx Other * Boris Beizer, "Software Testing Techniques", Second edition, 1990, ISBN-0-442-20672-0 22 11
  14. 14. Improving Development Practices: Software Reuse for .NET ■Extensibility features in .NET ■Microsoft Patterns and Practices –Enterprise Library ■ Data Access Application Block ■ Logging Application Block ■ Tracing (Core) ■.NET Library Features –Windows Presentation Foundation Windows –Windows Communication Foundation –Windows Workflow –Entity Framework –LINQ 23 Improving Requirements ■Requirements: a key source of defects ■1999 – PRIDE study in Denmark ■Key techniques studied: – User scenario descriptions – Navigational Prototype Usability Testing ■Key results achieved: (Comparison between product versions) – 27% reduction in error reports – 72% reduction in usability issues per new screen – Almost 3 times difference in productivity 24 12
  15. 15. How Much Does It Cost? ? ? ? ? ? ? ? ? ? ? 25 Cost/Benefit Analysis: Automated Unit Testing (AUT) ■Cost and Benefits of Automated Unit Testing ■The situation: – Organizations either use AUT or don’t – No one will stop to compare (if they do, they won’t tell anyone what they found out!) ■The basic cost problem: – To test n lines of code, it takes n to n + 25% lines – Why wouldn’t it cost more to do this? – If there isn’t any more to it, why use this technique? ■The solution: – Use a more complete model – There’s more to cost than lines of code! 26 13
  16. 16. The SEER-SEM1 Modeling tool ■Based on analysis of thousands of projects ■Takes into account a wide variety of factors: – Sizing g – Technology – Staffing – Tool Use – Testing – QA ■Delivers outputs: p – Effort – Duration – Cost – Expected Defects 1SEER® is a trademark of Galorath Incorporated 27 Cost/Benefit Analysis: Technique ■Consider the cost of defects: – Legacy defects to fix – New defects to fix – Defects not yet fixed (legacy and new) ■Model costs using SEER-SEM scenarios – Cost model reflecting added/modified code – Comparison among scenarios with varying development techniques – Schedule Effort for each scenario Schedule, – Probable undetected remaining defects after FQT (Formal Qualification Test) per scenario 28 14
  17. 17. Cost-Benefit Analysis: Example ■The Project: – Three major applications – Two vendor-supplied applications pp pp – Moderate criticality ■The cases: – Baseline: no AUT ■ Nominal team experience (environment, tools, practices) – Introducing AUT ■ Increases automated tool use parameter d development environment experience l t i t i ■ Increases volatility ■D Decreases – Introducing AUT and Added Experience ■ Increases automated tool use parameter and volatility changes are eliminated ■ Experience 29 Cost-Benefit Analysis: Results ■Estimated schedule months ■Estimated effort – Effort months – Effort hours – Effort costs ■Estimate of defect potential – Size – Complexity ■Estimate of delivered defects – Project size – Programming language – Requirements definition formality – Specification level – Test level –… 30 15
  18. 18. Defect Prediction Detail* Baseline Introducing  Difference AUT AUT +  Experience Difference Potential Defects 738 756 2% 668 ‐9% Defects Removed 654 675 3% 600 ‐8% Delivered Defects Defect Removal  Efficiency Hours/Defect  Removed 84 81 ‐4% 68 ‐19% 88.60% 89.30% 36.52 37.41 89.80% 2% 35.3 ‐3% * SEER-SEM Analysis by Karen McRitchie, VP of Development, Galorath Incorporated 31 Cost Model* Baseline Schedule Months Effort Months Hours Base Year Cost Defect Prediction Introducing  Difference AUT AUT +  Difference Experience 17.09 17.41 2% 16.43 ‐4% 157 166 6% 139 ‐11% 23,881 25,250 6% 21,181 ‐11% $2,733,755 $2,890,449 6% $2,424,699 ‐11% 84 81 ‐4% 68 ‐19% * SEER-SEM Analysis by Karen McRitchie, VP of Development, Galorath Incorporated 32 16
  19. 19. Defect Removal – Capers Jones ■ What are the best, proven techniques? ■ Optimal Sequence of Software Defect Removal From: “Software Engineering Best Practices: Lessons from Successful Projects in the Top Companies” McGraw-Hill, 2010. Chapter 9, pp. 618-619 ■ Combining these recommended methods “will achieve cumulative defect removal efficiency levels in excess of 95 percent for every software project and can achieve 99 percent for some projects ” projects.” 33 Pretest Defect Removal 1. Requirements inspection 2. Architecture inspection 3. 3 Design inspection 4. Code inspection 5. Test case inspection 6. Automated static analysis 34 17
  20. 20. Testing Defect Removal 7. Subroutine test 8. Unit test 9. 9 New f function test 10.Security test 11.Performance test 12.Usability test 13.System test 14.Acceptance 14 Acceptance or beta test 35 What Should We Do? ■If you develop software: – Follow general best practices – Add best practices for your technology – Formulate your own guidelines but ■ Stand on the shoulders of giants!! – Enforce your guidelines through reviews ■If you contract for software development – Examine the practices of competitors – Insist on accountability for best practices – Trust, but verify! ■If you acquire software for the government – This is a whole separate topic! See references. 36 18
  21. 21. How to Incorporate Best Practices ■Have/Require a Software Development Plan – Processes and practices – Tools and Techniques to be used – Requirements management – Types and frequency of reviews – Types of tests – Configuration and release management – Well-Defined Deliverables ■Have/Require a Software Test Plan – Development Test – QA Testing – Acceptance Test 37 Summary ■The use of known best practices can improve the quality of software p q y ■Better results can be achieved at the same time as lower costs ■If you want these benefits, you have to require best practices! 38 38 19
  22. 22. Questions 39 39 Selected References ■ Spiewak, Rick and McRitchie, Karen. Using Software Quality Methods to Reduce Cost and Prevent Defects, CrossTalk, Dec 2008. ■ McConnell Steve Code Complete 2 Microsoft Press, 2004 McConnell, Steve. 2. Press 2004. ■ Crosby, Philip B. Quality Is Free: The Art of Making Quality Certain. McGraw-Hill Companies, 1979. ■ Beizer, Boris. Software Testing Techniques. 2nd ed. International Thomson Computer Press, 1990. ■ Jones, Capers. Software Engineering Best Practices: Lessons from Successful Projects in the Top Companies. McGraw-Hill Companies, 2010. ■ Vinter O., S. Lauesen & J. Pries-Heje. A Methodology for Preventing Requirements Issues from Becoming Defects (1999) ■ Spiewak, R. et al. Applying the fundamentals of quality to software acquisition. 2012 IEEE SysCon 40 40 ■ 20