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

Clean Code with Code Review and Automation

Clean Code with Code Review and Automation

Building Maintainable Software in Government Sector

Avatar for Yoga Hanggara

Yoga Hanggara

December 13, 2019
Tweet

More Decks by Yoga Hanggara

Other Decks in Programming

Transcript

  1. Clean Code with Code Review and Automation Building Maintainable Software

    in Government Sector Yoga Hanggara Head of IT Development
  2. Why? What Problem? Today’s Applications: 1. Moving Fast: Business Competitions

    & Customer Needs (Agile) 2. Software in Government Sector: Not Maintainable
  3. Benefits of Maintainable Software Minimize cost for build & maintenance

    (long term) Do we always need build something new?
  4. Clean code is code that is easy to understand and

    easy to change. Maintainability Factor
  5. How we learn to achieve it? 1. Set measurements metrics

    (Objective) 2. Do code review and find best solution (Subjective) 3. Improve with Automation Check/Test
  6. Objective Measurements Metrics Readability 1. Code Style Standard/Conventions 2. Identical/similar

    blocks of code 3. File length, Lines of Code (LOC) 4. Method count, method length Easy to Understand 1. Nested control flow 2. Method complexity 3. Complex logic
  7. Sapawarga Journey Login Update Profile Nomor Penting Berita Login Update

    Profile Nomor Penting Berita Lapor Usulan Masyarakat Survey, Polling Login Update Profile Nomor Penting Berita Lapor Usulan Masyarakat Saber Hoax Tanya Jawab Gubernur Features Changes
  8. Why & How to Code Review 1. Use Code Versioning

    (Git, Github, Gitlab) 2. Developer push the codes, open Merge/Pull Request. 3. The product is owned by the team, so team review is needed. 4. Team give effective feedback. 5. Best idea wins, not by seniority, political, etc. 6. Pair programming is best.
  9. Code Review Challenges 1. Busy Teams 2. No Effective Feedback

    3. No instant understanding 4. No measurement tools & automation
  10. Code Review Tips 1. Commit early, push often. Deliver small

    changes. 2. Mendokumentasikan case yang sering ditemukan saat Code Review a. Meaningful Names b. Keep function/method small c. SOLID, single responsibility principle d. DRY, KISS 3. Pair Programming 4. No Baper & Give Effective Feedback
  11. Pro Tips 1. Always follow standard code style guidelines/conventions 2.

    Always measure metrics 3. Always automate testing using CI/CD 4. Always improve how to peer/code review 5. Always learn something new, Continuous Refactor, Coding is an Art 6. Implement Best Practice, Design Pattern, Clean Architecture 7. Improve Architecture, Cloud Native, Microservices 8. Sometimes we need think fast, sometimes need think slow
  12. Essential Reading List: 1. “The Clean Code” — Robert C.

    Martin 2. “Is High Quality Software Worth the Cost?” - Martin Fowler 3. “Gojek Engineering - Clean Code” - Andi Pangeran
  13. “Always code as if the guy who ends up maintaining

    your code will be a violent psychopath who knows where you live.”