SlideShare a Scribd company logo
© XPSurgery.com 2016 @kevinrutherford
Love and Death
“To love is to suffer. To avoid suffering
one must not love. But then one
suffers from not loving. Therefore,
to love is to suffer; not to love is to
suffer; to suffer is to suffer. To be
happy is to love. To be happy,
then, is to suffer, but suffering
makes one unhappy. Therefore,
to be unhappy, one must love or
love to suffer or suffer from too
much happiness.
I hope you're getting this down.”
Love and Death, Woody Allen, 1975
© XPSurgery.com 2016 @kevinrutherford
@kevinrutherford @xpsurgery
http://silkandspinach.net http://xpsurgery.com
© XPSurgery.com 2016 @kevinrutherford
?
© XPSurgery.com 2016 @kevinrutherford
SOLID
Primitive Obsession
Feature Envy
Sim
ulated
Polym
orphism
Lazy Class
Temporary Field
Inappropriate
Intim
acy
ShotgunSurgery
Data Clump
Long
M
ethod
Large Class
???
??? ???
???
???
???
???
RefusedBequest
© XPSurgery.com 2016 @kevinrutherford
Refactoring algorithm:
1. Remove some coupling
2. Repeat
© XPSurgery.com 2016 @kevinrutherford
https://github.com/ xpsurgery / corner-shop
© XPSurgery.com 2016 @kevinrutherford
A B
C
© XPSurgery.com 2016 @kevinrutherford
Warehouse
Actions
Catalogue
Actions
Basket
Actions
User
Interface
Warehouse
Catalogue
Basket Filestore
Main
© XPSurgery.com 2016 @kevinrutherford
Connascence between two software elements
A and B means either:
1) some change to A would require B to be changed,
(or at least carefully checked), or
2) some change would require both A and B
to be changed together
in order to preserve overall correctness.
© XPSurgery.com 2016 @kevinrutherford
Warehouse
Actions
Catalogue
Actions
Basket
Actions
User
Interface
Warehouse
Catalogue
Basket Filestore
Main
© XPSurgery.com 2016 @kevinrutherford
Warehouse
Actions
Warehouse
Connascence of Name
Connascence of Type
© XPSurgery.com 2016 @kevinrutherford
Degree
Reach
Type
© XPSurgery.com 2016 @kevinrutherford
expression ↔ expression 0
function ↔ function 1
object ↔ object 2
module ↔ module 3
process ↔ process 4
Reach
© XPSurgery.com 2016 @kevinrutherford
Name
Type
Convention
Algorithm
Position
Execution Order
Timing
Value
Identity
1
2
3
4
5
6
7
8
9
Type
© XPSurgery.com 2016 @kevinrutherford
Refactoring algorithm:
1. Organise the code into top-level
encapsulation units
2. Map the connascence among them
3. Remove the worst
4. Recurse into each
encapsulation unit [optional]
© XPSurgery.com 2016 @kevinrutherford
?
@kevinrutherford
@xpsurgery
http://silkandspinach.net/tag/connascence
http://xpsurgery.com

More Related Content

More from Kevin Rutherford

Making the most of autism
Making the most of autismMaking the most of autism
Making the most of autism
Kevin Rutherford
 
Evolving the Kanban Board
Evolving the Kanban BoardEvolving the Kanban Board
Evolving the Kanban Board
Kevin Rutherford
 
Don't forget the developers!
Don't forget the developers!Don't forget the developers!
Don't forget the developers!
Kevin Rutherford
 
Love and death
Love and deathLove and death
Love and death
Kevin Rutherford
 
The 5-day challenge
The 5-day challengeThe 5-day challenge
The 5-day challenge
Kevin Rutherford
 
Red, green, ... what now?!
Red, green, ... what now?!Red, green, ... what now?!
Red, green, ... what now?!
Kevin Rutherford
 
Pair programming
Pair programmingPair programming
Pair programming
Kevin Rutherford
 
OCP String Calculator kata
OCP String Calculator kataOCP String Calculator kata
OCP String Calculator kataKevin Rutherford
 

More from Kevin Rutherford (20)

Making the most of autism
Making the most of autismMaking the most of autism
Making the most of autism
 
Evolving the Kanban Board
Evolving the Kanban BoardEvolving the Kanban Board
Evolving the Kanban Board
 
Don't forget the developers!
Don't forget the developers!Don't forget the developers!
Don't forget the developers!
 
Love and death
Love and deathLove and death
Love and death
 
The 5-day challenge
The 5-day challengeThe 5-day challenge
The 5-day challenge
 
Red, green, ... what now?!
Red, green, ... what now?!Red, green, ... what now?!
Red, green, ... what now?!
 
Pair programming
Pair programmingPair programming
Pair programming
 
Tdd is dead
Tdd is deadTdd is dead
Tdd is dead
 
Hex arch
Hex archHex arch
Hex arch
 
Shepherding antipatterns
Shepherding antipatternsShepherding antipatterns
Shepherding antipatterns
 
Kata rules
Kata rulesKata rules
Kata rules
 
Movie app kata
Movie app kataMovie app kata
Movie app kata
 
Object discovery
Object discoveryObject discovery
Object discovery
 
Connascence
ConnascenceConnascence
Connascence
 
OCP Checkout kata
OCP Checkout kataOCP Checkout kata
OCP Checkout kata
 
OCP bowling kata
OCP bowling kataOCP bowling kata
OCP bowling kata
 
OCP String Calculator kata
OCP String Calculator kataOCP String Calculator kata
OCP String Calculator kata
 
OCP kata overview
OCP kata overviewOCP kata overview
OCP kata overview
 
Telling not-asking
Telling not-askingTelling not-asking
Telling not-asking
 
Uml
UmlUml
Uml
 

Recently uploaded

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Globus
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
Ortus Solutions, Corp
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
vrstrong314
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 

Recently uploaded (20)

Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
Exploring Innovations in Data Repository Solutions - Insights from the U.S. G...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024BoxLang: Review our Visionary Licenses of 2024
BoxLang: Review our Visionary Licenses of 2024
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
top nidhi software solution freedownload
top nidhi software solution freedownloadtop nidhi software solution freedownload
top nidhi software solution freedownload
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 

Connascence hunting

  • 1. © XPSurgery.com 2016 @kevinrutherford Love and Death “To love is to suffer. To avoid suffering one must not love. But then one suffers from not loving. Therefore, to love is to suffer; not to love is to suffer; to suffer is to suffer. To be happy is to love. To be happy, then, is to suffer, but suffering makes one unhappy. Therefore, to be unhappy, one must love or love to suffer or suffer from too much happiness. I hope you're getting this down.” Love and Death, Woody Allen, 1975
  • 2. © XPSurgery.com 2016 @kevinrutherford @kevinrutherford @xpsurgery http://silkandspinach.net http://xpsurgery.com
  • 3. © XPSurgery.com 2016 @kevinrutherford ?
  • 4. © XPSurgery.com 2016 @kevinrutherford SOLID Primitive Obsession Feature Envy Sim ulated Polym orphism Lazy Class Temporary Field Inappropriate Intim acy ShotgunSurgery Data Clump Long M ethod Large Class ??? ??? ??? ??? ??? ??? ??? RefusedBequest
  • 5. © XPSurgery.com 2016 @kevinrutherford Refactoring algorithm: 1. Remove some coupling 2. Repeat
  • 6. © XPSurgery.com 2016 @kevinrutherford https://github.com/ xpsurgery / corner-shop
  • 7. © XPSurgery.com 2016 @kevinrutherford A B C
  • 8. © XPSurgery.com 2016 @kevinrutherford Warehouse Actions Catalogue Actions Basket Actions User Interface Warehouse Catalogue Basket Filestore Main
  • 9. © XPSurgery.com 2016 @kevinrutherford Connascence between two software elements A and B means either: 1) some change to A would require B to be changed, (or at least carefully checked), or 2) some change would require both A and B to be changed together in order to preserve overall correctness.
  • 10. © XPSurgery.com 2016 @kevinrutherford Warehouse Actions Catalogue Actions Basket Actions User Interface Warehouse Catalogue Basket Filestore Main
  • 11. © XPSurgery.com 2016 @kevinrutherford Warehouse Actions Warehouse Connascence of Name Connascence of Type
  • 12. © XPSurgery.com 2016 @kevinrutherford Degree Reach Type
  • 13. © XPSurgery.com 2016 @kevinrutherford expression ↔ expression 0 function ↔ function 1 object ↔ object 2 module ↔ module 3 process ↔ process 4 Reach
  • 14. © XPSurgery.com 2016 @kevinrutherford Name Type Convention Algorithm Position Execution Order Timing Value Identity 1 2 3 4 5 6 7 8 9 Type
  • 15. © XPSurgery.com 2016 @kevinrutherford Refactoring algorithm: 1. Organise the code into top-level encapsulation units 2. Map the connascence among them 3. Remove the worst 4. Recurse into each encapsulation unit [optional]
  • 16. © XPSurgery.com 2016 @kevinrutherford ? @kevinrutherford @xpsurgery http://silkandspinach.net/tag/connascence http://xpsurgery.com

Editor's Notes

  1. 1. Maths / group theory PhD 2. Encryption – mortgage transfers and Unix 3. Software house 4. Agile / XP 5. Coaching / training in s/w craftsmanship
  2. Code smells are confusing. Sometimes FeatureEnvy is a good thing... SOLID is impractical All these things are a proxy for COUPLING and COHESION