SlideShare una empresa de Scribd logo
1 de 13
Descargar para leer sin conexión
Modular Design
Laws and Principles
in OOP and FP
Cohesion
Coupling
Cohesion
Coupling
1972
?
● Coincidental Cohesion: unrelated elements
● Temporal Cohesion: operations performed at the same time, e.g. initialization
● Sequential Cohesion: operations form a pipeline - one's output is another's input
● Informational Cohesion: operations are performed on the same data structure
● Functional Cohesion: all elements realize a single, well-defined task, e.g. a
function
Cohesion levels
● Content Coupling: a module uses/alters data in another module
● Global-data Coupling: two modules communicate via global data
● Data-structure Coupling:
communicate via data structure passed as a parameter (more information than needed)
● Data Coupling: communicate via parameter passing (minimal information)
● No Coupling: independent modules
Coupling levels
A modular unit of code...
● serves a clear purpose
● easy to use
● easy to extend
● easy to replace
● survives outside changes
Single Responsibility
Liskov Substitution
Interface Segregation
Open-Closed Principle
Dependency Inversion
Elements inside a package...
● are used together
● change together
Common Reuse Principle
Common Closure Principle
Packages should...
● be as stable as they are abstract
● depend on more stable packages
● not have cycles
Stable Abstractions Principle
Stable Dependencies Principle
Acyclic Dependencies Principle
The Law of Demeter
"the principle of least knowledge"
A
B
E G
F
D
C
B
E
The Demeter
Project
Train Wreck
client.getMortgage().paymentCollection().getNextPayment().applyPayment(300.0)
(update-in client [:mortgage :payments] conj (payment 300.0))
wiki.c2.com/?TrainWreck
Tell don’t ask
Feature Envy
in conclusion

Más contenido relacionado

Destacado (12)

Chinese market
Chinese marketChinese market
Chinese market
 
Wildlife
WildlifeWildlife
Wildlife
 
Apresentação Total Health
Apresentação Total HealthApresentação Total Health
Apresentação Total Health
 
Health literacy for schools libraries
Health literacy for schools librariesHealth literacy for schools libraries
Health literacy for schools libraries
 
Modular design
Modular designModular design
Modular design
 
Modular design
Modular design   Modular design
Modular design
 
Hyperlink jeric
Hyperlink jericHyperlink jeric
Hyperlink jeric
 
Ubs exhibition work
Ubs exhibition workUbs exhibition work
Ubs exhibition work
 
Design process and concepts
Design process and conceptsDesign process and concepts
Design process and concepts
 
Modular instruction
Modular instructionModular instruction
Modular instruction
 
04 a iso 9001 2015 checklist
04 a iso 9001 2015 checklist04 a iso 9001 2015 checklist
04 a iso 9001 2015 checklist
 
Serverless
ServerlessServerless
Serverless
 

Similar a Modular Design - Laws and Principles - in OOP and FP

Coupling Coupling can be low (loose) or high (tight).Types of cou.pdf
Coupling Coupling can be low (loose) or high (tight).Types of cou.pdfCoupling Coupling can be low (loose) or high (tight).Types of cou.pdf
Coupling Coupling can be low (loose) or high (tight).Types of cou.pdf
anuradhasilks
 

Similar a Modular Design - Laws and Principles - in OOP and FP (20)

EFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptxEFFECTIVE MODULAR DESIGN.pptx
EFFECTIVE MODULAR DESIGN.pptx
 
Cohesion and coupling in software design
Cohesion and coupling in software designCohesion and coupling in software design
Cohesion and coupling in software design
 
Sharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & ImplementationSharbani Bhattacharya SE design & Implementation
Sharbani Bhattacharya SE design & Implementation
 
Unit-III(Design).pptx
Unit-III(Design).pptxUnit-III(Design).pptx
Unit-III(Design).pptx
 
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and PatternsFRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
FRU Kathmandu: Adopting with Change Frontend Architecture and Patterns
 
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
Angular Rebooted: Components Everywhere - Carlo Bonamico, Sonia Pini - Codemo...
 
Angular Rebooted: Components Everywhere
Angular Rebooted: Components EverywhereAngular Rebooted: Components Everywhere
Angular Rebooted: Components Everywhere
 
Coupling coheshion tps
Coupling coheshion tpsCoupling coheshion tps
Coupling coheshion tps
 
Se 381 - lec 22 - 24 - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24  - 12 may15 - modularity - i - couplingSe 381 - lec 22 - 24  - 12 may15 - modularity - i - coupling
Se 381 - lec 22 - 24 - 12 may15 - modularity - i - coupling
 
Coupling Coupling can be low (loose) or high (tight).Types of cou.pdf
Coupling Coupling can be low (loose) or high (tight).Types of cou.pdfCoupling Coupling can be low (loose) or high (tight).Types of cou.pdf
Coupling Coupling can be low (loose) or high (tight).Types of cou.pdf
 
Software Engineering Unit 3 PPT Software Design
Software Engineering Unit 3 PPT Software DesignSoftware Engineering Unit 3 PPT Software Design
Software Engineering Unit 3 PPT Software Design
 
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesionSe 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
Se 381 - lec 23 - 28 - 12 may16 - modularity - ii - cohesion
 
Object Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopObject Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshop
 
Design engineering cohesion by dinesh
Design engineering cohesion by dineshDesign engineering cohesion by dinesh
Design engineering cohesion by dinesh
 
CakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesionCakeFest 2011 - Coupling and cohesion
CakeFest 2011 - Coupling and cohesion
 
software engineering
software engineeringsoftware engineering
software engineering
 
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
Salesforce Meetup Grasp and Solid in Apex (Speakers: Alexander Popok and Kons...
 
System software design1
System software design1System software design1
System software design1
 
Fundamental design concepts
Fundamental design conceptsFundamental design concepts
Fundamental design concepts
 
Unit3 Software engineering UPTU
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTU
 

Último

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
masabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
masabamasaba
 

Último (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open SourceWSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
WSO2CON 2024 - Freedom First—Unleashing Developer Potential with Open Source
 
WSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go PlatformlessWSO2CON2024 - It's time to go Platformless
WSO2CON2024 - It's time to go Platformless
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto%in Soweto+277-882-255-28 abortion pills for sale in soweto
%in Soweto+277-882-255-28 abortion pills for sale in soweto
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Modular Design - Laws and Principles - in OOP and FP

  • 1. Modular Design Laws and Principles in OOP and FP
  • 4. ● Coincidental Cohesion: unrelated elements ● Temporal Cohesion: operations performed at the same time, e.g. initialization ● Sequential Cohesion: operations form a pipeline - one's output is another's input ● Informational Cohesion: operations are performed on the same data structure ● Functional Cohesion: all elements realize a single, well-defined task, e.g. a function Cohesion levels
  • 5. ● Content Coupling: a module uses/alters data in another module ● Global-data Coupling: two modules communicate via global data ● Data-structure Coupling: communicate via data structure passed as a parameter (more information than needed) ● Data Coupling: communicate via parameter passing (minimal information) ● No Coupling: independent modules Coupling levels
  • 6. A modular unit of code... ● serves a clear purpose ● easy to use ● easy to extend ● easy to replace ● survives outside changes Single Responsibility Liskov Substitution Interface Segregation Open-Closed Principle Dependency Inversion
  • 7. Elements inside a package... ● are used together ● change together Common Reuse Principle Common Closure Principle
  • 8. Packages should... ● be as stable as they are abstract ● depend on more stable packages ● not have cycles Stable Abstractions Principle Stable Dependencies Principle Acyclic Dependencies Principle
  • 9. The Law of Demeter "the principle of least knowledge" A B E G F D C B E
  • 11. Train Wreck client.getMortgage().paymentCollection().getNextPayment().applyPayment(300.0) (update-in client [:mortgage :payments] conj (payment 300.0)) wiki.c2.com/?TrainWreck