Transitioning to quality software


Published on

Transitioning from working software to quality software

Published in: Technology
  • Be the first to comment

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

No notes for slide
  • kindles = fellángol declines = csökken cease = megszűnik loitering = csavargás truant = iskolakerülő
  • Transitioning to quality software

    1. 1. <ul>Transitioning from working software to quality software </ul><ul>a.k.a. caring instead of peonage </ul>
    2. 2. <ul>What is peonage? </ul><ul>Constantly growing technical debt in the name of business needs. This results in a code base that makes it more expensive to respond to changes over time. More and more programmers are hired to keep control of the evolving code base. This leads to Defect-Driven Development, where developers keep introducing more defects while trying to fix them. The code is constantly monitored and hacked while trying to converge to it's original intention. </ul>
    3. 3. <ul>Ward Cunningham first drew the comparison between technical complexity and debt in a 1992 experience report: Shipping first time code is like going into debt. A little debt speeds development so long as it is paid back promptly with a rewrite... The danger occurs when the debt is not repaid. Every minute spent on not-quite-right code counts as interest on that debt. Entire engineering organizations can be brought to a stand-still under the debt load of an unconsolidated implementation, object-oriented or otherwise. </ul><ul>What is Technical Debt? </ul>
    4. 4. <ul>What generates Technical Debt? </ul><ul>Pressure </ul><ul>Lack of skills </ul><ul>Lack of information </ul><ul><ul><li>&quot;If we don't get this release done on time, there won't be a next release&quot;
    5. 5. &quot;We don't have time to implement this the right way; just hack it in and we'll fix it after we ship.&quot;
    6. 6. Expectation of increasing velocity. </li></ul></ul><ul><ul><li>Defining concrete goals.
    7. 7. Creating Clean Code. </li></ul></ul><ul><ul><li>Unclear definition of done.
    8. 8. Insufficient business knowledge. </li></ul></ul>
    9. 9. <ul>What is caring? </ul><ul>Constantly monitoring metrics that indicate the health of the code base and responding to the changes in the trends. </ul><ul>What do you get in return? </ul><ul>As a developer </ul><ul>As a business owner </ul><ul>As a customer </ul><ul><ul><li>Fearless code modification.
    10. 10. Fearless code commit.
    11. 11. Fearless release.
    12. 12. Won't need to apologize when showing your code to others.
    13. 13. Self-confidence.
    14. 14. Fast and constant feedback about your work. </li></ul></ul><ul><ul><li>Constant overview of the evolution of your product.
    15. 15. Ability to know the current state of development without any human interactions.
    16. 16. Confidence in your product.
    17. 17. Trust in your team. </li></ul></ul><ul><ul><li>Working software.
    18. 18. Significantly less bugs. </li></ul></ul>
    19. 19. <ul>Metrics regarding code health </ul><ul><ul><li>Number of coding standard violations.
    20. 20. Number of duplicated code.
    21. 21. Amount of dead code.
    22. 22. Amount of code covered by (automated) tests. </li></ul></ul><ul><ul><li>Number of open tasks. (todo, etc. in code)
    23. 23. Amount of overly complicated expressions.
    24. 24. Relationship between packages and objects (modularity). </li></ul></ul><ul>Exact measurements, straight-forward meanings: </ul><ul>Complex measurements and meanings: </ul>
    25. 25. <ul>What do these trends generally indicate*? </ul><ul>* assuming the engineers have the knowledge to realize the problems. </ul><ul>Constant low (~0) </ul><ul>Constant high </ul><ul>Lowering </ul><ul>Growing </ul><ul><ul><li>Change is welcomed.
    26. 26. The code is stable.
    27. 27. Fixing bugs is fast and cheap. </li></ul></ul><ul><ul><li>Lack of morale or discipline.
    28. 28. A fix of a bug usually is hard and expensive.
    29. 29. High probability of introducing one or more defects while fixing one.
    30. 30. Change is hard and expensive. </li></ul></ul><ul><ul><li>The development team wants to take control over the code.
    31. 31. Change will be cheaper and less time-consuming.
    32. 32. Transition to a higher level of software development and demanding. </li></ul></ul><ul><ul><li>Change in circumstances that caused low morale or discipline.
    33. 33. Too much pressure on the programmers.
    34. 34. Growing technical debt.
    35. 35. Software becoming unstable. </li></ul></ul>
    36. 36. <ul>Measuring coding standard violations </ul><ul>Normally every coding society has a standard that they try to stick to. It usually helps co-workers in understanding each-other's code and preventing bugs. </ul>
    37. 37. <ul>Measuring coding standard violations </ul><ul>What does the trend mean? </ul><ul>Constant low (~0) </ul><ul>Growing </ul><ul><ul><li>Internal API-s are well documented, reusability is easy.
    38. 38. Programmers do a good job keeping their artifact clean.
    39. 39. Code is anytime easily readable and presentable to anyone. </li></ul></ul><ul><ul><li>Insane standard requirements. </li></ul></ul>
    40. 40. <ul>Measuring coding standard violations </ul><ul>What does it take to utilize the metric? </ul><ul><ul><li>A company-wide standard that all members know about. (Requires constant training)
    41. 41. The standard written in the form that an automated tool can understand.
    42. 42. An automated tool that can evaluate the code-base and report violations.
    43. 43. Continuous maintenance of the standard and the tool. 
    44. 44. People caring about the trend! </li></ul></ul>
    45. 45. <ul>Measuring duplicated code </ul><ul>What impact does duplicated code have? </ul><ul>&quot;Code duplication harms the uniqueness of entities within a system. For example, a class that offers a certain functionality should be solely responsible for that functionality. If duplication appears, it becomes much harder to locate errors because the assumption “only class X implements this, therefore the error can be found there” does not hold anymore. Thus, the presence of code duplication has (at least) a double negative impact on the quality of a system: (1) the bloating of the system and (2) the co-evolution of clones (the clones do not all evolve the same way) which also implies the cloning of errors.&quot; </ul><ul>Michele Lanza, Radu Marinescu, Stéphane Ducasse - Object-oriented metrics in practice. </ul>
    46. 46. <ul>Measuring duplicated code </ul><ul>What does the trend mean? </ul><ul>Constant low (~0) </ul><ul>Growing </ul><ul>Constant high </ul><ul><ul><li>Optimal, clean code.
    47. 47. Bug fixes are cheap and fast. </li></ul></ul><ul><ul><li>Fear of code modification. </li></ul></ul><ul><ul><li>Bug fixes are expensive, time-consuming and error prone. </li></ul></ul>
    48. 48. <ul>Measuring duplicated code </ul><ul>What does it take to utilize the metric? </ul><ul><ul><li>A company-wide policy about the maximum (lines/tokens) tolerated to be identical.
    49. 49. Developer skill to avoid duplication.
    50. 50. An automated evaluation and reporting tool.
    51. 51. People caring about the trend! </li></ul></ul>
    52. 52. <ul>Measuring dead code </ul><ul>What is dead code? </ul><ul>The dead code metrics measure the amount of dead or inoperative code in the source.    Dead code means unnecessary, inoperative code that can be removed. Being dead means that the element is not used and you can remove it without affecting the functionality of the program. </ul>
    53. 53. <ul>Measuring dead code </ul><ul>What does the trend mean? </ul><ul>Constant low (~0) </ul><ul>Growing </ul><ul>Constant high </ul><ul><ul><li>The code is commonly understood and the responsibilities of objects is clear to everyone. </li></ul></ul><ul><ul><li>There's no trigger for at least one feature. </li></ul></ul><ul><ul><li>Too complex code base. </li></ul></ul>
    54. 54. <ul>Measuring dead code </ul><ul>What does it take to utilize the metric? </ul><ul><ul><li>Full end-to-end tests with code-coverage logs.
    55. 55. Regression tests to verify code removal has not broken functionality.
    56. 56. Developer confidence in removing code.
    57. 57. People caring about the trend! </li></ul></ul>
    58. 58. <ul>Measuring code covered by (automated) tests. </ul><ul>What is code coverage? </ul><ul>An analysis method that determines which parts of the software have been executed (covered) by the test case suite and which parts have not been executed and therefore may require additional attention. </ul>
    59. 59. <ul>Measuring code covered by  (automated) tests. </ul><ul>What does the trend mean? </ul><ul>Code-coverage has the only trend where the higher is better. </ul><ul>Although 100% code coverage may appear like a best possible effort, even 100% code coverage is estimated to only expose about half the faults in a system. Low code coverage indicates inadequate testing, but high code coverage guarantees nothing. </ul><ul>When you focus more and more on making the coverage numbers better, your motivation shifts away from finding bugs. </ul><ul>Constant low (~0) </ul><ul>Constant high </ul><ul>Growing </ul><ul><ul><li>Modification of the code is expensive, time-consuming and error-prone. </li></ul></ul><ul><ul><li>Fearless code commit. </li></ul></ul><ul><ul><li>There's no trigger for at least one feature. </li></ul></ul>
    60. 60. <ul>Measuring code covered by (automated) tests. </ul><ul>What does it take to utilize the metric? </ul><ul><ul><li>A testing environment identical to the production environment, but decoupled from it.
    61. 61. Automated end-to-end, integration and unit tests with code-coverage logs.
    62. 62. Developer skill: creating all kinds of automated tests.
    63. 63. Product skill: writing acceptance criteria for stories.
    64. 64. QA skill: helping Product and Developer with efficient testing.
    65. 65. Visualization of the log.
    66. 66. People caring about the trend! </li></ul></ul>
    67. 67. <ul>Number of open tasks </ul><ul>What is it? </ul><ul>Occurrence of comments or annotations in the source code that indicate an unfinished engineering task, suboptimal or hard-to-read code, or other kinds of technical debt. </ul><ul><ul><li>todo
    68. 68. fixme
    69. 69. xxx
    70. 70. hack </li></ul></ul><ul>Can occur in comment blocks, having @ //, etc. prefixes. </ul><ul><ul><li>review
    71. 71. refactor
    72. 72. wtf
    73. 73. omg </li></ul></ul><ul>Marked tasks are identified as possible sources of technical debt. </ul>
    74. 74. <ul>Number of open tasks </ul><ul>What does the trend mean? </ul><ul>Annotations can be grouped by importance. Critical, normal and low priority can be distinguished. If such categories exist, a more precise trend can be drawn. </ul><ul>Constant low (~0) </ul><ul>Lowering </ul><ul><ul><li>Programmers have the opportunity to always do their best.
    75. 75. No identified source of technical debt.
    76. 76. Well maintained code. </li></ul></ul><ul><ul><li>The development team is paying back technical debt. </li></ul></ul>
    77. 77. <ul>What does it take to utilize the metric? </ul><ul><ul><li>Automated task scanner and reporting tool.
    78. 78. Company-wide policy for task annotations and their categories.
    79. 79. Developer confidence in completing these tasks.
    80. 80. People caring about the trend! </li></ul></ul><ul>Number of open tasks </ul>
    81. 81. <ul>Amount of overly complicated  expressions. </ul><ul>Code complexity can be defined as a metric which is directly proportional to the amount of effort required to understand the code and modify it correctly.    Code complexity metrics are directly related to the maintainability and testability of the code. The more complex a code is, the less maintainable and testable it is.    If the code is object oriented, the complexity metrics also have a direct bearing on the extensibility and modularity of the code. </ul>
    82. 82. <ul>Amount of overly complicated  expressions. </ul><ul>What does the trend mean? </ul><ul>Constant low (~0) </ul><ul>Growing </ul><ul>Constant high </ul><ul><ul><li>Optimal, well structured code. </li></ul></ul><ul><ul><li>Unclear business logic.
    83. 83. Lack of refactoring skills. </li></ul></ul><ul><ul><li>Untestable, unreadable, hard to maintain code base.
    84. 84. Generates fear of change.
    85. 85. Not optimal code. </li></ul></ul>
    86. 86. <ul>What does it take to utilize the metric? </ul><ul><ul><li>Automated measurement and reporting tool.
    87. 87. Company-wide policy for value limits.
    88. 88. Developer skill to eliminate valuations.
    89. 89. People caring about the trend! </li></ul></ul><ul>Amount of overly complicated  expressions. </ul>
    90. 90. <ul>Measuring modularity </ul><ul>&quot;Modularity is a general systems concept, typically defined as a continuum describing the degree to which a system’s components may be separated and recombined. It refers to both the tightness of coupling between components, and the degree to which the “rules” of the system architecture enable (or prohibit) the mixing and matching of components.&quot; Wikipedia </ul>
    91. 91. <ul>Measuring modularity </ul><ul>A tightly coupled application operates with concrete implementations where the slightest modification to one of the collaborators can cause big impacts to the others. </ul>
    92. 92. <ul>Measuring modularity </ul><ul>A loosely coupled architecture relies on interfaces. (Output, Database, NoSql) </ul><ul>Swapping one implementation to another causes no impact on any other collaborator! </ul>
    93. 93. <ul>Measuring modularity </ul><ul>Designs are more extensible when they are independent of implementation details, allowing them to adapt to new implementations without internal modification or breaking their existing contracts. </ul><ul>The maintainability of a design is improved when changes can easily be made without propagating to other parts of the system. </ul>
    94. 94. <ul>Measuring modularity </ul><ul>What does it take to utilize the measurements? </ul><ul><ul><li>Packages.
    95. 95. Automated measurement and reporting tool.
    96. 96. Developer skill to introduce abstraction.
    97. 97. People caring about the trend! </li></ul></ul>
    98. 98. <ul>If a window in a building is broken and left unrepaired all the rest of the windows will soon be broken. . . </ul><ul>Broken Window Syndrome </ul>
    99. 99. <ul>One unrepaired window is a signal that no one cares, so breaking more windows costs nothing. . . . </ul><ul>If disorder goes unchecked, a vicious cycle begins. First, it kindles a fear of crime among residents, who respond by staying behind locked doors. Their involvement in the neighborhood declines…they cease to exercise social regulation over little things like litter on the street, loitering strangers, or truant schoolchildren. When law-abiding eyes stop watching the streets, the social order breaks down and criminals move in. </ul><ul>Broken Window Syndrome </ul>
    100. 100. <ul>Broken Window Syndrome </ul><ul>Understanding that such a vicious cycle exists is important in creating a higher level of discipline and ownership in your current projects. Teams who are not vigilant about immediately fixing broken unit tests or builds, are in a sense, creating a downward spiral within the project. Team members who witness a single blatant act of project vandalism will undoubtedly give into the lazy human nature and retaliate with the common quote, “Well if he isn’t going to do that, than neither am I…”. The spiral begins… </ul><ul> </ul>
    101. 101. <ul>&quot;You can't improve what you don't measure.&quot; </ul><ul>When do you start improving? </ul>