SlideShare a Scribd company logo
1 of 45
Download to read offline
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connascence
1) Definition
2) Types
3) Examples and Usage
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connascence
1) Definition
2) Types
3) Examples and Usage
Propose!
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
At the outset...
DRY BEM
Design Patterns
Modularity
No magic numbers
KISS
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connascence
- taxonomy for different types of coupling
- software quality metric
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
● (1995) Meilir Page-Jones;
“In software engineering, two components are connascent
if a change in one would require the other to be modified in
order to maintain the overall correctness of the system.”
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Direction where to refactor to
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
● Connascence of Identity
● Connascence of Value
● Connascence of Timing
● Connascence of Execution Order
● Connascence of Position
● Connascence of Algorithm
● Connascence of Meaning
● Connascence of Type
● Connascence of Name
Direction where to refactor to
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Three axis of connascence:
● Strength:
Stronger connascence are harder to discover, or
harder to refactor
● Degree:
An entity that is connascent with thousands of
other entities is likely to be a larger issue than one
that is connascent with only a few.
● Locality:
Connascent elements that are close together in a
codebase are better than ones that are far apart
Strength
Weak Strong
Degree
Few A lotFew A lot
Locality
Close Far apart
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Three axis of connascence:
● Strength:
Stronger connascence are harder to discover, or
harder to refactor
● Degree:
An entity that is connascent with thousands of
other entities is likely to be a larger issue than one
that is connascent with only a few.
● Locality:
Connascent elements that are close together in a
codebase are better than ones that are far apart
Direction where to refactor to
Strength
Weak Strong
Degree
Few A lotFew A lot
Locality
Close Far apart
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Definition
Three axis of connascence:
● Strength:
Stronger connascence are harder to discover, or
harder to refactor
● Degree:
An entity that is connascent with thousands of
other entities is likely to be a larger issue than one
that is connascent with only a few.
● Locality:
Connascent elements that are close together in a
codebase are better than ones that are far apart
Direction where to refactor to
Strength
Weak Strong
Degree
Few A lotFew A lot
Locality
Close Far apart
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Types of Connascences:
Identity
Value
Timing
Execution Order
-----------------
Position
Algorithm
Meaning
Type
Name
Strength Degree
Locality
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Types of Connascences:
Identity
Value
Timing
Execution Order
-----------------
Position
Algorithm
Meaning
Type
Name
Strength Degree
Locality
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Types
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Name
● Two components must agree on the name of
something
● Locality close*
*same file
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Name
● Two components must agree on the name of
something
● Locality close*
*same file
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Name
● Two components must agree on the name of
something
● Locality further apart
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Type
● Two components must agree on the type of
something
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Type
● Two components must agree on the type of
something
● ...it happens for strong typed languages too:
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Meaning
● Two components must agree on the
interpretation of a value
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Meaning
● Two components must agree on the
interpretation of a value
Aka. “magical number”
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Position
● Two components must be adjacent or occur in
a particluar order
● 3 degrees of connascence
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Position
● Two components must be adjacent or occur in
a particluar order
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Algorithm
● Two components must agree on a particular
algorithm
- Encryption, e.g. SHA-2, SHA512, etc
- Certificate
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Execution Order
● The order of execution of two components is
important
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Timing
● Two components must agree on the timing of
execution
E.g. Race condition between threads
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Value
● Several values have to change together
● Locality further apart
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Connassence of Identity
● Two components must reference the same
entity
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
Types of connascence:
● Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
●
Connascence of Type
●
Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
*still connascence. of value, but locality close
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Examples
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
Types of connascence:
●
Connascence of Identity
●
Connascence of Value
●
Connascence of Timing
●
Connascence of Execution Order
●
Connascence of Position
●
Connascence of Algorithm
●
Connascence of Meaning
● Connascence of Type
● Connascence of Name
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Usage
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Usage
● Gives me a way to evaluate and prioritize code
review/refactor (now I don’t do fixes that are
easiest but the most risky)
● New tool to communicate (good reviews aren’t
based on personal taste but on objective metric)
● Gives new developers a
framework/compass/guidance for writing good,
clean, and maintainable code
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Usage
● Gives me a way to evaluate and prioritize code
review/refactor (now I don’t do fixes that are
easiest but the most risky)
● New tool to communicate (good reviews aren’t
based on personal taste but on objective metric)
● Gives new developers a
framework/compass/guidance for writing good,
clean, and maintainable code
Propose!
@PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
Sources
● “What every Software Developer should know about
Object-Oriented Programming” by Meilir Page-Jones
● ETE 2012 - Jim Weirich - Connascence Examined:
https://www.youtube.com/watch?v=NLT7Qcn_PmI
● Codemania 2015: Josh Robb - Connascence &
Coupling:
https://www.youtube.com/watch?v=Ip2o4vbAK3s

More Related Content

Similar to Connascence - How to detect code smell

MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at NetflixMLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
Xavier Amatriain
 

Similar to Connascence - How to detect code smell (20)

Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
Scala Introduction - Synerzip
Scala Introduction - SynerzipScala Introduction - Synerzip
Scala Introduction - Synerzip
 
EC-WEB: Validator and Preview for the JobPosting Data Model of Schema.org
EC-WEB: Validator and Preview for the JobPosting Data Model of Schema.orgEC-WEB: Validator and Preview for the JobPosting Data Model of Schema.org
EC-WEB: Validator and Preview for the JobPosting Data Model of Schema.org
 
amit_new
amit_newamit_new
amit_new
 
Feature engineering mean encodings
Feature engineering   mean encodingsFeature engineering   mean encodings
Feature engineering mean encodings
 
HTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventionsHTML5, CSS, JavaScript Style guide and coding conventions
HTML5, CSS, JavaScript Style guide and coding conventions
 
Beginner-friendly Guide to ML-enabled Automation in Organic Marketing, Lazari...
Beginner-friendly Guide to ML-enabled Automation in Organic Marketing, Lazari...Beginner-friendly Guide to ML-enabled Automation in Organic Marketing, Lazari...
Beginner-friendly Guide to ML-enabled Automation in Organic Marketing, Lazari...
 
Text mining of Beauty Blogs: о чем говорят женщины? (Артем Просветов, data sc...
Text mining of Beauty Blogs: о чем говорят женщины? (Артем Просветов, data sc...Text mining of Beauty Blogs: о чем говорят женщины? (Артем Просветов, data sc...
Text mining of Beauty Blogs: о чем говорят женщины? (Артем Просветов, data sc...
 
Semantic Analytics
Semantic AnalyticsSemantic Analytics
Semantic Analytics
 
Semantic Analytics, Smart Data
Semantic Analytics, Smart DataSemantic Analytics, Smart Data
Semantic Analytics, Smart Data
 
Data modeling with neo4j tutorial
Data modeling with neo4j tutorialData modeling with neo4j tutorial
Data modeling with neo4j tutorial
 
Overview of running R in the Oracle Database
Overview of running R in the Oracle DatabaseOverview of running R in the Oracle Database
Overview of running R in the Oracle Database
 
SELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the StorySELF - Becoming a Rails Developer - The Rest of the Story
SELF - Becoming a Rails Developer - The Rest of the Story
 
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at NetflixMLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
MLConf - Emmys, Oscars & Machine Learning Algorithms at Netflix
 
Xavier amatriain, dir algorithms netflix m lconf 2013
Xavier amatriain, dir algorithms netflix m lconf 2013Xavier amatriain, dir algorithms netflix m lconf 2013
Xavier amatriain, dir algorithms netflix m lconf 2013
 
Hints in go
Hints in goHints in go
Hints in go
 
20141216 graph database prototyping ams meetup
20141216 graph database prototyping ams meetup20141216 graph database prototyping ams meetup
20141216 graph database prototyping ams meetup
 
Data quality in Real Estate
Data quality in Real EstateData quality in Real Estate
Data quality in Real Estate
 
Building Text Analytics Solutions with AWS ML Services
Building Text Analytics Solutions with AWS ML ServicesBuilding Text Analytics Solutions with AWS ML Services
Building Text Analytics Solutions with AWS ML Services
 
Microformats I: What & Why
Microformats I: What & WhyMicroformats I: What & Why
Microformats I: What & Why
 

Recently uploaded

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 
+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
 

Recently uploaded (20)

Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...How to Choose the Right Laravel Development Partner in New York City_compress...
How to Choose the Right Laravel Development Partner in New York City_compress...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
+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...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Connascence - How to detect code smell

  • 1. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connascence 1) Definition 2) Types 3) Examples and Usage
  • 2. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connascence 1) Definition 2) Types 3) Examples and Usage Propose!
  • 3. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com At the outset... DRY BEM Design Patterns Modularity No magic numbers KISS
  • 4. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com
  • 5. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connascence - taxonomy for different types of coupling - software quality metric
  • 6. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition
  • 7. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition ● (1995) Meilir Page-Jones; “In software engineering, two components are connascent if a change in one would require the other to be modified in order to maintain the overall correctness of the system.”
  • 8. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 9. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 10. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Direction where to refactor to
  • 11. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Direction where to refactor to
  • 12. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Three axis of connascence: ● Strength: Stronger connascence are harder to discover, or harder to refactor ● Degree: An entity that is connascent with thousands of other entities is likely to be a larger issue than one that is connascent with only a few. ● Locality: Connascent elements that are close together in a codebase are better than ones that are far apart Strength Weak Strong Degree Few A lotFew A lot Locality Close Far apart
  • 13. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Three axis of connascence: ● Strength: Stronger connascence are harder to discover, or harder to refactor ● Degree: An entity that is connascent with thousands of other entities is likely to be a larger issue than one that is connascent with only a few. ● Locality: Connascent elements that are close together in a codebase are better than ones that are far apart Direction where to refactor to Strength Weak Strong Degree Few A lotFew A lot Locality Close Far apart
  • 14. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Definition Three axis of connascence: ● Strength: Stronger connascence are harder to discover, or harder to refactor ● Degree: An entity that is connascent with thousands of other entities is likely to be a larger issue than one that is connascent with only a few. ● Locality: Connascent elements that are close together in a codebase are better than ones that are far apart Direction where to refactor to Strength Weak Strong Degree Few A lotFew A lot Locality Close Far apart
  • 15. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Types of Connascences: Identity Value Timing Execution Order ----------------- Position Algorithm Meaning Type Name Strength Degree Locality
  • 16. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Types of Connascences: Identity Value Timing Execution Order ----------------- Position Algorithm Meaning Type Name Strength Degree Locality
  • 17. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Types
  • 18. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Name ● Two components must agree on the name of something ● Locality close* *same file
  • 19. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Name ● Two components must agree on the name of something ● Locality close* *same file
  • 20. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Name ● Two components must agree on the name of something ● Locality further apart
  • 21. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Type ● Two components must agree on the type of something
  • 22. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Type ● Two components must agree on the type of something ● ...it happens for strong typed languages too:
  • 23. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Meaning ● Two components must agree on the interpretation of a value
  • 24. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Meaning ● Two components must agree on the interpretation of a value Aka. “magical number”
  • 25. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Position ● Two components must be adjacent or occur in a particluar order ● 3 degrees of connascence
  • 26. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Position ● Two components must be adjacent or occur in a particluar order
  • 27. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Algorithm ● Two components must agree on a particular algorithm - Encryption, e.g. SHA-2, SHA512, etc - Certificate
  • 28. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Execution Order ● The order of execution of two components is important
  • 29. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Timing ● Two components must agree on the timing of execution E.g. Race condition between threads
  • 30. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Value ● Several values have to change together ● Locality further apart
  • 31. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Connassence of Identity ● Two components must reference the same entity
  • 32. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples
  • 33. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 34. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 35. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 36. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 37. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 38. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 39. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 40. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name *still connascence. of value, but locality close
  • 41. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Examples Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name Types of connascence: ● Connascence of Identity ● Connascence of Value ● Connascence of Timing ● Connascence of Execution Order ● Connascence of Position ● Connascence of Algorithm ● Connascence of Meaning ● Connascence of Type ● Connascence of Name
  • 42. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Usage
  • 43. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Usage ● Gives me a way to evaluate and prioritize code review/refactor (now I don’t do fixes that are easiest but the most risky) ● New tool to communicate (good reviews aren’t based on personal taste but on objective metric) ● Gives new developers a framework/compass/guidance for writing good, clean, and maintainable code
  • 44. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Usage ● Gives me a way to evaluate and prioritize code review/refactor (now I don’t do fixes that are easiest but the most risky) ● New tool to communicate (good reviews aren’t based on personal taste but on objective metric) ● Gives new developers a framework/compass/guidance for writing good, clean, and maintainable code Propose!
  • 45. @PandaScriptCom @thadeuszlay linkedin.com/in/trung-thanh-le/ PandaScript.com thanh.le@sinnerschrader.com Sources ● “What every Software Developer should know about Object-Oriented Programming” by Meilir Page-Jones ● ETE 2012 - Jim Weirich - Connascence Examined: https://www.youtube.com/watch?v=NLT7Qcn_PmI ● Codemania 2015: Josh Robb - Connascence & Coupling: https://www.youtube.com/watch?v=Ip2o4vbAK3s