40
CLEAN DESIGN SOFTWARE LEMi ORHAN ERGiN agile software craftsman @ iyzico

Clean Software Design - DevNot Summit Istanbul 2017

Embed Size (px)

Citation preview

Page 1: Clean Software Design - DevNot Summit Istanbul 2017

CLEANDESIGNSOFTWARE

LEMi ORHAN ERGiNagile software craftsman @ iyzico

Page 2: Clean Software Design - DevNot Summit Istanbul 2017
Page 3: Clean Software Design - DevNot Summit Istanbul 2017
Page 4: Clean Software Design - DevNot Summit Istanbul 2017
Page 5: Clean Software Design - DevNot Summit Istanbul 2017
Page 6: Clean Software Design - DevNot Summit Istanbul 2017
Page 7: Clean Software Design - DevNot Summit Istanbul 2017
Page 8: Clean Software Design - DevNot Summit Istanbul 2017
Page 9: Clean Software Design - DevNot Summit Istanbul 2017
Page 10: Clean Software Design - DevNot Summit Istanbul 2017
Page 11: Clean Software Design - DevNot Summit Istanbul 2017

codedesign processteammanagement

organizationtests customer

ux & ui culture officearchitecture infrastructure

ux & uimeetingssecurity

things smell…

Page 12: Clean Software Design - DevNot Summit Istanbul 2017

things smell…and if something smells bad, it means it is not clean

codedesign processteam organization

Page 13: Clean Software Design - DevNot Summit Istanbul 2017

LEMi ORHAN ERGiNagile 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

Page 14: Clean Software Design - DevNot Summit Istanbul 2017

Jack W. Reeves

The C++ Journal Vol. 2, No. 2. 1992http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf

What is So"ware Design?

Page 15: Clean Software Design - DevNot Summit Istanbul 2017

Source code is the real so"ware designDesigning so!ware is an exercise in managing complexity

Jack W. ReevesWhat is Software Design? The C++ Journal Vol. 2, No. 2. 1992http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf

Page 16: Clean Software Design - DevNot Summit Istanbul 2017

The so"ware design is not complete until it has been coded and testedTesting is part of the process of refining the design

Jack W. ReevesWhat is Software Design? The C++ Journal Vol. 2, No. 2. 1992http://user.it.uu.se/~carle/softcraft/notes/Reeve_SourceCodeIsTheDesign.pdf

Page 17: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

Automated Testing (Unit, Functional, etc.)

Page 18: Clean Software Design - DevNot Summit Istanbul 2017

The very first value of so"ware is

Robert C. MartinAuthor of Clean Code and Clean CoderOwner of cleancoders.com training site

Page 19: Clean Software Design - DevNot Summit Istanbul 2017

to tolerate and facilitate on-going changes

Robert C. MartinAuthor of Clean Code and Clean CoderOwner of cleancoders.com training site

The very first value of so"ware is

Page 20: Clean Software Design - DevNot Summit Istanbul 2017

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 UMLWrote foreword to “Design Patterns” and “Technical Debt” books

Istanbul, TurkeyCredit: European Space Imaging

Page 21: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

Refactoring

Automated Testing (Unit, Functional, etc.)

Page 22: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

Refactoring

Automated Testing (Unit, Functional, etc.)

Testing and Refactoring are first class citizens of so"ware designTests should pass Refactoring should be continuous

Page 23: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

Refactoring

Automated Testing (Unit, Functional, etc.)

Page 24: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

Refactoring

clean?

Automated Testing (Unit, Functional, etc.)

Page 25: Clean Software Design - DevNot Summit Istanbul 2017

COUPLINGWhen readfile() is changed, do you change writeFile() too? It shows how many places we need to change

Page 26: Clean Software Design - DevNot Summit Istanbul 2017

Two elements are loosely coupled if they are not shown in the same diff

Kent BeckThe creator of extreme programmingOne of the signatories of the Agile ManifestoPioneered software design patterns and TDD

Page 27: Clean Software Design - DevNot Summit Istanbul 2017

COHESIONDo you search a lot where to change? It shows how easy to find the places we need to change

Page 28: Clean Software Design - DevNot Summit Istanbul 2017

How many files at any one time is still open for edit shows the level of cohesion

Nat PryceCo-Author of Growing Object-Oriented Software Guided by TestsEarly adopter of XP

Page 29: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

SOFTWARE DESIGN

RefactoringLow Coupling High Cohesion

Automated Testing (Unit, Functional, etc.)

Page 30: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource 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

Page 31: Clean Software Design - DevNot Summit Istanbul 2017

Refactor namings

ProgrammingSource 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

Page 32: Clean Software Design - DevNot Summit Istanbul 2017

Split methods, Create new abstractions, Re-organize code

ProgrammingSource Code

SOFTWARE DESIGN

Refactoring

Automated Testing (Unit, Functional, etc.)

Low Coupling High CohesionBe aware of leaky abstractions. Do not expose details and limitations of its underlying implementation to its users that should ideally be hidden away.

Page 33: Clean Software Design - DevNot Summit Istanbul 2017
Page 34: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

RefactoringLow Coupling High Cohesion

Automated Testing (Unit, Functional, etc.)

and Code ReviewPair Programming

Page 35: Clean Software Design - DevNot Summit Istanbul 2017

When code is reviewed, the design will be cleaner.

ProgrammingSource Code

Refactoring

Automated Testing (Unit, Functional, etc.)

Low Coupling High Cohesion

and Code ReviewPair Programming

Pair prog makes you code cheaper due to spending less time in decision taking, bug fixing and debugging.

Page 36: Clean Software Design - DevNot Summit Istanbul 2017

Find and remove duplications

ProgrammingSource Code

Refactoring

Automated Testing (Unit, Functional, etc.)

Low Coupling High Cohesion

and Code ReviewPair 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.

Page 37: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

Refactoring

Automated Testing (Unit, Functional, etc.)

Low Coupling High Cohesion

and Code ReviewPair ProgrammingKeep it

SMALLclasses, interfaces, responsibilities, methods, modules, components…

use design pa!erns wisely

Page 38: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

Refactoring

Automated Testing (Unit, Functional, etc.)

Low Coupling High Cohesion

and Code ReviewPair Programming

theseSTOPSingletons? Sharing state Static & new keywords Framework slave coding Premature optimization Primitive obssession Huge upfront design Controling flows with exceptions

or use them wisely

Page 39: Clean Software Design - DevNot Summit Istanbul 2017

ProgrammingSource Code

RefactoringLow Coupling High Cohesion

Automated Testing (Unit, Functional, etc.)

and Code ReviewPair Programming

Page 40: Clean Software Design - DevNot Summit Istanbul 2017

LEMi ORHAN ERGiNagile software craftsman @ iyzico

/lemiorhan lemiorhanergin.com @lemiorhan