SlideShare uma empresa Scribd logo
1 de 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

Mais conteúdo relacionado

Mais procurados

Hard Disk(prezentacija)
Hard Disk(prezentacija)Hard Disk(prezentacija)
Hard Disk(prezentacija)Darkobrt
 
Ficha de trabalho 1- Avarias mais comuns de um computador
Ficha de trabalho 1- Avarias mais comuns de um computador Ficha de trabalho 1- Avarias mais comuns de um computador
Ficha de trabalho 1- Avarias mais comuns de um computador Baguiasri
 
описание и технически параметри на компютърна система
описание и технически параметри на компютърна системаописание и технически параметри на компютърна система
описание и технически параметри на компютърна системаПетя Газдова
 
Інформатика 8 клас. Казанцева О.П.
Інформатика 8 клас. Казанцева О.П.Інформатика 8 клас. Казанцева О.П.
Інформатика 8 клас. Казанцева О.П.Nikolay Shaygorodskiy
 
Unutarnji dijelovi računala 1
Unutarnji dijelovi računala 1Unutarnji dijelovi računala 1
Unutarnji dijelovi računala 1LovroBevanda
 
Uticaj komponennata na performanske racunara
Uticaj komponennata na performanske racunaraUticaj komponennata na performanske racunara
Uticaj komponennata na performanske racunaraNatasa Pantovic
 
Компьютерийн бүтэц, зохион байгуулалт №1-2
Компьютерийн  бүтэц, зохион байгуулалт №1-2Компьютерийн  бүтэц, зохион байгуулалт №1-2
Компьютерийн бүтэц, зохион байгуулалт №1-2EnkhjargalDashdorjEn
 
Microprocessador e barramentos
Microprocessador e barramentos Microprocessador e barramentos
Microprocessador e barramentos Tiago Vieira
 
Komponente hardvera pc a
Komponente hardvera pc aKomponente hardvera pc a
Komponente hardvera pc aOlga Klisura
 
Introdução à Informática
Introdução à InformáticaIntrodução à Informática
Introdução à Informáticavanessa.barros
 
Unidade II - hardware
Unidade II -  hardwareUnidade II -  hardware
Unidade II - hardwareDaniel Moura
 
Arquitetura de Computadores
Arquitetura de ComputadoresArquitetura de Computadores
Arquitetura de ComputadoresMayara Oliveira
 

Mais procurados (20)

UEFI HTTP/HTTPS Boot
UEFI HTTP/HTTPS BootUEFI HTTP/HTTPS Boot
UEFI HTTP/HTTPS Boot
 
Hard Disk(prezentacija)
Hard Disk(prezentacija)Hard Disk(prezentacija)
Hard Disk(prezentacija)
 
Ficha de trabalho 1- Avarias mais comuns de um computador
Ficha de trabalho 1- Avarias mais comuns de um computador Ficha de trabalho 1- Avarias mais comuns de um computador
Ficha de trabalho 1- Avarias mais comuns de um computador
 
Лекц 1
Лекц 1Лекц 1
Лекц 1
 
Sistemas Operacionais
Sistemas OperacionaisSistemas Operacionais
Sistemas Operacionais
 
Lvm advanced topics
Lvm advanced topicsLvm advanced topics
Lvm advanced topics
 
Interrupts
InterruptsInterrupts
Interrupts
 
описание и технически параметри на компютърна система
описание и технически параметри на компютърна системаописание и технически параметри на компютърна система
описание и технически параметри на компютърна система
 
Інформатика 8 клас. Казанцева О.П.
Інформатика 8 клас. Казанцева О.П.Інформатика 8 клас. Казанцева О.П.
Інформатика 8 клас. Казанцева О.П.
 
Lec03 concurrency (2)
Lec03 concurrency (2)Lec03 concurrency (2)
Lec03 concurrency (2)
 
Montagem computadores
Montagem computadoresMontagem computadores
Montagem computadores
 
Unutarnji dijelovi računala 1
Unutarnji dijelovi računala 1Unutarnji dijelovi računala 1
Unutarnji dijelovi računala 1
 
Uticaj komponennata na performanske racunara
Uticaj komponennata na performanske racunaraUticaj komponennata na performanske racunara
Uticaj komponennata na performanske racunara
 
Компьютерийн бүтэц, зохион байгуулалт №1-2
Компьютерийн  бүтэц, зохион байгуулалт №1-2Компьютерийн  бүтэц, зохион байгуулалт №1-2
Компьютерийн бүтэц, зохион байгуулалт №1-2
 
Microprocessador e barramentos
Microprocessador e barramentos Microprocessador e barramentos
Microprocessador e barramentos
 
Komponente hardvera pc a
Komponente hardvera pc aKomponente hardvera pc a
Komponente hardvera pc a
 
Introdução à Informática
Introdução à InformáticaIntrodução à Informática
Introdução à Informática
 
Unidade II - hardware
Unidade II -  hardwareUnidade II -  hardware
Unidade II - hardware
 
Arquitetura de Computadores
Arquitetura de ComputadoresArquitetura de Computadores
Arquitetura de Computadores
 
oogiigiin lects
oogiigiin lectsoogiigiin lects
oogiigiin lects
 

Destaque

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
 

Destaque (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
 

Semelhante a Software Quality Code Smells

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
 

Semelhante a Software Quality Code Smells (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
 

Mais de 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
 

Último

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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise 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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
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
 
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
 
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
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 

Último (20)

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
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
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...
 
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
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 

Software Quality Code Smells

  • 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