SlideShare a Scribd company logo
SHOOTING AT A MOVING
TARGET
Software development is …
İrem Küçükali
• Requirements change.
• Software should be designed iteratively. Each iteration aims to
improve the design for it to be as good as it can be for the current
situation of the system.
• Being agile leads keeping design flexible and easy to change.
• Never let the rot begin.
Clues of Rotting Software
• Rigidity: Don’t write everyting in one place & use abstractions
• Fragility: Ex. callback hells
• Immobility: Don’t write intricate code
• Viscosity: Preserving the design is hard.
• Needless Complexity: Weight of unused design.
• Needless Repetition: Don’t copy-paste the same code over and over.
• Opacity: Difficult to understand
And How To Avoid Them
• Rigidity
• Fragility
• Immobility
• Viscosity
• Needless Complexity
• Needless Repetition
• Opacity
• S ingle Responsibility
• O pen Closed
• L iskov Substitution
• I nterface Segregation
• D ependency Inversion
PRINCIPLES
Single Responsibility Principle
• A class should have only one reason to change.
• Having multiple responsibility on a class may cause rebuild, retest and
redeploy all dependent applications just because one of them needed
to change.
Open Closed Principle
• Extendible without modifying
• Uses abstract classes and derivatives to extend
• Avoids recompilation
• Avoids Fragility by saving us from countless if/else statements
• Avoids Rigidity since there would be no need for changes in existing
modules.
• Avoids Immobility by creating seperable modules not affected by
changes in each other
• Abstractions can save us from changes (only) that we anticipated.
Open Closed Principle
• Not complete, but strategic closure.
• Strategic: experiences, educated guesses
• Applying OCP, only for likely changes.
• Wait until need abstraction.
• Flexible, reusable, maintainable.
To See Earlier The Changes That Are Likely
• Write tests first.
• Release early and often.
Liskov Substitution Principle
• Subtypes must be substitutiable for their base types.
• Violated by fragile functions with respect to classes with IS-A hierarchy
• IS-A relationship concerns behaviour
• Validity can only be expressed in terms of clients.
• Design by Contract:
• Base class > Derived class
• Unit tests indicate contracts
• To avoid LSP violation, superclasses representing the classes with IS-A
relationship may be used
• Set of classes sharing same responsibility should inherit it from a superclass
• In that way, it would be easier to add a new subclass sharing same responsibility.
Liskov Substitution Principle
• LSP makes OCP possible.
• IS-A does not mean subtype.
Clues about LSP Violations
• Derivative doing less than its base class is usually violates LSP.
• Derivative throwing an exception whose base don’t throw them is
another form of violation.
Dependency Inversion Principle
• To be mobile/reusable and flexible, high-level modules should depend on
abstraction(interfaces) instead of low-level modules.
• Changes to lower-level modules cannot affect and change high-level
modules
• Services through a well-designed and controlled interface
• Lower layers depend on abstract service interfaces declared in upper layers
• Depending on abstractions
• No reference to concrete classes
• No derivative of concrete classes
• No overriding implemented methods of base classes
Dependency Inversion Principle
• Seperating policy from implementation
• Nobody owns the interface
Interface Segregation Principle
• Interface pollution: When derivatives needs a new method, that
method will be added to the base class
• Multiple inheritance can be used to conform ISP
• Using same object through seperate inte
References Next…

More Related Content

Similar to Shooting at a Moving Target

Software Design Principles (SOLID)
Software Design Principles (SOLID)Software Design Principles (SOLID)
Software Design Principles (SOLID)
ASIMYILDIZ
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design Principles
Dr. Syed Hassan Amin
 
Solid principles
Solid principlesSolid principles
Solid principles
Kumaresh Chandra Baruri
 
android principle.pptx
android principle.pptxandroid principle.pptx
android principle.pptx
debasish duarah
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
Tim Mahy
 
Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...
Anuradha Bandara
 
Software design principles
Software design principlesSoftware design principles
Software design principles
Md.Mojibul Hoque
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
Heartin Jacob
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISP
Chihyang Li
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
Eugene Lazutkin
 
Things Every Professional Programmer Should Know
Things Every Professional Programmer Should KnowThings Every Professional Programmer Should Know
Things Every Professional Programmer Should Know
Daniel Sawano
 
S.O.L.I.D xp
S.O.L.I.D xpS.O.L.I.D xp
S.O.L.I.D xp
XP Conference India
 
Writing S.O.L.I.D Code
Writing S.O.L.I.D CodeWriting S.O.L.I.D Code
Writing S.O.L.I.D Code
Rajeev Bharshetty
 
Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
Steve Barbour
 
Mock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleMock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleP Heinonen
 
RSpec & Rails, an introduction
RSpec & Rails, an introductionRSpec & Rails, an introduction
RSpec & Rails, an introduction
Utku Kaynar
 
Software Design Principles
Software Design PrinciplesSoftware Design Principles
Software Design PrinciplesOcean Dong
 
Clean code: SOLID
Clean code: SOLIDClean code: SOLID
Clean code: SOLID
Indeema Software Inc.
 
Clean code: SOLID (iOS)
Clean code: SOLID (iOS)Clean code: SOLID (iOS)
Clean code: SOLID (iOS)
Maksym Husar
 

Similar to Shooting at a Moving Target (20)

Software Design Principles (SOLID)
Software Design Principles (SOLID)Software Design Principles (SOLID)
Software Design Principles (SOLID)
 
Improving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design PrinciplesImproving Software Quality Using Object Oriented Design Principles
Improving Software Quality Using Object Oriented Design Principles
 
Solid principles
Solid principlesSolid principles
Solid principles
 
android principle.pptx
android principle.pptxandroid principle.pptx
android principle.pptx
 
2009 training - tim m - object oriented programming
2009   training - tim m - object oriented programming2009   training - tim m - object oriented programming
2009 training - tim m - object oriented programming
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...Apply SOLID Design principles to javascript code with immediate function invo...
Apply SOLID Design principles to javascript code with immediate function invo...
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
Working With Concurrency In Java 8
Working With Concurrency In Java 8Working With Concurrency In Java 8
Working With Concurrency In Java 8
 
Object Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISPObject Oriented Programming Ch3 SRP, DIP, ISP
Object Oriented Programming Ch3 SRP, DIP, ISP
 
OOP in JS
OOP in JSOOP in JS
OOP in JS
 
Things Every Professional Programmer Should Know
Things Every Professional Programmer Should KnowThings Every Professional Programmer Should Know
Things Every Professional Programmer Should Know
 
S.O.L.I.D xp
S.O.L.I.D xpS.O.L.I.D xp
S.O.L.I.D xp
 
Writing S.O.L.I.D Code
Writing S.O.L.I.D CodeWriting S.O.L.I.D Code
Writing S.O.L.I.D Code
 
Architecture Principles CodeStock
Architecture Principles CodeStock Architecture Principles CodeStock
Architecture Principles CodeStock
 
Mock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion PrincipleMock Objects, Design and Dependency Inversion Principle
Mock Objects, Design and Dependency Inversion Principle
 
RSpec & Rails, an introduction
RSpec & Rails, an introductionRSpec & Rails, an introduction
RSpec & Rails, an introduction
 
Software Design Principles
Software Design PrinciplesSoftware Design Principles
Software Design Principles
 
Clean code: SOLID
Clean code: SOLIDClean code: SOLID
Clean code: SOLID
 
Clean code: SOLID (iOS)
Clean code: SOLID (iOS)Clean code: SOLID (iOS)
Clean code: SOLID (iOS)
 

Recently uploaded

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
manasideore6
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
symbo111
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
ssuser7dcef0
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
Massimo Talia
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
Osamah Alsalih
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
gestioneergodomus
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
gdsczhcet
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Teleport Manpower Consultant
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
veerababupersonal22
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
thanhdowork
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Soumen Santra
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
FluxPrime1
 

Recently uploaded (20)

Fundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptxFundamentals of Electric Drives and its applications.pptx
Fundamentals of Electric Drives and its applications.pptx
 
Building Electrical System Design & Installation
Building Electrical System Design & InstallationBuilding Electrical System Design & Installation
Building Electrical System Design & Installation
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
NUMERICAL SIMULATIONS OF HEAT AND MASS TRANSFER IN CONDENSING HEAT EXCHANGERS...
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024Nuclear Power Economics and Structuring 2024
Nuclear Power Economics and Structuring 2024
 
Standard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - NeometrixStandard Reomte Control Interface - Neometrix
Standard Reomte Control Interface - Neometrix
 
MCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdfMCQ Soil mechanics questions (Soil shear strength).pdf
MCQ Soil mechanics questions (Soil shear strength).pdf
 
DfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributionsDfMAy 2024 - key insights and contributions
DfMAy 2024 - key insights and contributions
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
Gen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdfGen AI Study Jams _ For the GDSC Leads in India.pdf
Gen AI Study Jams _ For the GDSC Leads in India.pdf
 
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdfTop 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
Top 10 Oil and Gas Projects in Saudi Arabia 2024.pdf
 
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERSCW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
CW RADAR, FMCW RADAR, FMCW ALTIMETER, AND THEIR PARAMETERS
 
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
RAT: Retrieval Augmented Thoughts Elicit Context-Aware Reasoning in Long-Hori...
 
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTSHeap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
Heap Sort (SS).ppt FOR ENGINEERING GRADUATES, BCA, MCA, MTECH, BSC STUDENTS
 
DESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docxDESIGN A COTTON SEED SEPARATION MACHINE.docx
DESIGN A COTTON SEED SEPARATION MACHINE.docx
 

Shooting at a Moving Target

  • 1. SHOOTING AT A MOVING TARGET Software development is … İrem Küçükali
  • 2. • Requirements change. • Software should be designed iteratively. Each iteration aims to improve the design for it to be as good as it can be for the current situation of the system. • Being agile leads keeping design flexible and easy to change. • Never let the rot begin.
  • 3. Clues of Rotting Software • Rigidity: Don’t write everyting in one place & use abstractions • Fragility: Ex. callback hells • Immobility: Don’t write intricate code • Viscosity: Preserving the design is hard. • Needless Complexity: Weight of unused design. • Needless Repetition: Don’t copy-paste the same code over and over. • Opacity: Difficult to understand
  • 4. And How To Avoid Them • Rigidity • Fragility • Immobility • Viscosity • Needless Complexity • Needless Repetition • Opacity • S ingle Responsibility • O pen Closed • L iskov Substitution • I nterface Segregation • D ependency Inversion PRINCIPLES
  • 5. Single Responsibility Principle • A class should have only one reason to change. • Having multiple responsibility on a class may cause rebuild, retest and redeploy all dependent applications just because one of them needed to change.
  • 6. Open Closed Principle • Extendible without modifying • Uses abstract classes and derivatives to extend • Avoids recompilation • Avoids Fragility by saving us from countless if/else statements • Avoids Rigidity since there would be no need for changes in existing modules. • Avoids Immobility by creating seperable modules not affected by changes in each other • Abstractions can save us from changes (only) that we anticipated.
  • 7. Open Closed Principle • Not complete, but strategic closure. • Strategic: experiences, educated guesses • Applying OCP, only for likely changes. • Wait until need abstraction. • Flexible, reusable, maintainable.
  • 8. To See Earlier The Changes That Are Likely • Write tests first. • Release early and often.
  • 9. Liskov Substitution Principle • Subtypes must be substitutiable for their base types. • Violated by fragile functions with respect to classes with IS-A hierarchy • IS-A relationship concerns behaviour • Validity can only be expressed in terms of clients. • Design by Contract: • Base class > Derived class • Unit tests indicate contracts • To avoid LSP violation, superclasses representing the classes with IS-A relationship may be used • Set of classes sharing same responsibility should inherit it from a superclass • In that way, it would be easier to add a new subclass sharing same responsibility.
  • 10. Liskov Substitution Principle • LSP makes OCP possible. • IS-A does not mean subtype.
  • 11. Clues about LSP Violations • Derivative doing less than its base class is usually violates LSP. • Derivative throwing an exception whose base don’t throw them is another form of violation.
  • 12. Dependency Inversion Principle • To be mobile/reusable and flexible, high-level modules should depend on abstraction(interfaces) instead of low-level modules. • Changes to lower-level modules cannot affect and change high-level modules • Services through a well-designed and controlled interface • Lower layers depend on abstract service interfaces declared in upper layers • Depending on abstractions • No reference to concrete classes • No derivative of concrete classes • No overriding implemented methods of base classes
  • 13. Dependency Inversion Principle • Seperating policy from implementation • Nobody owns the interface
  • 14. Interface Segregation Principle • Interface pollution: When derivatives needs a new method, that method will be added to the base class • Multiple inheritance can be used to conform ISP • Using same object through seperate inte