際際滷

際際滷Share a Scribd company logo
MOST VALUABLE SOFTWARE
DESIGN PRINCIPLES
REVISITED
YAGNI
You arent gonna need it
Advantages:
- Dont end up investing time and money in stuff you dont need.
- Dont increase the total cost of owning your code base.
- Save loads of time by not writing code.
- Boost your productivity.
THINKING YAGNI
I have implemented the AddCommentToPhoto method. I guess I also need to
create an AddCommentToAlbum function. Although we dont need it right now, I
bet well need it in future if we decide to allow users to comment their photo
albums.
Ive finished the CanonizeName method on the Album class. I think Im better
off extracting this method in a utility class because, in future, other classes might
need it too.
THINKING YAGNI
Laying the foundation for a functionality that we dont need right now and might
need in future almost never pays off, its often a waste of time.
Ask yourself: is the method/class/feature Im going to implement really required
right now? Or do you just assume it will be at some point in the future?
THINKING AHEAD
 Analysis paralysis
 Framework on top of a framework
 Lets put it in the config just in case
YAGNI ON BUSINESS LEVEL
 Focus on what the current user needs right now, dont try to anticipate what
they might want in the future.
 DEV: If you see a feature which is not needed right now, state it!
 We dont know what the real requirements are. If implemented now its most likely to
change in the future.
 Adding functionalty always adds maintainability costs. If you add the feature later when
its needed it speeds up the development process.
YAGNI SELF-TEST
What if create a function that calculates the sum of 2 and 3. How would you
implement it?
YAGNI SELF-TEST
WRONG
YAGNI SELF-TEST
YAGNI CONCLUSION
 Gain massive efficiency
 Not applicable when developing 3rd party libraries
 Must-have practice in software development
KISS
Keep It Simple 皆岳顎沿庄糸
KISS
Keep It Simple 皆岳顎沿庄糸
Advantages
- Make code more readable and understandable.
- Make code better maintainable.
KISS CHARACTERISTICS
Correctness, Performance, Readability
How would you arrange them by their importance?
KISS CHARACTERISTICS
Correctness > Readability > Performance
Is it better to have an unreadable application that does things correctly than an
application with bugs and simple code?
Yes, its better to have a flawless system. But what if you need to add or change
something?
KISS CHARACTERISTICS
Readability > Correctness > Performance
If you are going to enhance your system, you are better off having one that is
readable in the first case.
Yes, bugs may occur at one point. But you will be able to fix it quicker with
readable and simple code.
KISS CHARACTERISTICS
There are two ways of constructing a software design: one way is to make it so
simple that there are obviously no deficiencies, and the other way is to make it so
complicated that there are no obvious deficiencies.  C. A. R. Hoare.
SIMPLICITY VS EASINESS
 Easy solution does not take much effort to implement. At the same time, a
simple solution is usually far more difficult to achieve.
 Its easy to create a complicated system that is hard to understand.
 Its easier to introduce technical dept than it is to remove it.
ACCIDENTAL VS ESSENTIAL COMPLEXITY
Not all systems can be made easy to understand.
Essential
The problem that needs to be solved.
Accidental
The way developers try to solve the essential problem.
KISS IMPLICATIONS
 If you need to choose between two solutions, choose the simpelest one.
 Constantly work on simplifying your code base.
 The simpler your solution is, the better you are as a developer
Perfection is achieved, not when there is nothing more to add, but when there is
nothing left to take away.  Antoine de Saint-Exupery.
KISS CONCLUSION
 Removing unnecessary complexity improves productivity.
DRY
Dont Repeat Yourself
- Elimination of repeatable code
- NOT about code duplication
DRY
DRY
DRY
This version now complies with the DRY principle. Or does it not?
Was there really a single piece of knowledge spread across these entities?
Can it be that two classes have identical parts yet still dont break DRY?
Yes. The DRY principle restricts the presence of domain knowledge, it doesnt put
any bounds on the actual code which is required to express that knowledge.
DRY AND UTILITY METHODS
If DRY forces us to keep domain knowledge in a single place, what about code
that doesnt contain any?
No, DRY principle is about knowledge that is essential to your domain. Utility
methods dont contain such knowledge.
DRY AND BOUNDED CONTEXTS
DRY CONCLUSION
 The DRY principle is about domain knowledge.
 Dont confuse DRY with just getting rid of code repetition.
 There are cases where duplication is perfectly fine.
FAIL FAST PRINCIPLE
Stopping the current operation as soon as any unexpected error occurs
Advantages
- Shortens the feedback loop by quickly revealing all problems.
- Confidence software works as intended.
- Protects the persistence state.
FAIL FAST EXAMPLES
 Working with config files.
 Nulls without strict distinction between types that allow nulls and types that
dont.
FAIL FAST CONCLUSION
 Confidence that your app is working correctly.
 Quickly be able to fix any problem.
COHESION AND COUPLING: THE DIFFERENCE
Achieve low coupling and high cohesion
Cohesion
Represents the degree to which part of a code base forms a logically single atomic unit.
Coupling
Represents the degree to which a single unit is independent from others.
HIGH COHESION, LOW COUPLING GUIDELINE
 High cohesion: Keeping parts of a code base that are related to each other in
a single place
 Low coupling: Separating unrelated parts of the code base as much as
possible.
 Relates to: Seperation of Concerns
TYPES OF CODE
1. IDEAL
 The ideal situation
2. GOD OBJECT
 Result of high cohesion and high coupling
 Basically is a single piece of code
3. POORLY SELECTED BOUNDRARIES
 Has boundraries, only selected improperly
4. DESTRUCTIVE COUPLING
 Occurs when trying to decouple so much
that the code loses its focus.
DESTRUCTIVE COUPLING EXAMPLE
DESTRUCTIVE COUPLING EXAMPLE
COHESION AND COUPLING ON DIFFERENT LEVELS
COHESION AND SINGLE RESPONSIBILITY PRINCIPLE
Every class should have a single responsibility
Similar to highly cohesive code.
Difference: High cohesion implies code has similar responsibilities, it does not
necessarily mean the code should have only one.
COHESION AND COUPLING CONCLUSION
 Cohesion represents the degree to which a part of a code base forms a logically
single, atomic unit.
 Coupling represents the degree to which a single unit is independent from others.
 Its impossible to achieve full decoupling without damaging cohesion, and vise versa.
 Try to adhere to the high cohesion and low coupling guideline on all levels of your
code base.
 Dont fall into the trap of destructive decoupling.
QUESTIONS?
Ad

Recommended

Agile Issue Types and Decomposition
Agile Issue Types and Decomposition
Michael Dooley, MPM, PMP, CSM
How to break up epics (for Product Managers)
How to break up epics (for Product Managers)
Amartya Sengupta
State of Drupal keynote, DrupalCon Austin
State of Drupal keynote, DrupalCon Austin
Dries Buytaert
Design patterns - The Good, the Bad, and the Anti-Pattern
Design patterns - The Good, the Bad, and the Anti-Pattern
Barry O Sullivan
The Developer Experience
The Developer Experience
Pamela Fox
Cleaning up your codebase with a clean architecture
Cleaning up your codebase with a clean architecture
Barry O Sullivan
Tech Thursdays: Building Products
Tech Thursdays: Building Products
Hayden Bleasel
Bug Hunting Safari
Bug Hunting Safari
Janie Clayton
Mark McMahon question 6
Mark McMahon question 6
Mark Mcmahon
A call to JS Developers - Lets stop trying to impress each other and start b...
A call to JS Developers - Lets stop trying to impress each other and start b...
Christian Heilmann
Guided Interaction: Rethinking the Query-Result Paradigm
Guided Interaction: Rethinking the Query-Result Paradigm
arnabdotorg
Intro to the creative writing process web
Intro to the creative writing process web
Sandra Barkevich
Driving application development through behavior driven development
Driving application development through behavior driven development
Einar Ingebrigtsen
Training Webinar - Wireframing made easy
Training Webinar - Wireframing made easy
OutSystems
It's Time to Train!
It's Time to Train!
Bob Coppedge
Arch factory - Agile Design: Best Practices
Arch factory - Agile Design: Best Practices
Igor Moochnick
Best practices for agile design
Best practices for agile design
Igor Moochnick
Design principles in a nutshell
Design principles in a nutshell
Anton Udovychenko
Design principles in a nutshell
Design principles in a nutshell
Dmytro Panin
YAGNI Principle and Clean Code
YAGNI Principle and Clean Code
Luan Reffatti
Top 10 clean code practices to reduce technical debt
Top 10 clean code practices to reduce technical debt
Sparity1
Writing Quality Code
Writing Quality Code
indikaMaligaspe
Clean code-v2.2
Clean code-v2.2
B狸nh Tr畛ng n
Best pratice
Best pratice
Eugenio Romano
Clean Code .Net Cheetsheets
Clean Code .Net Cheetsheets
NikitaGoncharuk1
Clean Code V2
Clean Code V2
Jean Carlo Machado
Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design Simple
Lemi Orhan Ergin
Software Design
Software Design
Ahmed Misbah
Does Anyone Remember YAGNI?
Does Anyone Remember YAGNI?
Ian Thomas
Clean code presentation
Clean code presentation
Bhavin Gandhi

More Related Content

What's hot (7)

Mark McMahon question 6
Mark McMahon question 6
Mark Mcmahon
A call to JS Developers - Lets stop trying to impress each other and start b...
A call to JS Developers - Lets stop trying to impress each other and start b...
Christian Heilmann
Guided Interaction: Rethinking the Query-Result Paradigm
Guided Interaction: Rethinking the Query-Result Paradigm
arnabdotorg
Intro to the creative writing process web
Intro to the creative writing process web
Sandra Barkevich
Driving application development through behavior driven development
Driving application development through behavior driven development
Einar Ingebrigtsen
Training Webinar - Wireframing made easy
Training Webinar - Wireframing made easy
OutSystems
It's Time to Train!
It's Time to Train!
Bob Coppedge
Mark McMahon question 6
Mark McMahon question 6
Mark Mcmahon
A call to JS Developers - Lets stop trying to impress each other and start b...
A call to JS Developers - Lets stop trying to impress each other and start b...
Christian Heilmann
Guided Interaction: Rethinking the Query-Result Paradigm
Guided Interaction: Rethinking the Query-Result Paradigm
arnabdotorg
Intro to the creative writing process web
Intro to the creative writing process web
Sandra Barkevich
Driving application development through behavior driven development
Driving application development through behavior driven development
Einar Ingebrigtsen
Training Webinar - Wireframing made easy
Training Webinar - Wireframing made easy
OutSystems
It's Time to Train!
It's Time to Train!
Bob Coppedge

Similar to Most valuable software design principles (20)

Arch factory - Agile Design: Best Practices
Arch factory - Agile Design: Best Practices
Igor Moochnick
Best practices for agile design
Best practices for agile design
Igor Moochnick
Design principles in a nutshell
Design principles in a nutshell
Anton Udovychenko
Design principles in a nutshell
Design principles in a nutshell
Dmytro Panin
YAGNI Principle and Clean Code
YAGNI Principle and Clean Code
Luan Reffatti
Top 10 clean code practices to reduce technical debt
Top 10 clean code practices to reduce technical debt
Sparity1
Writing Quality Code
Writing Quality Code
indikaMaligaspe
Clean code-v2.2
Clean code-v2.2
B狸nh Tr畛ng n
Best pratice
Best pratice
Eugenio Romano
Clean Code .Net Cheetsheets
Clean Code .Net Cheetsheets
NikitaGoncharuk1
Clean Code V2
Clean Code V2
Jean Carlo Machado
Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design Simple
Lemi Orhan Ergin
Software Design
Software Design
Ahmed Misbah
Does Anyone Remember YAGNI?
Does Anyone Remember YAGNI?
Ian Thomas
Clean code presentation
Clean code presentation
Bhavin Gandhi
Software Development Essential Skills
Software Development Essential Skills
John Choi
Clean code
Clean code
Simon S旦nnby
Software design principles
Software design principles
Md.Mojibul Hoque
Software Engineering Primer
Software Engineering Primer
Georg Buske
Creativity vs Best Practices
Creativity vs Best Practices
Supun Dissanayake
Arch factory - Agile Design: Best Practices
Arch factory - Agile Design: Best Practices
Igor Moochnick
Best practices for agile design
Best practices for agile design
Igor Moochnick
Design principles in a nutshell
Design principles in a nutshell
Anton Udovychenko
Design principles in a nutshell
Design principles in a nutshell
Dmytro Panin
YAGNI Principle and Clean Code
YAGNI Principle and Clean Code
Luan Reffatti
Top 10 clean code practices to reduce technical debt
Top 10 clean code practices to reduce technical debt
Sparity1
Clean Code .Net Cheetsheets
Clean Code .Net Cheetsheets
NikitaGoncharuk1
Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design Simple
Lemi Orhan Ergin
Software Design
Software Design
Ahmed Misbah
Does Anyone Remember YAGNI?
Does Anyone Remember YAGNI?
Ian Thomas
Clean code presentation
Clean code presentation
Bhavin Gandhi
Software Development Essential Skills
Software Development Essential Skills
John Choi
Software design principles
Software design principles
Md.Mojibul Hoque
Software Engineering Primer
Software Engineering Primer
Georg Buske
Creativity vs Best Practices
Creativity vs Best Practices
Supun Dissanayake
Ad

Recently uploaded (20)

UPDASP a project coordination unit ......
UPDASP a project coordination unit ......
withrj1
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
Software Testing & its types (DevOps)
Software Testing & its types (DevOps)
S Pranav (Deepu)
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
Looking for a BIRT Report Alternative Heres Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Heres Why Helical Insight Stands Out.pdf
Varsha Nayak
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
Zonerankers Digital marketing solutions
Zonerankers Digital marketing solutions
reenashriee
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
What is data visualization and how data visualization tool can help.pptx
What is data visualization and how data visualization tool can help.pptx
Varsha Nayak
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
UPDASP a project coordination unit ......
UPDASP a project coordination unit ......
withrj1
How Insurance Policy Management Software Streamlines Operations
How Insurance Policy Management Software Streamlines Operations
Insurance Tech Services
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
On-Device AI: Is It Time to Go All-In, or Do We Still Need the Cloud?
Hassan Abid
Open Source Software Development Methods
Open Source Software Development Methods
VICTOR MAESTRE RAMIREZ
Software Testing & its types (DevOps)
Software Testing & its types (DevOps)
S Pranav (Deepu)
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
MOVIE RECOMMENDATION SYSTEM, UDUMULA GOPI REDDY, Y24MC13085.pptx
Maharshi Mallela
Looking for a BIRT Report Alternative Heres Why Helical Insight Stands Out.pdf
Looking for a BIRT Report Alternative Heres Why Helical Insight Stands Out.pdf
Varsha Nayak
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Capability Deck 2025: Accelerating Innovation Through Intelligent Soft...
Emvigo Technologies
Transmission Media. (Computer Networks)
Transmission Media. (Computer Networks)
S Pranav (Deepu)
Step by step guide to install Flutter and Dart
Step by step guide to install Flutter and Dart
S Pranav (Deepu)
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Async-ronizing Success at Wix - Patterns for Seamless Microservices - Devoxx ...
Natan Silnitsky
Zonerankers Digital marketing solutions
Zonerankers Digital marketing solutions
reenashriee
FME as an Orchestration Tool - Peak of Data & AI 2025
FME as an Orchestration Tool - Peak of Data & AI 2025
Safe Software
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
Smadav Pro 2025 Rev 15.4 Crack Full Version With Registration Key
joybepari360
Decipher SEO Solutions for your startup needs.
Decipher SEO Solutions for your startup needs.
mathai2
What is data visualization and how data visualization tool can help.pptx
What is data visualization and how data visualization tool can help.pptx
Varsha Nayak
SAP PM Module Level-IV Training Complete.ppt
SAP PM Module Level-IV Training Complete.ppt
MuhammadShaheryar36
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Smart Financial Solutions: Money Lender Software, Daily Pigmy & Personal Loan...
Intelli grow
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Meet You in the Middle: 1000x Performance for Parquet Queries on PB-Scale Dat...
Alluxio, Inc.
SAP Datasphere Catalog L2 (2024-02-07).pptx
SAP Datasphere Catalog L2 (2024-02-07).pptx
HimanshuSachdeva46
Ad

Most valuable software design principles

  • 1. MOST VALUABLE SOFTWARE DESIGN PRINCIPLES REVISITED
  • 2. YAGNI You arent gonna need it Advantages: - Dont end up investing time and money in stuff you dont need. - Dont increase the total cost of owning your code base. - Save loads of time by not writing code. - Boost your productivity.
  • 3. THINKING YAGNI I have implemented the AddCommentToPhoto method. I guess I also need to create an AddCommentToAlbum function. Although we dont need it right now, I bet well need it in future if we decide to allow users to comment their photo albums. Ive finished the CanonizeName method on the Album class. I think Im better off extracting this method in a utility class because, in future, other classes might need it too.
  • 4. THINKING YAGNI Laying the foundation for a functionality that we dont need right now and might need in future almost never pays off, its often a waste of time. Ask yourself: is the method/class/feature Im going to implement really required right now? Or do you just assume it will be at some point in the future?
  • 5. THINKING AHEAD Analysis paralysis Framework on top of a framework Lets put it in the config just in case
  • 6. YAGNI ON BUSINESS LEVEL Focus on what the current user needs right now, dont try to anticipate what they might want in the future. DEV: If you see a feature which is not needed right now, state it! We dont know what the real requirements are. If implemented now its most likely to change in the future. Adding functionalty always adds maintainability costs. If you add the feature later when its needed it speeds up the development process.
  • 7. YAGNI SELF-TEST What if create a function that calculates the sum of 2 and 3. How would you implement it?
  • 10. YAGNI CONCLUSION Gain massive efficiency Not applicable when developing 3rd party libraries Must-have practice in software development
  • 11. KISS Keep It Simple 皆岳顎沿庄糸
  • 12. KISS Keep It Simple 皆岳顎沿庄糸 Advantages - Make code more readable and understandable. - Make code better maintainable.
  • 13. KISS CHARACTERISTICS Correctness, Performance, Readability How would you arrange them by their importance?
  • 14. KISS CHARACTERISTICS Correctness > Readability > Performance Is it better to have an unreadable application that does things correctly than an application with bugs and simple code? Yes, its better to have a flawless system. But what if you need to add or change something?
  • 15. KISS CHARACTERISTICS Readability > Correctness > Performance If you are going to enhance your system, you are better off having one that is readable in the first case. Yes, bugs may occur at one point. But you will be able to fix it quicker with readable and simple code.
  • 16. KISS CHARACTERISTICS There are two ways of constructing a software design: one way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. C. A. R. Hoare.
  • 17. SIMPLICITY VS EASINESS Easy solution does not take much effort to implement. At the same time, a simple solution is usually far more difficult to achieve. Its easy to create a complicated system that is hard to understand. Its easier to introduce technical dept than it is to remove it.
  • 18. ACCIDENTAL VS ESSENTIAL COMPLEXITY Not all systems can be made easy to understand. Essential The problem that needs to be solved. Accidental The way developers try to solve the essential problem.
  • 19. KISS IMPLICATIONS If you need to choose between two solutions, choose the simpelest one. Constantly work on simplifying your code base. The simpler your solution is, the better you are as a developer Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery.
  • 20. KISS CONCLUSION Removing unnecessary complexity improves productivity.
  • 21. DRY Dont Repeat Yourself - Elimination of repeatable code - NOT about code duplication
  • 22. DRY
  • 23. DRY
  • 24. DRY This version now complies with the DRY principle. Or does it not? Was there really a single piece of knowledge spread across these entities? Can it be that two classes have identical parts yet still dont break DRY? Yes. The DRY principle restricts the presence of domain knowledge, it doesnt put any bounds on the actual code which is required to express that knowledge.
  • 25. DRY AND UTILITY METHODS If DRY forces us to keep domain knowledge in a single place, what about code that doesnt contain any? No, DRY principle is about knowledge that is essential to your domain. Utility methods dont contain such knowledge.
  • 26. DRY AND BOUNDED CONTEXTS
  • 27. DRY CONCLUSION The DRY principle is about domain knowledge. Dont confuse DRY with just getting rid of code repetition. There are cases where duplication is perfectly fine.
  • 28. FAIL FAST PRINCIPLE Stopping the current operation as soon as any unexpected error occurs Advantages - Shortens the feedback loop by quickly revealing all problems. - Confidence software works as intended. - Protects the persistence state.
  • 29. FAIL FAST EXAMPLES Working with config files. Nulls without strict distinction between types that allow nulls and types that dont.
  • 30. FAIL FAST CONCLUSION Confidence that your app is working correctly. Quickly be able to fix any problem.
  • 31. COHESION AND COUPLING: THE DIFFERENCE Achieve low coupling and high cohesion Cohesion Represents the degree to which part of a code base forms a logically single atomic unit. Coupling Represents the degree to which a single unit is independent from others.
  • 32. HIGH COHESION, LOW COUPLING GUIDELINE High cohesion: Keeping parts of a code base that are related to each other in a single place Low coupling: Separating unrelated parts of the code base as much as possible. Relates to: Seperation of Concerns
  • 34. 1. IDEAL The ideal situation
  • 35. 2. GOD OBJECT Result of high cohesion and high coupling Basically is a single piece of code
  • 36. 3. POORLY SELECTED BOUNDRARIES Has boundraries, only selected improperly
  • 37. 4. DESTRUCTIVE COUPLING Occurs when trying to decouple so much that the code loses its focus.
  • 40. COHESION AND COUPLING ON DIFFERENT LEVELS
  • 41. COHESION AND SINGLE RESPONSIBILITY PRINCIPLE Every class should have a single responsibility Similar to highly cohesive code. Difference: High cohesion implies code has similar responsibilities, it does not necessarily mean the code should have only one.
  • 42. COHESION AND COUPLING CONCLUSION Cohesion represents the degree to which a part of a code base forms a logically single, atomic unit. Coupling represents the degree to which a single unit is independent from others. Its impossible to achieve full decoupling without damaging cohesion, and vise versa. Try to adhere to the high cohesion and low coupling guideline on all levels of your code base. Dont fall into the trap of destructive decoupling.