Software In Practice


Published on

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

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Software In Practice

    1. 1. Software in Practice a series of four lectures on why software projects fail, and what you can do about it Martyn Thomas Founder: Praxis High Integrity Systems Ltd Visiting Professor of Software Engineering, Oxford University Computing Laboratory
    2. 2. Lecture 4: Principles of Software Engineering <ul><li>Dependability </li></ul><ul><li>Theory and Practice: the 30-year gap </li></ul><ul><li>What we Know </li></ul><ul><li>Strong Software Engineering </li></ul>
    3. 3. Software Dependability: our highest priority problem <ul><li>Dependability: umbrella term for safety, reliability, security, trustworthiness, availability … </li></ul><ul><li>A dependable system is one known to have all its required properties . </li></ul><ul><li>We need dependable processes as well as dependable systems … </li></ul><ul><li>… to build systems on time and budget, and to be able to rely on what we deliver. </li></ul>
    4. 4. World dependability initiatives -evidence that dependability is now high priority <ul><li>Microsoft: </li></ul><ul><ul><li>trustworthiness initiative (11000 engineers); </li></ul></ul><ul><ul><li>Palladium/Longhorn/ N ext G eneration S ecure C omputing B ase. </li></ul></ul><ul><li>Trusted Computing Platform Alliance </li></ul><ul><li>Intel’s LaGrande technology </li></ul><ul><li>IBM’s Autonomic Computing initiative </li></ul><ul><li>Critical Infrastructure Protection initiatives </li></ul><ul><li>Dependable Systems Evolution identified as a computer science Grand Challenge </li></ul><ul><li>DIRC </li></ul>
    5. 5. In a 50 year old discipline, there is a 30-year gap between theory and practice! <ul><li>“ A study of program structure has revealed that programs—even alternative programs for the same task—can differ tremendously in their intellectual manageability. A number of rules have been discovered, violation of which will either seriously impair or totally destroy the intellectual manageability of the program.” Dijkstra, 1972 </li></ul>
    6. 6. Theory and Practice <ul><li>Theory </li></ul><ul><li>The inherent difficulty of software design has been well understood for more than 30 years, and the problems and solutions have been taught to a generation of graduates. </li></ul><ul><li>Practice </li></ul><ul><li>The insight has been largely ignored by industry “not because it has been tried and failed, but because it has been considered hard, and not tried.” after G. K. Chesterton </li></ul>
    7. 7. Practice in Industry <ul><li>Despite much progress in software development: </li></ul><ul><li>most software development staff have: </li></ul><ul><ul><li>little formal education in software engineering </li></ul></ul><ul><ul><li>no good grounding in either the processes or the theories that underpin their professional work. </li></ul></ul><ul><ul><li>A fascination with the latest fad or fashion </li></ul></ul><ul><ul><li>managers who have even less understanding than their junior staff of the great complexity of the engineering tasks they are undertaking, and of the risks inherent in departing from what is known to work. </li></ul></ul><ul><ul><li>… most software staff are recruited for their knowledge of a programming language or a software package, not for any engineering knowledge. </li></ul></ul>
    8. 8. Software 2005, Santa Clara <ul><li>&quot;The quality I get from you people is abysmal.” David Watson, CTO, Kaiser Permanente </li></ul><ul><li>&quot;We're at too much risk to have the level of problems with bugs we have today.&quot; Ed Meehan, Lockheed </li></ul><ul><li>&quot;You're not all doomed. But many of you are.” Neal Cameron, CIO, Unilever </li></ul>
    9. 9. Managers and engineering knowledge ...
    10. 10. Software Engineering <ul><li>Computer based applications are increasingly complex </li></ul><ul><li>We choose to put that complexity into the software </li></ul><ul><li>More and more software is business critical </li></ul><ul><li>Quite often, software is safety critical </li></ul><ul><li>Constructing complex and important systems is engineering </li></ul>
    11. 11. Engineering is ... <ul><li>Developing complex systems or objects ... </li></ul><ul><li>using scientific principles ... </li></ul><ul><li>and experience of successful systems and subsystems .. </li></ul><ul><li>embedded in a mature process ... </li></ul><ul><li>with effective quality and risk management </li></ul><ul><li>Many of our current concerns would be familiar to the builders of the Great Pyramids </li></ul>
    12. 12. 7 Lessons from the Past <ul><li>Complexity kills </li></ul><ul><li>The cost of correcting an error rises steeply with time </li></ul><ul><li>Change is inevitable </li></ul><ul><li>Most development is documentation, not invention </li></ul><ul><li>Reuse is better than originality </li></ul><ul><li>Engineering is a process of risk management </li></ul><ul><li>Optimisation is the last thing you should do </li></ul>
    13. 13. Complexity kills <ul><li>Writing simple programs for simple problems is easy </li></ul><ul><li>Rigorous abstraction masters complexity </li></ul><ul><li>Mathematical rigour has always been essential: from LL1 grammars; strong typing; concurrency primitives; and E/R models; to formal specifications and proof </li></ul><ul><li>Structural simplicity is key: modularity, information hiding (Simula 67!), low coupling / high cohesion, problem-oriented structures (eg JSP/JSD), Object Orientation </li></ul>
    14. 14. The cost of correcting an error rises steeply with time <ul><li>Possibly 10-fold with each lifecycle phase </li></ul><ul><li>Specification errors are 100 times more costly than coding errors if both are found in unit testing </li></ul><ul><li>A good development method provides strong V&V at each phase - this is why formal methods are so cost-effective </li></ul><ul><li>Costs increase with time, even when the product is in service </li></ul>
    15. 15. Change is inevitable <ul><li>Every business system encapsulates a business process - which has to change to stay competitive </li></ul><ul><li>Every successful product needs new versions with new features </li></ul><ul><li>The lifetime cost of most software is 5-10 times the development cost </li></ul><ul><li>So maintenance and upgrade are the most costly steps in the lifecycle </li></ul><ul><li>We therefore need to focus on methods, tools and system architectures that </li></ul><ul><ul><li>preserve structural integrity </li></ul></ul><ul><ul><li>limit the growth in complexity </li></ul></ul>
    16. 16. Most development is documentation, not invention <ul><li>In all engineering, the main output is documentation </li></ul><ul><ul><li>aeronautical engineers say that an aircraft is not ready to fly until the documentation weighs more than the aircraft </li></ul></ul><ul><li>For software, the documentation must support the maintenance/update phase </li></ul><ul><ul><li>and vice-versa! </li></ul></ul><ul><li>Updating code before updating specification or design documents is vandalism - it reduces (and ultimately destroys) the value of the product </li></ul><ul><li>Writing good code from good documentation is easy - the reverse can be impossible </li></ul>
    17. 17. Reuse is better than originality <ul><li>Engineers build systems from reliable subsystems </li></ul><ul><ul><li>They use successful designs from the past </li></ul></ul><ul><li>A new design is almost always wrong </li></ul><ul><ul><li>even if it isn’t, building justified confidence is very expensive </li></ul></ul><ul><li>Studying successful systems of the past is the basis for building successful systems in the future </li></ul><ul><li>Design for reuse </li></ul><ul><ul><li>components that provide a single function or closely related group of functions </li></ul></ul><ul><ul><li>clear, precise specification </li></ul></ul><ul><ul><li>secure version management </li></ul></ul>
    18. 18. Engineering requires the management of risk <ul><li>We cannot know everything we need to, when we start </li></ul><ul><li>Unacceptable risks must be identified and eliminated early </li></ul><ul><li>The residual risks have to be managed. </li></ul><ul><ul><li>plan to do work to avoid or accommodate them </li></ul></ul><ul><ul><li>the cost multiplied by the probability must be planned in the budget for the project </li></ul></ul><ul><ul><li>revised costs and probabilities are needed for every project review </li></ul></ul><ul><li>The forecast cost to complete is a three-valued function </li></ul><ul><ul><li>if all risks materialise </li></ul></ul><ul><ul><li>engineering judgement </li></ul></ul><ul><ul><li>if no risks materialise </li></ul></ul>
    19. 19. Optimisation is the last thing you should do <ul><li>Jackson’s law </li></ul><ul><li>Jackson’s second law (for experts only) </li></ul><ul><li>This doesn’t mean being wasteful of resources </li></ul><ul><ul><li>a good engineer should know how to work economically </li></ul></ul><ul><ul><li>“ an engineer is someone who can do for twopence what any fool can do for a shilling” </li></ul></ul>
    20. 20. The Professional software engineer…. <ul><li>... is someone who </li></ul><ul><ul><li>has a good grounding in computer science, mathematics, and human factors </li></ul></ul><ul><ul><li>understands and can work with mature engineering processes involving teamwork, risk management, and quality assurance </li></ul></ul><ul><ul><li>understands measurement as a basis for quality improvement </li></ul></ul><ul><ul><li>has studied successful systems of the past, and understands their design principles </li></ul></ul><ul><ul><li>understands a the limits of their own competence </li></ul></ul><ul><ul><li>keeps up to date by reading the journals and CPD </li></ul></ul>
    21. 21. What we know: Specifications <ul><li>Form : must mirror the structure of the real world requirement. Principles of Program Design, Jackson, AP 1975 </li></ul><ul><li>Notation : must support unambiguous statement of requirements and reasoning about properties. Only then can you understand the system, or the impact of changes. </li></ul><ul><li>Mathematical foundations are essential - Alan Turing knew this in the 1940s. </li></ul>
    22. 22. Abstraction <ul><li>The two most important characteristics of a specification notation are (1) that it should permit problem-oriented abstractions to be expressed … </li></ul><ul><li>… and (2) that it should have rigorous semantics so that specifications can be analysed for anomalies and to explore system properties. </li></ul><ul><li>“ In this connection it might be worthwhile to point out that the purpose of abstracting is not to be vague, but to create a new semantic level in which one can be absolutely precise”. Dijkstra 1972 </li></ul>
    23. 23. What we know: Engineering <ul><li>Engineering is the application of science, within mature processes, to build practical systems, cost-effectively. </li></ul><ul><li>For software engineers, this means applying computer science, within mature processes for planning, risk and quality management, formal reviews, configuration management, and the rest of ISO 9001/CMM level 3+ … </li></ul><ul><li>All engineers use mathematics to model and analyse their systems. </li></ul>
    24. 24. What we know: Testing <ul><li>“ Testing shows the presence, not the absence, of bugs.” Dijkstra 1972 </li></ul><ul><li> “ One can construct convincing proofs quite readily of the ultimate futility of exhaustive testing of a program and even of testing by sampling. So how can one proceed? The role of testing, in theory, is to establish the base propositions of an inductive proof. You should convince yourself, or other people, as firmly as possible, that if the program works a certain number of times on specified data, then it will always work on any data. This can be done by an inductive approach to the proof.” Hoare 1969 </li></ul>
    25. 25. What we know: Change can destroy dependability <ul><li>If you cannot reason about the impact of a change, the change must invalidate all pre-existing evidence of dependability. </li></ul>
    26. 26. Software Death <ul><li>Software dies when a typical fix introduces more errors than it corrects </li></ul><ul><li>If your average error rate is 1 error/50 LoC, your software dies when the size of your average bug fix exceeds 50 LoC. </li></ul><ul><li>Debugging maximises the number of bugs remaining, for a given reliability. </li></ul><ul><li>IBM data showed that typical bugs only recurred every 100+ user-years! Chapman </li></ul>
    27. 27. The State of the Art in Software <ul><li>Annual cost to US economy of poor quality software: $60B source: US NIST Report 7007.011, May 2002. </li></ul><ul><li>Typical industrial / commercial software development: </li></ul><ul><ul><li>6-30 faults delivered / 1000 lines of software </li></ul></ul><ul><ul><ul><li>1M lines: 6000-30,000 faults on delivery </li></ul></ul></ul><ul><ul><li>source: Pfleeger& Hatton, IEEE Computer, pp33-42, February 1997. </li></ul></ul>
    28. 28. What we know: Languages <ul><li>“ I will start with a strong statement of opinion. I think that any significant advance in the programming art is sure to involve very extensive automated analyses of programs. … … Doing thorough analyses of programs is a big job. … It requires a programming language which is susceptible to analysis. I think other programming languages will head either to the junk pile or to the repair shop for overhaul, or they will not be effective tools for the production of large programs.” E S Lowry (IBM) Nato Conference, Rome, October 1969. </li></ul><ul><li>Such languages and tools exist: </li></ul>
    29. 29. Experience with Strong Software Engineering <ul><li>Software development based on formal specification, strong static analysis, ISO 9001 mature processes </li></ul><ul><ul><li>0.1 - 1 faults / 1000 lines of software </li></ul></ul><ul><ul><ul><li>1M lines: 100 - 1000 faults on delivery instead of 6000 - 30000 </li></ul></ul></ul><ul><ul><li>100-fold improvement at no extra development cost! </li></ul></ul><ul><ul><li>sources: </li></ul></ul><ul><ul><li>Pfleeger& Hatton, IEEE Computer, pp33-42, February 1997; </li></ul></ul><ul><ul><li>Amey, </li></ul></ul>
    30. 30. Formal methods can reduce risk, save money, and deliver successful projects <ul><li>“ Z is more efficient at finding faults than the most efficient test phase” </li></ul><ul><ul><li> </li></ul></ul><ul><li>“ compelling evidence that development methods that focus on bug prevention rather than bug detection can both raise quality and save time and money.” </li></ul><ul><ul><li> </li></ul></ul>
    31. 31. But: get the basics right first <ul><li>First … ISO 9001 and/or CMM Level 3+ </li></ul><ul><ul><li>now you are under control </li></ul></ul><ul><li>Then…Formal methods for requirements </li></ul><ul><ul><li>now you really understand what you are trying to do </li></ul></ul><ul><li>Then ...Implementation using well-defined languages with formal annotations </li></ul><ul><ul><li>for example, SPARK </li></ul></ul>
    32. 32. Two reasons for using Formal Methods <ul><li>Formal methods reduce development risks and save development budget </li></ul><ul><ul><li>FMs are cheaper </li></ul></ul><ul><li>Formal methods lead to far fewer delivered bugs </li></ul><ul><ul><li>delivered software is much higher quality </li></ul></ul><ul><ul><li>the extra quality is free </li></ul></ul><ul><ul><li>support costs are much reduced </li></ul></ul><ul><ul><li>you can even guarantee the software </li></ul></ul>
    33. 33. Summary <ul><li>We can build complex, dependable systems - but only if we always use strong software engineering. </li></ul><ul><li>System and software engineering must be rigorous, disciplined, conservative and evolutionary, learning from what has worked dependably in the past. Formal methods are fundamental to strong software engineering. </li></ul><ul><li>It will take numerate, motivated graduates to change things for the better: you. </li></ul>
    34. 34. Questions?