SlideShare ist ein Scribd-Unternehmen logo
1 von 20
(c) kevin rutherford 2012
describing the internal quality of software
@kevinrutherford
(c) kevin rutherford 2012
code smells
Primitive Obsession
Feature Envy
Sim
ulated
Polym
orphismLazy Class
Temporary Field
Inappropriate Intimacy
ShotgunSurgery
Data Clump
Long
M
ethod
Large Class
RefusedBequest
(c) kevin rutherford 2012
code smells
Primitive Obsession
Feature Envy
Sim
ulated
Polym
orphismLazy Class
Temporary Field
Inappropriate Intimacy
ShotgunSurgery
Data Clump
Long
M
ethod
Large Class
???
??? ???
???
???
???
???
RefusedBequest
(c) kevin rutherford 2012
connascence
Two software 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.
(c) kevin rutherford 2012
connascence
Connascence of Name
Connascence of Type
Connascence of Meaning
Connascence of Algorithm
Connascence of Position
Connascence of Execution order
Connascence of Timing
Connascence of Value
Connascence of Identity
(c) kevin rutherford 2012
connascence
Connascence of Name
Connascence of Type
Connascence of Meaning
Connascence of Algorithm
Connascence of Position
Connascence of Execution order
Connascence of Timing
Connascence of Value
Connascence of Identity
refactoring should
take the code in
this direction
static code
properties
properties of
running code
(c) kevin rutherford 2012
connascence of name
Two components must agree on the name of something
int count;
count = 10;
public enum Deck {
  SPADES, HEARTS, CLUBS, DIAMONDS
};
card = new Card(3, Deck.HEARTS);
@Override
public String toString() {
  ...
};
(c) kevin rutherford 2012
connascence of type
Two components must agree on the type of something
String var;
var = 10;   // oops!
Writer out = new PrintWriter(f);
@Override
public String toString() {
  ...
};
(c) kevin rutherford 2012
connascence of meaning
Two components must agree on the interpretation of a value
String getSSN() {
  if (ssnIsMissing) {
    return "999­99­9999";
  } else {
    return blah_blah_blah;
  }
}
ssn = getSSN();
if (ssn.equals("999­99­9999")) {
  // handle missing ssn
}
switch (message.getType()) {
case 1:
  return message.sendToAll();
case 2:
  return message.cancel();
default:
  return null;
}
(c) kevin rutherford 2012
connascence of meaning
Two components must agree on the interpretation of a value
String getSSN() {
  if (ssnIsMissing) {
    return "999­99­9999";
  } else {
    return blah_blah_blah;
  }
}
ssn = getSSN();
if (ssn.equals("999­99­9999")) {
  // handle missing ssn
}
switch (message.getType()) {
case 1:
  return message.sendToAll();
case 2:
  return message.cancel();
default:
  return null;
}
(c) kevin rutherford 2012
connascence of algorithm
Two components must agree on a particular algorithm
@Test
public void testFingerprint() {
  String actual = myObj.getFingerprint();
  String expected = DigestUtils.md5Hex(myObj.name);
  assertEquals(expected, actual);
}
(c) kevin rutherford 2012
connascence of position
Two components must be adjacent or occur in a particular order
String names[] = { "Jim", "Helen", "Jenny" };
...
System.out.println("Father: " + names[0]);
System.out.println("Mother: " + names[1]);
System.out.println("Child:  " + names[2]);
Rectangle rect = new Rectangle(23.0, 15.5);
(c) kevin rutherford 2012
connascence of execution order
The order of execution of two components is important
Email email = new Email();
email.setSender(“joe.bloggs”);
//. . .
email.deliver();
(c) kevin rutherford 2012
connascence of timing
Two components must agree on the timing of execution
timeout = 200; // Milliseconds
socket.writeRequest(data);
answer = socket.readResponse(timeout);
(c) kevin rutherford 2012
connascence of value
The values of two components are related
class CircularBuffer {
    private int myHead;
    private int myTail;
    // myHead == myTail    =>  buffer empty
    // myHead+1 == myTail  =>  buffer full
}
(c) kevin rutherford 2012
connascence of identity
Two components must reference the same object
class Producer implements Runnable {
  public static Queue myQueue;
  public void run() {
    myQueue.put(37);
  }
}
class Consumer implements Runnable {
  public void run() {
    int item = Producer.myQueue.get();
    processItem(item);
  }
}
(c) kevin rutherford 2012
connascence of identity
Two components must reference the same object
class Producer implements Runnable {
  public static Queue myQueue;
  public void run() {
    myQueue.put(37);
  }
}
class Consumer implements Runnable {
  public void run() {
    int item = Producer.myQueue.get();
    processItem(item);
  }
}
also connascence
of timing
...and connascence
of type
(c) kevin rutherford 2012
connascence
Connascence of Name
Connascence of Type
Connascence of Meaning
Connascence of Algorithm
Connascence of Position
Connascence of Execution order
Connascence of Timing
Connascence of Value
Connascence of Identity
refactoring should
take the code in
this direction
static code
properties
properties of
running code
(c) kevin rutherford 2012
connascence
Two software 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.
What Every Programmer Should Know About Object Oriented Design,
Meilir Page-Jones, Dorset House Publishing, 1996
Fundamentals of Object-Oriented Design in UML,
Meilir Page-Jones, Addison-Wesley, 1999
(c) kevin rutherford 2012
connascence
Two software 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.
http://onestepback.org/articles/connascence/index.html
Jim Weirich
Connascence as a software design metric
http://blog.rubybestpractices.com/posts/gregory/056-issue-24-connascence.html
Gregory Brown
Grand unified theory of software design,
http://vimeo.com/10837903
Jim Weirich

Weitere ähnliche Inhalte

Was ist angesagt?

Эрүүгийн хууль /шинэчилсэн найруулга/
Эрүүгийн хууль /шинэчилсэн найруулга/Эрүүгийн хууль /шинэчилсэн найруулга/
Эрүүгийн хууль /шинэчилсэн найруулга/Ganzorig Myagmarsuren
 
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэг
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэгЦахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэг
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэгGanzorig Myagmarsuren
 
Lecture 15&16
Lecture 15&16Lecture 15&16
Lecture 15&16narachka
 
Ogogdliin sangiin zohion baiguulalt lekts
Ogogdliin sangiin zohion baiguulalt lektsOgogdliin sangiin zohion baiguulalt lekts
Ogogdliin sangiin zohion baiguulalt lektsАлдарболд Э.
 
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухай
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухайорлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухай
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухайBayasaa Хөгжилтэй амьдрал
 
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГА
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГАЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГА
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГАUmguullin Mongol Umguulugch
 
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүд
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүдҮндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүд
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүдБаярсайхан Л
 
Windows үйлдлийн систем
Windows үйлдлийн системWindows үйлдлийн систем
Windows үйлдлийн системBaaya Badrakh
 
Excel function
Excel functionExcel function
Excel functionOnon Tuul
 
шугаман алгебр
шугаман  алгебршугаман  алгебр
шугаман алгебрJugii Juldiz
 

Was ist angesagt? (20)

Лекц 9(Заагч)
Лекц 9(Заагч)Лекц 9(Заагч)
Лекц 9(Заагч)
 
Эрүүгийн хууль /шинэчилсэн найруулга/
Эрүүгийн хууль /шинэчилсэн найруулга/Эрүүгийн хууль /шинэчилсэн найруулга/
Эрүүгийн хууль /шинэчилсэн найруулга/
 
java surah bichig
java surah bichigjava surah bichig
java surah bichig
 
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэг
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэгЦахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэг
Цахим мэдээллийн аюулгүй байдлын эсрэг гэмт хэрэг
 
Lesson 7
Lesson 7Lesson 7
Lesson 7
 
Lecture 15&16
Lecture 15&16Lecture 15&16
Lecture 15&16
 
Ogogdliin sangiin zohion baiguulalt lekts
Ogogdliin sangiin zohion baiguulalt lektsOgogdliin sangiin zohion baiguulalt lekts
Ogogdliin sangiin zohion baiguulalt lekts
 
хүний эрх гэж юу в1
хүний эрх гэж юу в1хүний эрх гэж юу в1
хүний эрх гэж юу в1
 
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухай
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухайорлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухай
орлого ба хөрөнгийн татварыг давхардуулан ногдуулахгүй байх тухай
 
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГА
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГАЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГА
ЭРҮҮГИЙН ХУУЛЬД НЭМЭЛТ, ӨӨРЧЛӨЛТ ОРУУЛАХ ТУХАЙ ХУУЛИЙН ТӨСЛИЙН ТАНИЛЦУУЛГА
 
S.ps553
S.ps553S.ps553
S.ps553
 
оут 4
оут 4оут 4
оут 4
 
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүд
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүдҮндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүд
Үндсэн төхөөрөмж ба дагалдах, нэмэлт төхөөрөмжүүд
 
Instruction sets
Instruction setsInstruction sets
Instruction sets
 
Windows үйлдлийн систем
Windows үйлдлийн системWindows үйлдлийн систем
Windows үйлдлийн систем
 
Excel function
Excel functionExcel function
Excel function
 
шугаман алгебр
шугаман  алгебршугаман  алгебр
шугаман алгебр
 
Barimt bichgiin ergelt
Barimt bichgiin ergeltBarimt bichgiin ergelt
Barimt bichgiin ergelt
 
Adobe photoshop cs
Adobe photoshop csAdobe photoshop cs
Adobe photoshop cs
 
Ood lesson4
Ood lesson4Ood lesson4
Ood lesson4
 

Andere mochten auch

A better way to learn refactoring
A better way to learn refactoringA better way to learn refactoring
A better way to learn refactoringRafael Sperling
 
The Building Blocks Of Modularity
The Building Blocks Of ModularityThe Building Blocks Of Modularity
The Building Blocks Of ModularityLittleBIGRuby
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet
 
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopPuppet
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development WorkflowJeffery Smith
 
Devops, Dungeons & Dragons
Devops, Dungeons & Dragons Devops, Dungeons & Dragons
Devops, Dungeons & Dragons David Lutz
 
Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Aaron Bernstein
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Puppet
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of PackerFreyr Lin
 
Designing with capabilities (DDD-EU 2017)
Designing with capabilities (DDD-EU 2017)Designing with capabilities (DDD-EU 2017)
Designing with capabilities (DDD-EU 2017)Scott Wlaschin
 
Contagious Messages
Contagious MessagesContagious Messages
Contagious MessageskarenMoyse
 
Compresent pyramid by coon
Compresent pyramid by coonCompresent pyramid by coon
Compresent pyramid by coonCoon Chaiyapruk
 
Recommendation From ABC Industries 2014
Recommendation From ABC Industries 2014Recommendation From ABC Industries 2014
Recommendation From ABC Industries 2014Boyd Breeding
 

Andere mochten auch (20)

A better way to learn refactoring
A better way to learn refactoringA better way to learn refactoring
A better way to learn refactoring
 
Connascence hunting
Connascence huntingConnascence hunting
Connascence hunting
 
The Building Blocks Of Modularity
The Building Blocks Of ModularityThe Building Blocks Of Modularity
The Building Blocks Of Modularity
 
Code smells
Code smellsCode smells
Code smells
 
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet ModulesPuppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
Puppet Camp Atlanta 2014: Continuous Deployment of Puppet Modules
 
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet ModulePuppet Camp Sydney 2015: The (Im)perfect Puppet Module
Puppet Camp Sydney 2015: The (Im)perfect Puppet Module
 
Using Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & HadoopUsing Vagrant, Puppet, Testing & Hadoop
Using Vagrant, Puppet, Testing & Hadoop
 
Puppet Development Workflow
Puppet Development WorkflowPuppet Development Workflow
Puppet Development Workflow
 
Devops, Dungeons & Dragons
Devops, Dungeons & Dragons Devops, Dungeons & Dragons
Devops, Dungeons & Dragons
 
Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)Puppet - Configuration Management Made Eas(ier)
Puppet - Configuration Management Made Eas(ier)
 
Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014Writing and Publishing Puppet Modules - PuppetConf 2014
Writing and Publishing Puppet Modules - PuppetConf 2014
 
Docker
Docker Docker
Docker
 
A Introduction of Packer
A Introduction of PackerA Introduction of Packer
A Introduction of Packer
 
Docker internals
Docker internalsDocker internals
Docker internals
 
Designing with capabilities (DDD-EU 2017)
Designing with capabilities (DDD-EU 2017)Designing with capabilities (DDD-EU 2017)
Designing with capabilities (DDD-EU 2017)
 
Penal especial
Penal especialPenal especial
Penal especial
 
Contagious Messages
Contagious MessagesContagious Messages
Contagious Messages
 
Compresent pyramid by coon
Compresent pyramid by coonCompresent pyramid by coon
Compresent pyramid by coon
 
Recommendation From ABC Industries 2014
Recommendation From ABC Industries 2014Recommendation From ABC Industries 2014
Recommendation From ABC Industries 2014
 
insect legs
insect legsinsect legs
insect legs
 

Ähnlich wie Connascence

Cleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsCleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsDebora Gomez Bertoli
 
Make A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkMake A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkYodalee
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRSNeil Robbins
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer iiIsabella789
 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 QuizzesSteven Luo
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the raceVictor_Cr
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testingFoundationDB
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupDror Helper
 
a data driven game object system
a data driven game object systema data driven game object system
a data driven game object systemmaa77
 
Refactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of SoftwareRefactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of SoftwareCodeOps Technologies LLP
 
Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design SimpleClean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design SimpleLemi Orhan Ergin
 
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Junha Jang
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutionsbenewu
 

Ähnlich wie Connascence (16)

Cleaning your architecture with android architecture components
Cleaning your architecture with android architecture componentsCleaning your architecture with android architecture components
Cleaning your architecture with android architecture components
 
Make A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst FrameworkMake A Shoot ‘Em Up Game with Amethyst Framework
Make A Shoot ‘Em Up Game with Amethyst Framework
 
An Introduction To CQRS
An Introduction To CQRSAn Introduction To CQRS
An Introduction To CQRS
 
JAVASCRIPT CHEAT SHEET PDF
JAVASCRIPT CHEAT SHEET PDFJAVASCRIPT CHEAT SHEET PDF
JAVASCRIPT CHEAT SHEET PDF
 
Object discovery
Object discoveryObject discovery
Object discovery
 
1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii1z0 804 exam-java se 7 programmer ii
1z0 804 exam-java se 7 programmer ii
 
Java level 1 Quizzes
Java level 1 QuizzesJava level 1 Quizzes
Java level 1 Quizzes
 
Legacy projects: how to win the race
Legacy projects: how to win the raceLegacy projects: how to win the race
Legacy projects: how to win the race
 
Deterministic simulation testing
Deterministic simulation testingDeterministic simulation testing
Deterministic simulation testing
 
Navigating the xDD Alphabet Soup
Navigating the xDD Alphabet SoupNavigating the xDD Alphabet Soup
Navigating the xDD Alphabet Soup
 
a data driven game object system
a data driven game object systema data driven game object system
a data driven game object system
 
Refactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of SoftwareRefactoring & Restructuring - Improving the Code and Structure of Software
Refactoring & Restructuring - Improving the Code and Structure of Software
 
Clean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design SimpleClean Software Design: The Practices to Make The Design Simple
Clean Software Design: The Practices to Make The Design Simple
 
Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시Java 스터디 강의자료 - 1차시
Java 스터디 강의자료 - 1차시
 
Unit test candidate solutions
Unit test candidate solutionsUnit test candidate solutions
Unit test candidate solutions
 
Import java
Import javaImport java
Import java
 

Mehr von 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
 
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
 
Agile principles
Agile principlesAgile principles
Agile principles
 
Flow
FlowFlow
Flow
 

Kürzlich hochgeladen

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 

Kürzlich hochgeladen (20)

How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 

Connascence

  • 1. (c) kevin rutherford 2012 describing the internal quality of software @kevinrutherford
  • 2. (c) kevin rutherford 2012 code smells Primitive Obsession Feature Envy Sim ulated Polym orphismLazy Class Temporary Field Inappropriate Intimacy ShotgunSurgery Data Clump Long M ethod Large Class RefusedBequest
  • 3. (c) kevin rutherford 2012 code smells Primitive Obsession Feature Envy Sim ulated Polym orphismLazy Class Temporary Field Inappropriate Intimacy ShotgunSurgery Data Clump Long M ethod Large Class ??? ??? ??? ??? ??? ??? ??? RefusedBequest
  • 4. (c) kevin rutherford 2012 connascence Two software 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.
  • 5. (c) kevin rutherford 2012 connascence Connascence of Name Connascence of Type Connascence of Meaning Connascence of Algorithm Connascence of Position Connascence of Execution order Connascence of Timing Connascence of Value Connascence of Identity
  • 6. (c) kevin rutherford 2012 connascence Connascence of Name Connascence of Type Connascence of Meaning Connascence of Algorithm Connascence of Position Connascence of Execution order Connascence of Timing Connascence of Value Connascence of Identity refactoring should take the code in this direction static code properties properties of running code
  • 7. (c) kevin rutherford 2012 connascence of name Two components must agree on the name of something int count; count = 10; public enum Deck {   SPADES, HEARTS, CLUBS, DIAMONDS }; card = new Card(3, Deck.HEARTS); @Override public String toString() {   ... };
  • 8. (c) kevin rutherford 2012 connascence of type Two components must agree on the type of something String var; var = 10;   // oops! Writer out = new PrintWriter(f); @Override public String toString() {   ... };
  • 9. (c) kevin rutherford 2012 connascence of meaning Two components must agree on the interpretation of a value String getSSN() {   if (ssnIsMissing) {     return "999­99­9999";   } else {     return blah_blah_blah;   } } ssn = getSSN(); if (ssn.equals("999­99­9999")) {   // handle missing ssn } switch (message.getType()) { case 1:   return message.sendToAll(); case 2:   return message.cancel(); default:   return null; }
  • 10. (c) kevin rutherford 2012 connascence of meaning Two components must agree on the interpretation of a value String getSSN() {   if (ssnIsMissing) {     return "999­99­9999";   } else {     return blah_blah_blah;   } } ssn = getSSN(); if (ssn.equals("999­99­9999")) {   // handle missing ssn } switch (message.getType()) { case 1:   return message.sendToAll(); case 2:   return message.cancel(); default:   return null; }
  • 11. (c) kevin rutherford 2012 connascence of algorithm Two components must agree on a particular algorithm @Test public void testFingerprint() {   String actual = myObj.getFingerprint();   String expected = DigestUtils.md5Hex(myObj.name);   assertEquals(expected, actual); }
  • 12. (c) kevin rutherford 2012 connascence of position Two components must be adjacent or occur in a particular order String names[] = { "Jim", "Helen", "Jenny" }; ... System.out.println("Father: " + names[0]); System.out.println("Mother: " + names[1]); System.out.println("Child:  " + names[2]); Rectangle rect = new Rectangle(23.0, 15.5);
  • 13. (c) kevin rutherford 2012 connascence of execution order The order of execution of two components is important Email email = new Email(); email.setSender(“joe.bloggs”); //. . . email.deliver();
  • 14. (c) kevin rutherford 2012 connascence of timing Two components must agree on the timing of execution timeout = 200; // Milliseconds socket.writeRequest(data); answer = socket.readResponse(timeout);
  • 15. (c) kevin rutherford 2012 connascence of value The values of two components are related class CircularBuffer {     private int myHead;     private int myTail;     // myHead == myTail    =>  buffer empty     // myHead+1 == myTail  =>  buffer full }
  • 16. (c) kevin rutherford 2012 connascence of identity Two components must reference the same object class Producer implements Runnable {   public static Queue myQueue;   public void run() {     myQueue.put(37);   } } class Consumer implements Runnable {   public void run() {     int item = Producer.myQueue.get();     processItem(item);   } }
  • 17. (c) kevin rutherford 2012 connascence of identity Two components must reference the same object class Producer implements Runnable {   public static Queue myQueue;   public void run() {     myQueue.put(37);   } } class Consumer implements Runnable {   public void run() {     int item = Producer.myQueue.get();     processItem(item);   } } also connascence of timing ...and connascence of type
  • 18. (c) kevin rutherford 2012 connascence Connascence of Name Connascence of Type Connascence of Meaning Connascence of Algorithm Connascence of Position Connascence of Execution order Connascence of Timing Connascence of Value Connascence of Identity refactoring should take the code in this direction static code properties properties of running code
  • 19. (c) kevin rutherford 2012 connascence Two software 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. What Every Programmer Should Know About Object Oriented Design, Meilir Page-Jones, Dorset House Publishing, 1996 Fundamentals of Object-Oriented Design in UML, Meilir Page-Jones, Addison-Wesley, 1999
  • 20. (c) kevin rutherford 2012 connascence Two software 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. http://onestepback.org/articles/connascence/index.html Jim Weirich Connascence as a software design metric http://blog.rubybestpractices.com/posts/gregory/056-issue-24-connascence.html Gregory Brown Grand unified theory of software design, http://vimeo.com/10837903 Jim Weirich