SlideShare une entreprise Scribd logo
1  sur  56
Télécharger pour lire hors ligne
Leganés!
6-7 Febrero 2013!

David Gómez G.

@dgomezg

Measuring Code Quality: WTF/min
Code from the real world that could give you a stroke
and some advices to not replicate them.

Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0/
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

2
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Quality CODE
RELATED CONCEPTS

3
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

4

http://www.osnews.com/story/19266/WTFs_m
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

CODE SMELL
A surface indication
that usually
corresponds to a
deeper problem in the
system
Term coined by Kent Beck
5
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Some Misconceptions
You write code for a computer to read
You write code to be read by a developer maintaining your
code. The computer reads the compiled code
Writing smart code, you will improve performance
Developers spend most of the time writing code
Developers spend most of time reading code
6
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Some Misconceptions
You write code for a computer to read
You write code to be read by a developer maintaining your
code. The computer reads the compiled code
Writing smart code, you will improve performance
Developers spend most of the time writing code
Developers spend most of time reading code
6
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Some Misconceptions
You write code for a computer to read
You write code to be read by a developer maintaining your
code. The computer reads the compiled code
Writing smart code, you will improve performance
Developers spend most of the time writing code
Developers spend most of time reading code
6
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Some Misconceptions
You write code for a computer to read
You write code to be read by a developer maintaining your
code. The computer reads the compiled code
Writing smart code, you will improve performance
Developers spend most of the time writing code
Developers spend most of time reading code
6
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Examples of real code
from the real world

7
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

8
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

The following code
has been modified slightly
to protect anonymity
of authors
!

but always respect the original idea
(although it could be difficult to believe)
9
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

COMMENTS
Comments are useful, but

/*        */
Only if they add information
or if they explain the code

Don’t describe what the code is doing
Explain why (pre/post-conditions)

Use cases (for methods/types/functions)

10
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

COMMENTS: Unuseful info

@dgomezg

/*        */
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

COMMENTS: Unuseful info

/*        */
	 /**	
	
* Método get Disponibilidad.	
	
* 	
	
* @return Returns the disponibilidad.	
	
*/	
	 public String getDisponibilidad() {	

//
//

	 }

We will get back to the implementation detail	
More fun later
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

COMMENTS: Unuseful info

@dgomezg

/*        */
  
  
!
  
  
  
  
  
  
  
  

/**  Atributo  codCircuito.  */  
private  String  codCircuito;  

/**  
  *  Método  get  codCircuito.  
  *    
  *  @return  String  
  */  
public  String  getCodCircuito()  {  
   return  codCircuito;  
}  
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

COMMENTS:
Remember to sign your code

/*        */
////////////////////////Manuela  
Logger  log  =  LoggerFactory.getLogger(MyClass.class.getName());  
////////////////////////
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

COMMENTS:
A good marketing tool

/*        */
/** 	
* This method removes all selected files	
*
	
* Returns a jQuery collection of all affected elements.
*
	
* @name reset
	
* @type jQuery
	
* @author Daniel B. ( http://www.visit-my-web.com/) 	
*
	
*/ 	
reset: function(){
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

COMMENTS:
FOOL THE code READEr

@dgomezg

/*        */
//

Producto p = null;	
List prod = null;	
List listaElementos = new ArrayList();	
	
if (nElements > 80) {	
	 cmd.setOrden(Producto.SELECT_POR_TIPO);	
	 l = new ListParam();	
	 l.add(new Integer(idTipoProducto));	
l.add(new Integer(idCategoria));	

* for the trick to work out, keep the indentation
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Exceptions
Exceptions are just that: Exceptions
Catch only if you can handle it
Declare the exact type
Don’t use for:
Flow Control
State demarcation (other than Error)
17
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Exceptions: Simply retrowing
public  static  Class  cargaClase(java.lang.String  pnombreClase)  
                throws  ClassNotFoundException  {  
        ClassLoader  oloader  =  new  ClasesUtil().getClass()  
.getClassLoader();  
        try  {  
                return  oloader  !=  null  ?    
                   oloader.loadClass(pnombreClase)    
                   :  Class.forName(pnombreClase);  
        }  catch  (ClassNotFoundException  x)  {                        
                throw  x;  
        }  
}
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

Exceptions: NPE PARANOIA

@dgomezg

It’s better to check twice to avoid a NullPointerException
  
  
  

while  (session  !=  null)  {  
   numSessions++  ;  
   if  (session  !=  null)  {  
      ...  
}  
...  
}  
  
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Exceptions: NPE PARANOIA

It’s better to check twice to avoid a NullPointerException
	
	
	
	
	
	
	
	
	

while (session != null) {	
	 numSessions++ ;	
	 if (session != null) {	
	 	 //....	
	 } else {	
	 	 log.warn("Null session detected.” +	
“ Starting session Synchronization");	
	 	 //.... dead code follows...	
	 }	
}

extra points if
you add ‘dead code’ to the else block
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Exceptions: Flow Control
public  class  ProcesoTerminadoCorrectamenteException               
              extends  Exception  {  
!
}  

Man!
When a process which right ends is an exception…
That’s a good confidence in your system!
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

NAMING
Use descriptive names
Describe what a Class/function/method does,
not what it means
Describe what a variable/attribute holds
Don’t use abbreviations
Code for readability
22
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

NAMING: What does this method do?
        if(  p  !=  null){  
                applyBusinessLogic(p,estado,manager);  
        }

  
  
  
  

public  void  onButtonPressed(ActionEvent  e)  {  
   FormData  formData  =  parseFromEvent(e);  
   theAlgorithm(formData);  
}  

23
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code
Developers should be lazy
Don’t write code you don’t need
Don’t repeat yourself

24
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code:
Wrapping well-known APIs
public  static  String  substringBefore(String  str,String  separator)  {  
        return  (org.apache.commons.lang.StringUtils  
.substringBefore(str,  separator));  
}  

25
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code:
Wrapping well-known APIs
  
  
  
  
  
  
  

public  String  getPropiedad(String  clave)  {  
   return  wrappedCacheAdmin.getProperty(clave);  
}  
  
public  void  setClaseAlgoritmo(String  clase)  {  
   wrappedCacheAdmin.setAlgorithmClass(clase);  
}  

26
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code: Clever? Code
        /**  La  constante  CERO.  */  
        public  static  final  int  CERO=0;  
          
        /**  La  constante  UNO.  */  
        public  static  final  int  UNO=1;  
          
        /**  La  constante  DOS.  */  
        public  static  final  int  DOS=2;  
          
        /**  La  constante  TRES.  */  
        public  static  final  int  TRES=3;  

27
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code: Clever? Code
Challenge:
Could you tell what will print the following code?
  

  

System.out.println(DOS  *  TRES);

28
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

2K Effect… We miss you!
NODO 1

!
# Planificacion Procesos Batch
# (Formato ss mm hh dd MM yyyy)
NODO 3
#
cron.sync=0 00 15 * * ? !
# Planificacion Procesos Batch
cron.download=0 00 23 * * ? 2030
NODO 4
# (Formato ss mm hh dd MM yyyy)
cron.reports=0 00 23 * * ? 2030
!
#
!
cron.sync=0 00 16 * * ?
# Planificacion Procesos Batch
cron.download=0 00 03 * * ? 2030
# (Formato ss mm hh dd MM yyyy)
cron.reports=0 00 03 * * ? 2030
#
cron.sync=0 00 12 * * ?
cron.download=0 00 12 * * 2030
cron.reports=0 00 12 * * 2030

29
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code: SOP
Introducing SOP: String Oriented Programming
	
	
	
	
	
	
	
	
	
	

/**	
* Método get Disponibilidad.	
* 	
* @return Returns the disponibilidad.	
*/	
public String getDisponibilidad() {	
	 if (numeroPuestos == 0)	
	 	 return "No";	
	 else return "Si";	
}
30
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

UnNecessary code:
TAKING ADVICE TOO SERIOUSLY
String concatenation in Java is not recommended.
Use StringBuffer or StringBuilder instead
StringBuffer hql = 	
new StringBuffer(	
"select distinct config from Config config ");	
	 Query query = session.createQuery(hql.toString()) ;	

Don’t push the recommendations to the limits!!!

31
Leganés!
6-7 Febrero 2014

@dgomezg

Measuring Code Quality: WTF/min

UnNecessary code:
The indentation MADNESS
        
        
        
        
        
        
        
        
        
        
        
        
          ]  
   });  
});  

  
  
  
  
  
  
  
  
  
  
  
},  

  
  
  
  
  
  
  
  
  
  
}  

  
  
  
  
  
  
  
  
  
]  

  
  
  
  
  
  
  
  
}  

  
  
  
  
  
  
  
}  

     
     
     
     
     
      }  
});  

     
     
     
     
});  

            }  
      });  
   }  
}  

32
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

DESIGN PRICIPLES

33
Leganés!
6-7 Febrero 2014

@dgomezg

Measuring Code Quality: WTF/min

K IS S
EEP

T

IMPLE

TUPID!
34
Leganés!
6-7 Febrero 2014

@dgomezg

Measuring Code Quality: WTF/min

D R Y
on’t

epeat

ourself
35
Leganés!
6-7 Febrero 2014

@dgomezg

Measuring Code Quality: WTF/min

S OC
eparation

F

oncerns
36
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

I:I

@dgomezg

!
!
!
!
!

SEPARATION OF CONCERNS
DON’T REPEAT YOURSELF
37
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

ENSURING CODE QUALITY:
THE QUALITY CYCLE

38
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Default Quality Cycle

39
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Add Intermediate Quality Checks

40
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Automate Intermediate Checks

41
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Measure with tools

42
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Define Business Key Indicators

43
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Define Alarms

44
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Get a Dashboard

45
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Added Value: keeping everybody happy

46
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

SOME FINAL ADVICES

47
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Read! Keep your brain healthy
Clean Code:
Robert Martin (@unclebob)

48
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

No Monkeys, No Lizards
Be concious, be consequent

www.adictosaltrabajo.com/detalle-­‐noticia.php?noticia=356

49
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

THe Software RUSTING principle
The software degrades slowly and slightly as
time passes…
Sometimes is not slowly neither slightly!!

50
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

The boy scout rule
Try and leave this world a little
better than you found it, and when
your turn comes to die you can die
happy in feeling that at any rate
you have not wasted your time but
have done your best.
Robert Stephenson Smyth Baden-Powell
51
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Always code as if the
person who ends up
maintaining your code is
a violent psychopath who
knows where you live.
John F. Woods, September 1991

52
Leganés!
6-7 Febrero 2014

Measuring Code Quality: WTF/min

@dgomezg

Always code as if the
person who ends up
maintaining your code is
a violent psychopath who
knows where you live.
John F. Woods, September 1991
////////////////////////Manuela  
Logger  log  =  LogFactory.getLogger(MyClass.class.getName());  
////////////////////////
53

Contenu connexe

En vedette

How to become a better developer?
How to become a better developer?How to become a better developer?
How to become a better developer?Polcode
 
Patrón Decorator
Patrón DecoratorPatrón Decorator
Patrón DecoratorAutentia
 
Design Patterns / Patrones de Diseño
Design Patterns / Patrones de DiseñoDesign Patterns / Patrones de Diseño
Design Patterns / Patrones de DiseñoAutentia
 
Patrón Façade
Patrón FaçadePatrón Façade
Patrón FaçadeAutentia
 
Presentación open closed principle
Presentación open closed principlePresentación open closed principle
Presentación open closed principleAutentia
 
Patrones estructurales
Patrones estructuralesPatrones estructurales
Patrones estructuralesAutentia
 
Patrón Observer
Patrón ObserverPatrón Observer
Patrón ObserverAutentia
 
Nativescript
NativescriptNativescript
NativescriptAutentia
 
Factory method
Factory methodFactory method
Factory methodAutentia
 
Patrones de creación
Patrones de creaciónPatrones de creación
Patrones de creaciónAutentia
 
Patrones de diseño: Polimorfismo
Patrones de diseño: PolimorfismoPatrones de diseño: Polimorfismo
Patrones de diseño: PolimorfismoAutentia
 

En vedette (14)

How to become a better developer?
How to become a better developer?How to become a better developer?
How to become a better developer?
 
Patrón Decorator
Patrón DecoratorPatrón Decorator
Patrón Decorator
 
Design Patterns / Patrones de Diseño
Design Patterns / Patrones de DiseñoDesign Patterns / Patrones de Diseño
Design Patterns / Patrones de Diseño
 
Patrón Façade
Patrón FaçadePatrón Façade
Patrón Façade
 
Presentación open closed principle
Presentación open closed principlePresentación open closed principle
Presentación open closed principle
 
Patrones estructurales
Patrones estructuralesPatrones estructurales
Patrones estructurales
 
Patrones Creacionales
Patrones CreacionalesPatrones Creacionales
Patrones Creacionales
 
Patrón Observer
Patrón ObserverPatrón Observer
Patrón Observer
 
Nativescript
NativescriptNativescript
Nativescript
 
Factory method
Factory methodFactory method
Factory method
 
Singleton
SingletonSingleton
Singleton
 
Patrones de creación
Patrones de creaciónPatrones de creación
Patrones de creación
 
Patrones de diseño: Polimorfismo
Patrones de diseño: PolimorfismoPatrones de diseño: Polimorfismo
Patrones de diseño: Polimorfismo
 
Presentacion Patrones Creacionales
Presentacion Patrones CreacionalesPresentacion Patrones Creacionales
Presentacion Patrones Creacionales
 

Similaire à Measuring code quality:WTF/min by @dgomezg

Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)David Gómez García
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principlesEdorian
 
Good code, Bad Code
Good code, Bad CodeGood code, Bad Code
Good code, Bad Codejosedasilva
 
Code Review
Code ReviewCode Review
Code ReviewRavi Raj
 
VVV validation and linting tool
VVV validation and linting toolVVV validation and linting tool
VVV validation and linting toolMikko Ohtamaa
 
CICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your MindCICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your Mindciconf
 
Effective codereview | Dave Liddament | CODEiD
Effective codereview | Dave Liddament | CODEiDEffective codereview | Dave Liddament | CODEiD
Effective codereview | Dave Liddament | CODEiDCODEiD PHP Community
 
Code Igniter Code Sniffer
Code Igniter  Code SnifferCode Igniter  Code Sniffer
Code Igniter Code SnifferAlbert Rosa
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keithm j
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...TelecomValley
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchMongoDB
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...apidays
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroSteven Pignataro
 
No Programmer Is an Island
No Programmer Is an IslandNo Programmer Is an Island
No Programmer Is an IslandJimmy Sieben
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1Moustafa Ghoniem
 

Similaire à Measuring code quality:WTF/min by @dgomezg (20)

Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
Midiendo la calidad de código en WTF/Min (Revisado EUI Abril 2014)
 
Wtf per lineofcode
Wtf per lineofcodeWtf per lineofcode
Wtf per lineofcode
 
BDD with Behat
BDD with BehatBDD with Behat
BDD with Behat
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
Save time by applying clean code principles
Save time by applying clean code principlesSave time by applying clean code principles
Save time by applying clean code principles
 
Good code, Bad Code
Good code, Bad CodeGood code, Bad Code
Good code, Bad Code
 
Code Review
Code ReviewCode Review
Code Review
 
VVV validation and linting tool
VVV validation and linting toolVVV validation and linting tool
VVV validation and linting tool
 
CICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your MindCICONF 2012 - Don't Make Me Read Your Mind
CICONF 2012 - Don't Make Me Read Your Mind
 
Effective codereview | Dave Liddament | CODEiD
Effective codereview | Dave Liddament | CODEiDEffective codereview | Dave Liddament | CODEiD
Effective codereview | Dave Liddament | CODEiD
 
Tdd is not about testing
Tdd is not about testingTdd is not about testing
Tdd is not about testing
 
Web backdoors attacks, evasion, detection
Web backdoors   attacks, evasion, detectionWeb backdoors   attacks, evasion, detection
Web backdoors attacks, evasion, detection
 
Code Igniter Code Sniffer
Code Igniter  Code SnifferCode Igniter  Code Sniffer
Code Igniter Code Sniffer
 
Better watch your apps - MJ Keith
Better watch your apps - MJ KeithBetter watch your apps - MJ Keith
Better watch your apps - MJ Keith
 
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
Treat Your Unit Tests As Production Code - DARGO - Amadeus - Soirée du Test L...
 
Building Your First App with MongoDB Stitch
Building Your First App with MongoDB StitchBuilding Your First App with MongoDB Stitch
Building Your First App with MongoDB Stitch
 
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
APIdays Paris 2019 - API Descriptions as Product Code by Phil Sturgeon, Stopl...
 
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven PignataroJoomla! Day Chicago 2011 Presentation - Steven Pignataro
Joomla! Day Chicago 2011 Presentation - Steven Pignataro
 
No Programmer Is an Island
No Programmer Is an IslandNo Programmer Is an Island
No Programmer Is an Island
 
180 daraga cpp course session-1
180 daraga cpp course session-1180 daraga cpp course session-1
180 daraga cpp course session-1
 

Dernier

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
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
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
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
 

Dernier (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
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
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
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
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
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
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
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
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
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
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
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
 

Measuring code quality:WTF/min by @dgomezg

  • 1. Leganés! 6-7 Febrero 2013! David Gómez G. @dgomezg Measuring Code Quality: WTF/min Code from the real world that could give you a stroke and some advices to not replicate them. Except where otherwise noted, this work is licensed under: http://creativecommons.org/licenses/by-nc-sa/3.0/
  • 2. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg 2
  • 3. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Quality CODE RELATED CONCEPTS 3
  • 4. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg 4 http://www.osnews.com/story/19266/WTFs_m
  • 5. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg CODE SMELL A surface indication that usually corresponds to a deeper problem in the system Term coined by Kent Beck 5
  • 6. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Some Misconceptions You write code for a computer to read You write code to be read by a developer maintaining your code. The computer reads the compiled code Writing smart code, you will improve performance Developers spend most of the time writing code Developers spend most of time reading code 6
  • 7. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Some Misconceptions You write code for a computer to read You write code to be read by a developer maintaining your code. The computer reads the compiled code Writing smart code, you will improve performance Developers spend most of the time writing code Developers spend most of time reading code 6
  • 8. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Some Misconceptions You write code for a computer to read You write code to be read by a developer maintaining your code. The computer reads the compiled code Writing smart code, you will improve performance Developers spend most of the time writing code Developers spend most of time reading code 6
  • 9. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Some Misconceptions You write code for a computer to read You write code to be read by a developer maintaining your code. The computer reads the compiled code Writing smart code, you will improve performance Developers spend most of the time writing code Developers spend most of time reading code 6
  • 10. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Examples of real code from the real world 7
  • 11. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg 8
  • 12. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg The following code has been modified slightly to protect anonymity of authors ! but always respect the original idea (although it could be difficult to believe) 9
  • 13. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg COMMENTS Comments are useful, but /*        */ Only if they add information or if they explain the code Don’t describe what the code is doing Explain why (pre/post-conditions) Use cases (for methods/types/functions) 10
  • 14. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min COMMENTS: Unuseful info @dgomezg /*        */
  • 15. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg COMMENTS: Unuseful info /*        */ /** * Método get Disponibilidad. * * @return Returns the disponibilidad. */ public String getDisponibilidad() { // // } We will get back to the implementation detail More fun later
  • 16. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min COMMENTS: Unuseful info @dgomezg /*        */     !                 /**  Atributo  codCircuito.  */   private  String  codCircuito;   /**    *  Método  get  codCircuito.    *      *  @return  String    */   public  String  getCodCircuito()  {     return  codCircuito;   }  
  • 17. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg COMMENTS: Remember to sign your code /*        */ ////////////////////////Manuela   Logger  log  =  LoggerFactory.getLogger(MyClass.class.getName());   ////////////////////////
  • 18. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg COMMENTS: A good marketing tool /*        */ /** * This method removes all selected files * * Returns a jQuery collection of all affected elements. * * @name reset * @type jQuery * @author Daniel B. ( http://www.visit-my-web.com/) * */ reset: function(){
  • 19. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min COMMENTS: FOOL THE code READEr @dgomezg /*        */ // Producto p = null; List prod = null; List listaElementos = new ArrayList(); if (nElements > 80) { cmd.setOrden(Producto.SELECT_POR_TIPO); l = new ListParam(); l.add(new Integer(idTipoProducto)); l.add(new Integer(idCategoria)); * for the trick to work out, keep the indentation
  • 20. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Exceptions Exceptions are just that: Exceptions Catch only if you can handle it Declare the exact type Don’t use for: Flow Control State demarcation (other than Error) 17
  • 21. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Exceptions: Simply retrowing public  static  Class  cargaClase(java.lang.String  pnombreClase)                  throws  ClassNotFoundException  {          ClassLoader  oloader  =  new  ClasesUtil().getClass()   .getClassLoader();          try  {                  return  oloader  !=  null  ?                       oloader.loadClass(pnombreClase)                       :  Class.forName(pnombreClase);          }  catch  (ClassNotFoundException  x)  {                                        throw  x;          }   }
  • 22. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min Exceptions: NPE PARANOIA @dgomezg It’s better to check twice to avoid a NullPointerException       while  (session  !=  null)  {     numSessions++  ;     if  (session  !=  null)  {       ...   }   ...   }    
  • 23. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Exceptions: NPE PARANOIA It’s better to check twice to avoid a NullPointerException while (session != null) { numSessions++ ; if (session != null) { //.... } else { log.warn("Null session detected.” + “ Starting session Synchronization"); //.... dead code follows... } } extra points if you add ‘dead code’ to the else block
  • 24. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Exceptions: Flow Control public  class  ProcesoTerminadoCorrectamenteException                            extends  Exception  {   ! }   Man! When a process which right ends is an exception… That’s a good confidence in your system!
  • 25. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg NAMING Use descriptive names Describe what a Class/function/method does, not what it means Describe what a variable/attribute holds Don’t use abbreviations Code for readability 22
  • 26. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg NAMING: What does this method do?        if(  p  !=  null){                  applyBusinessLogic(p,estado,manager);          }         public  void  onButtonPressed(ActionEvent  e)  {     FormData  formData  =  parseFromEvent(e);     theAlgorithm(formData);   }   23
  • 27. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code Developers should be lazy Don’t write code you don’t need Don’t repeat yourself 24
  • 28. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: Wrapping well-known APIs public  static  String  substringBefore(String  str,String  separator)  {          return  (org.apache.commons.lang.StringUtils   .substringBefore(str,  separator));   }   25
  • 29. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: Wrapping well-known APIs               public  String  getPropiedad(String  clave)  {     return  wrappedCacheAdmin.getProperty(clave);   }     public  void  setClaseAlgoritmo(String  clase)  {     wrappedCacheAdmin.setAlgorithmClass(clase);   }   26
  • 30. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: Clever? Code        /**  La  constante  CERO.  */          public  static  final  int  CERO=0;                    /**  La  constante  UNO.  */          public  static  final  int  UNO=1;                    /**  La  constante  DOS.  */          public  static  final  int  DOS=2;                    /**  La  constante  TRES.  */          public  static  final  int  TRES=3;   27
  • 31. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: Clever? Code Challenge: Could you tell what will print the following code?     System.out.println(DOS  *  TRES); 28
  • 32. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg 2K Effect… We miss you! NODO 1 ! # Planificacion Procesos Batch # (Formato ss mm hh dd MM yyyy) NODO 3 # cron.sync=0 00 15 * * ? ! # Planificacion Procesos Batch cron.download=0 00 23 * * ? 2030 NODO 4 # (Formato ss mm hh dd MM yyyy) cron.reports=0 00 23 * * ? 2030 ! # ! cron.sync=0 00 16 * * ? # Planificacion Procesos Batch cron.download=0 00 03 * * ? 2030 # (Formato ss mm hh dd MM yyyy) cron.reports=0 00 03 * * ? 2030 # cron.sync=0 00 12 * * ? cron.download=0 00 12 * * 2030 cron.reports=0 00 12 * * 2030 29
  • 33. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: SOP Introducing SOP: String Oriented Programming /** * Método get Disponibilidad. * * @return Returns the disponibilidad. */ public String getDisponibilidad() { if (numeroPuestos == 0) return "No"; else return "Si"; } 30
  • 34. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg UnNecessary code: TAKING ADVICE TOO SERIOUSLY String concatenation in Java is not recommended. Use StringBuffer or StringBuilder instead StringBuffer hql = new StringBuffer( "select distinct config from Config config "); Query query = session.createQuery(hql.toString()) ; Don’t push the recommendations to the limits!!! 31
  • 35. Leganés! 6-7 Febrero 2014 @dgomezg Measuring Code Quality: WTF/min UnNecessary code: The indentation MADNESS                                                                                  ]     });   });                         },                       }                     ]                   }                 }                            }   });                   });            }       });     }   }   32
  • 36. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg DESIGN PRICIPLES 33
  • 37. Leganés! 6-7 Febrero 2014 @dgomezg Measuring Code Quality: WTF/min K IS S EEP T IMPLE TUPID! 34
  • 38. Leganés! 6-7 Febrero 2014 @dgomezg Measuring Code Quality: WTF/min D R Y on’t epeat ourself 35
  • 39. Leganés! 6-7 Febrero 2014 @dgomezg Measuring Code Quality: WTF/min S OC eparation F oncerns 36
  • 40. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min I:I @dgomezg ! ! ! ! ! SEPARATION OF CONCERNS DON’T REPEAT YOURSELF 37
  • 41. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg ENSURING CODE QUALITY: THE QUALITY CYCLE 38
  • 42. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Default Quality Cycle 39
  • 43. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Add Intermediate Quality Checks 40
  • 44. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Automate Intermediate Checks 41
  • 45. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Measure with tools 42
  • 46. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Define Business Key Indicators 43
  • 47. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Define Alarms 44
  • 48. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Get a Dashboard 45
  • 49. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Added Value: keeping everybody happy 46
  • 50. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg SOME FINAL ADVICES 47
  • 51. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Read! Keep your brain healthy Clean Code: Robert Martin (@unclebob) 48
  • 52. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg No Monkeys, No Lizards Be concious, be consequent www.adictosaltrabajo.com/detalle-­‐noticia.php?noticia=356 49
  • 53. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg THe Software RUSTING principle The software degrades slowly and slightly as time passes… Sometimes is not slowly neither slightly!! 50
  • 54. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg The boy scout rule Try and leave this world a little better than you found it, and when your turn comes to die you can die happy in feeling that at any rate you have not wasted your time but have done your best. Robert Stephenson Smyth Baden-Powell 51
  • 55. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. John F. Woods, September 1991 52
  • 56. Leganés! 6-7 Febrero 2014 Measuring Code Quality: WTF/min @dgomezg Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. John F. Woods, September 1991 ////////////////////////Manuela   Logger  log  =  LogFactory.getLogger(MyClass.class.getName());   //////////////////////// 53