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

Clean Software Design

Clean Software Design

This the content that I shared at DevNot Summit 2017 conference. It mentions my ideas about clean software design.

Lemi Orhan Ergin

May 26, 2017
Tweet

More Decks by Lemi Orhan Ergin

Other Decks in Programming

Transcript

  1. code design process team management organization tests customer ux &

    ui culture office architecture infrastructure ux & ui meetings security
  2. LEMi ORHAN ERGiN agile software craftsman @ iyzico /lemiorhan lemiorhanergin.com

    @lemiorhan agile practice lead at iyzico developing software since 2001 worked at Sony, eBay/GittiGidiyor, ACM consultant, architect, mentor, developer founder of Software Craftsmanship Turkey ex community leader of Agile Turkey meetup.scturkey.org agileturkey.org dev.iyzipay.com
  3. Jack W. Reeves The C++ Journal Vol. 2, No. 2.

    1992 http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf What is So"ware Design?
  4. Source code is the real so"ware design Designing so!ware is

    an exercise in managing complexity Jack W. Reeves What is Software Design? The C++ Journal Vol. 2, No. 2. 1992 http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
  5. The so"ware design is not complete until it has been

    coded and tested Testing is part of the process of refining the design Jack W. Reeves What is Software Design? The C++ Journal Vol. 2, No. 2. 1992 http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf
  6. The very first value of so"ware is Robert C. Martin

    Author of Clean Code and Clean Coder Owner of cleancoders.com training site …
  7. to tolerate and facilitate on-going changes Robert C. Martin Author

    of Clean Code and Clean Coder Owner of cleancoders.com training site The very first value of so"ware is
  8. Each city has to be renewed in order to meet

    the needs of its populace. So!ware-intensive systems are like that. Grady Booch Developed UML Wrote foreword to “Design Patterns” and “Technical Debt” books Istanbul, Turkey Credit: European Space Imaging
  9. Programming Source Code SOFTWARE DESIGN Refactoring Automated Testing (Unit, Functional,

    etc.) Testing and Refactoring 
 are first class citizens of so"ware design Tests should pass Refactoring should be continuous
  10. COUPLING When readfile() is changed, do you change writeFile() too?

    It shows how many places we need to change
  11. Two elements are loosely coupled if they are not shown

    in the same diff Kent Beck The creator of extreme programming One of the signatories of the Agile Manifesto Pioneered software design patterns and TDD
  12. COHESION Do you search a lot where to change? It

    shows how easy to find the places we need to change
  13. How many files at any one time is still open

    for edit shows the level of cohesion Nat Pryce Co-Author of Growing Object-Oriented Software Guided by Tests Early adopter of XP
  14. Programming Source Code SOFTWARE DESIGN Refactoring Automated Testing (Unit, Functional,

    etc.) Low Coupling High Cohesion Refactor namings (how) mailer.useGmailSmtpSendEmail (what) mailer.sendEmail (why) mailer.sendActivationEmail Reveal what you are doing or why you are doing, not how you are doing
  15. Refactor namings Programming Source Code SOFTWARE DESIGN Refactoring Automated Testing

    (Unit, Functional, etc.) Low Coupling High Cohesion manager handler helper utils facade service validator converter repository wrapper interceptor controller parser gateway generator dto, vo, entity Know what these really means
  16. Split methods, Create new abstractions, Re-organize code Programming Source Code

    SOFTWARE DESIGN Refactoring Automated Testing (Unit, Functional, etc.) Low Coupling High Cohesion Be aware of leaky abstractions. Do not expose details and limitations of its underlying implementation to its users that should ideally be hidden away.
  17. Programming Source Code Refactoring Low Coupling High Cohesion Automated Testing

    (Unit, Functional, etc.) and Code Review Pair Programming
  18. When code is reviewed, the design will be cleaner. Programming

    Source Code Refactoring Automated Testing (Unit, Functional, etc.) Low Coupling High Cohesion and Code Review Pair Programming Pair prog makes you code cheaper due to spending less time in decision taking, bug fixing and debugging.
  19. Find and remove duplications Programming Source Code Refactoring Automated Testing

    (Unit, Functional, etc.) Low Coupling High Cohesion and Code Review Pair Programming It’s not about code duplication, it’s about knowledge duplication. Don’t repeat yourself. Every piece of knowledge should have one and only one representation.
  20. Programming Source Code Refactoring Automated Testing (Unit, Functional, etc.) Low

    Coupling High Cohesion and Code Review Pair Programming Keep it SMALL classes, interfaces, responsibilities, methods, modules, components… use design pa!erns wisely
  21. Programming Source Code Refactoring Automated Testing (Unit, Functional, etc.) Low

    Coupling High Cohesion and Code Review Pair Programming these STOP Singletons? Sharing state Static & new keywords Framework slave coding Premature optimization Primitive obssession Huge upfront design Controling flows with exceptions or use them wisely
  22. Programming Source Code Refactoring Low Coupling High Cohesion Automated Testing

    (Unit, Functional, etc.) and Code Review Pair Programming