SlideShare una empresa de 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

Más contenido relacionado

La actualidad más candente

유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기flashscope
 
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmedБямбаа Авирмэд
 
File shahah zadlah hicheel
File shahah zadlah hicheelFile shahah zadlah hicheel
File shahah zadlah hicheeldajaaaaaa
 
빌드관리 및 디버깅 (2010년 자료)
빌드관리 및 디버깅 (2010년 자료)빌드관리 및 디버깅 (2010년 자료)
빌드관리 및 디버깅 (2010년 자료)YEONG-CHEON YOU
 
05_Reliable UDP 구현
05_Reliable UDP 구현05_Reliable UDP 구현
05_Reliable UDP 구현noerror
 
алгоритм шинжилгээ зохиомж
алгоритм шинжилгээ зохиомжалгоритм шинжилгээ зохиомж
алгоритм шинжилгээ зохиомжMijiddorj Renchin-Ochir
 
서버와 클라이언트 같은 엔진 사용하기
서버와 클라이언트 같은 엔진 사용하기서버와 클라이언트 같은 엔진 사용하기
서버와 클라이언트 같은 엔진 사용하기YEONG-CHEON YOU
 
Техник хангамж
Техник хангамжТехник хангамж
Техник хангамжTogtuun B
 
[데브루키] 이벤트 드리븐 아키텍쳐
[데브루키] 이벤트 드리븐 아키텍쳐[데브루키] 이벤트 드리븐 아키텍쳐
[데브루키] 이벤트 드리븐 아키텍쳐MinGeun Park
 
Multithread & shared_ptr
Multithread & shared_ptrMultithread & shared_ptr
Multithread & shared_ptr내훈 정
 
Baagii test
Baagii testBaagii test
Baagii testamgaa97
 
『게임 매니악스 액션 게임 알고리즘』 - 미리보기
『게임 매니악스 액션 게임 알고리즘』 - 미리보기『게임 매니악스 액션 게임 알고리즘』 - 미리보기
『게임 매니악스 액션 게임 알고리즘』 - 미리보기복연 이
 
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmedБямбаа Авирмэд
 
Eronhii emchiin jishig soril 5
Eronhii emchiin jishig soril 5Eronhii emchiin jishig soril 5
Eronhii emchiin jishig soril 5Gantulga Nyamdorj
 
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템Chaeone Son
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기MinGeun Park
 

La actualidad más candente (20)

유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기유니티에서 MMD 사용해보기
유니티에서 MMD 사용해보기
 
800.mn 2014 mathematics c by byambaa avirmed
800.mn   2014 mathematics c by byambaa avirmed800.mn   2014 mathematics c by byambaa avirmed
800.mn 2014 mathematics c by byambaa avirmed
 
800.mn 2012 phisics b by byambaa avirmed
800.mn   2012 phisics b by byambaa avirmed800.mn   2012 phisics b by byambaa avirmed
800.mn 2012 phisics b by byambaa avirmed
 
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed
800.mn - 2012 Математик ЭЕШ хувилбар Б by byambaa avirmed
 
File shahah zadlah hicheel
File shahah zadlah hicheelFile shahah zadlah hicheel
File shahah zadlah hicheel
 
빌드관리 및 디버깅 (2010년 자료)
빌드관리 및 디버깅 (2010년 자료)빌드관리 및 디버깅 (2010년 자료)
빌드관리 및 디버깅 (2010년 자료)
 
05_Reliable UDP 구현
05_Reliable UDP 구현05_Reliable UDP 구현
05_Reliable UDP 구현
 
алгоритм шинжилгээ зохиомж
алгоритм шинжилгээ зохиомжалгоритм шинжилгээ зохиомж
алгоритм шинжилгээ зохиомж
 
6 9 -r angi
6 9 -r angi6 9 -r angi
6 9 -r angi
 
서버와 클라이언트 같은 엔진 사용하기
서버와 클라이언트 같은 엔진 사용하기서버와 클라이언트 같은 엔진 사용하기
서버와 클라이언트 같은 엔진 사용하기
 
Техник хангамж
Техник хангамжТехник хангамж
Техник хангамж
 
[데브루키] 이벤트 드리븐 아키텍쳐
[데브루키] 이벤트 드리븐 아키텍쳐[데브루키] 이벤트 드리븐 아키텍쳐
[데브루키] 이벤트 드리븐 아키텍쳐
 
Multithread & shared_ptr
Multithread & shared_ptrMultithread & shared_ptr
Multithread & shared_ptr
 
Baagii test
Baagii testBaagii test
Baagii test
 
『게임 매니악스 액션 게임 알고리즘』 - 미리보기
『게임 매니악스 액션 게임 알고리즘』 - 미리보기『게임 매니악스 액션 게임 알고리즘』 - 미리보기
『게임 매니악스 액션 게임 알고리즘』 - 미리보기
 
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed
800.mn - 2013 Математик ЭЕШ хувилбар С by byambaa avirmed
 
Eronhii emchiin jishig soril 5
Eronhii emchiin jishig soril 5Eronhii emchiin jishig soril 5
Eronhii emchiin jishig soril 5
 
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템
ndc 2017 어쩌다 신입 - 초보 게임 개발자 2년 간의 포스트모템
 
Computer
ComputerComputer
Computer
 
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
[150124 박민근] 모바일 게임 개발에서 루아 스크립트 활용하기
 

Destacado

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
 

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

Similar 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
 

Similar 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
 

Más 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

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 

Último (20)

WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 

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