Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Changing code in a professional way make life easier

Changing code in a professional way make life easier

This presentation is talking about how to make code change safely

starduliang

February 19, 2020
Tweet

Other Decks in How-to & DIY

Transcript

  1. Changing software Four Reasons to Change Software • Adding a

    feature • Fixing a bug • Improving the design • Optimizing resource usage 3
  2. Changing software Putting It all together Adding a Feature Fixing

    a Bug Refactoring Optimizing Structure Changes Changes Changes - New Functionality Changes - - - Functionality - Changes - - Resource usage - - - Changes 4
  3. Risky Change To mitigate risk, we have to ask three

    questions: 1. What changes do we have to make? 2. How will we know that we’ve done them correctly? 3. How will we know that we haven’t broken anything? 6
  4. 8

  5. Risky Change Preserving behavior is a large challenge. Teams tend

    to void change. Don’t Change The Code! 10
  6. Risky Change Developers might tend to • Copy code •

    Only add some lines of code for specific condition • Add new method and rewrite same logic I’ll Kill you ! 11
  7. Software changes can be made in two primary ways •

    Edit and Pray • Cover and modify 16
  8. The day-to-day goal in legacy code is to make changes,

    but not just any changes. We want to make functional changes that deliver value while bringing more of the system under test. At the end of each programming episode, we should be able to point not only to code that provides some new feature, but also its tests. Over time, tested areas of the code base surface like islands rising out of the ocean. Work in these islands becomes much easier. Over time, the islands become large landmasses. Eventually, you’ll be able to work in continents of test-covered code. - Michael C. Feathers (Author of Working Effectively with Legacy Code) 18
  9. Next ? Working with feedback • What is Unit Testing

    • High-Level Testing • Test Coverings • The Legacy Code Change Algorithm 20
  10. Summary • For changing code there are ways make life

    difficult or much easier. • Changing code could involves behavioral change(functional change). • Four reasons to change software. • To make it safe people change with care, but not a silver bullet. • Teams tend to avoid change due to fear. • Changing on good project usually make developer confident. • How to make life easier ? pind down the behavior with unite test. 21
  11. 22