SlideShare una empresa de Scribd logo
1 de 19
Descargar para leer sin conexión
Are the Methods in Your DAOs 
in the Right Place? 
A Preliminary Study 
Maurício Aniche 
Gustavo Oliva 
Marco Aurélio Gerosa
What are 
DAOs ?
public class InvoiceDAO { 
@Inject private EntityManager em; 
public List<Invoice> getAll() { 
String sql = "select … 
from Invoice 
where ..."; 
return em.createQuery(sql).getResultList(); 
} 
public void save(Invoice inv) { 
em.save(inv); 
} 
}
They can get complicated! 
SELECT 
p.name as project, 
c.id as commitId, 
a.name as artifactName, 
a.path as artifactPath 
FROM 
Projects p 
JOIN 
Commits c ON c.project_id = p.id 
JOIN 
Artifacts a on a.commit_id = c.id 
WHERE 
p.repository = ’Apache’;
They can get complicated! 
SELECT 
p.name as project, 
c.id as commitId, 
a.name as artifactName, 
a.path as artifactPath 
FROM 
Projects p 
JOIN 
Commits c ON c.project_id = p.id 
JOIN 
Artifacts a on a.commit_id = c.id 
WHERE 
p.repository = ’Apache’; 
Belongs to 
ProjectDAO?
… and more complicated! 
SELECT 
p.name as project, 
c.id as commitId, 
a.name as artifactName, 
a.path as artifactPath 
FROM 
Commits c 
JOIN 
or CommitDAO? 
Projects p ON c.project_id = p.id 
JOIN 
Artifacts a on a.commit_id = c.id 
WHERE 
p.repository = ’Apache’;
… and more complicated! 
SELECT 
p.name as project, 
c.id as commitId, 
a.name as artifactName, 
a.path as artifactPath 
FROM 
Commits c 
JOIN 
ArtifactDAO! 
Projects p ON c.project_id = p.id 
JOIN 
Artifacts a on a.commit_id = c.id 
WHERE 
p.repository = ’Apache’;
Where 
to put this query?
finding the right place is 
very problematic! 
duplicated code modularity violation = bugs 
spend time searching
RQ: 
How can one automatically 
identify methods 
that may have been placed in the 
? 
wrong or in ambiguous DAOs
Research Design 
Heuristic 
Implement a Tool 
Select Projects 
Qualitative Analysis
the heuristic 
basically looks to 
the method signature! 
public class InvoiceDAO { 
public Invoice findById(int id) { … } 
public ShoppingCart find(User u) { … }) 
public List<Invoice> getAll() { … } 
public void save(Invoice inv) { ...} 
}
the projects were... 
Project # of classes # of commits # of DAOs # of methods 
Gnarus 924 10451 39 233 
Caelumweb 1321 12077 81 590 
Codesheriff 56 339 10 70 
java 
web MVC 
VRaptor 
Hibernate 
unit tested
and the heuristic found out... 
Project # of DAO 
methods 
# of right 
methods 
# of wrong 
methods 
% of wrong 
methods 
Caelumweb 590 511 79 13.38% 
Codesheriff 70 57 13 18.57% 
Gnarus 233 200 33 14.16%
the developers agreed! 
Project # of inspected 
methods 
# of 
agreement 
% of 
agreement 
Caelumweb 79 59 74.68% 
Codesheriff 13 8 61.53% 
Gnarus 33 16 48.48%
What 
have we learned? 
A quick and cheap approach to identify 
methods in wrong DAOs 
Filters 13% to 18% of all methods and 
it is correct 50% to 75% of the cases
Threats to Validity 
- Only three projects 
- Point of view of a single developer 
- We only validated the ones the 
heuristic has selected
What 
are the next steps? 
- Understand the cost of this TD 
- Improve the heuristic
Thank you! 
maurício aniche (aniche@ime.usp.br) 
gustavo oliva (goliva@ime.usp.br) 
marco gerosa (gerosa@ime.usp.br)

Más contenido relacionado

Destacado

MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013Maurício Aniche
 
Eu meço, tu medes, ele mede.. Mas medimos o quê?
Eu meço, tu medes, ele mede.. Mas medimos o quê?Eu meço, tu medes, ele mede.. Mas medimos o quê?
Eu meço, tu medes, ele mede.. Mas medimos o quê?Maurício Aniche
 
Code coverage for MSR Researches [Work in Progress]
Code coverage for MSR Researches [Work in Progress]Code coverage for MSR Researches [Work in Progress]
Code coverage for MSR Researches [Work in Progress]Maurício Aniche
 
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...Maurício Aniche
 
A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016Maurício Aniche
 
Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Maurício Aniche
 
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Maurício Aniche
 
Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Maurício Aniche
 
O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?Maurício Aniche
 
Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Maurício Aniche
 
DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?Maurício Aniche
 
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebProposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebMaurício Aniche
 
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Maurício Aniche
 
Você tem um xerife olhando seu código?
Você tem um xerife olhando seu código?Você tem um xerife olhando seu código?
Você tem um xerife olhando seu código?Maurício Aniche
 
TDD depois do mainstream. E agora?
TDD depois do mainstream. E agora?TDD depois do mainstream. E agora?
TDD depois do mainstream. E agora?Maurício Aniche
 
Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Maurício Aniche
 
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...Biblioteca Virtual
 
«Зачем звонить с сайта – опыт Zingaya»
«Зачем звонить с сайта – опыт  Zingaya»«Зачем звонить с сайта – опыт  Zingaya»
«Зачем звонить с сайта – опыт Zingaya»Michael Kozloff
 

Destacado (20)

MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
 
Eu meço, tu medes, ele mede.. Mas medimos o quê?
Eu meço, tu medes, ele mede.. Mas medimos o quê?Eu meço, tu medes, ele mede.. Mas medimos o quê?
Eu meço, tu medes, ele mede.. Mas medimos o quê?
 
Code coverage for MSR Researches [Work in Progress]
Code coverage for MSR Researches [Work in Progress]Code coverage for MSR Researches [Work in Progress]
Code coverage for MSR Researches [Work in Progress]
 
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
 
A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016A Validated Set of Smells for MVC Architectures - ICSME 2016
A Validated Set of Smells for MVC Architectures - ICSME 2016
 
Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016Code quality in MVC systems - BENEVOL 2016
Code quality in MVC systems - BENEVOL 2016
 
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
 
Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011Minicurso sobre Evolução de Software no CBSoft 2011
Minicurso sobre Evolução de Software no CBSoft 2011
 
O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?O que estamos temos feito com mineração de repositório de código no IME?
O que estamos temos feito com mineração de repositório de código no IME?
 
Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?Test-Driven Development serve pra mim?
Test-Driven Development serve pra mim?
 
DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?DNAD 2015 - Métricas de código, pra que te quero?
DNAD 2015 - Métricas de código, pra que te quero?
 
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações WebProposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
 
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
 
Você tem um xerife olhando seu código?
Você tem um xerife olhando seu código?Você tem um xerife olhando seu código?
Você tem um xerife olhando seu código?
 
TDD depois do mainstream. E agora?
TDD depois do mainstream. E agora?TDD depois do mainstream. E agora?
TDD depois do mainstream. E agora?
 
Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?Como eu aprendi que testar software é importante?
Como eu aprendi que testar software é importante?
 
90 10 Principle
90 10 Principle90 10 Principle
90 10 Principle
 
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...
Juggling Work And Breastfeeding Effects Of Maternity Leave And Occupational C...
 
Gallery
GalleryGallery
Gallery
 
«Зачем звонить с сайта – опыт Zingaya»
«Зачем звонить с сайта – опыт  Zingaya»«Зачем звонить с сайта – опыт  Zingaya»
«Зачем звонить с сайта – опыт Zingaya»
 

Similar a MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study

Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Maurício Aniche
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Juan Pablo
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB
 
Generic DAOs With Hades
Generic DAOs With HadesGeneric DAOs With Hades
Generic DAOs With HadesOliver Gierke
 
My way to clean android - Android day salamanca edition
My way to clean android - Android day salamanca editionMy way to clean android - Android day salamanca edition
My way to clean android - Android day salamanca editionChristian Panadero
 
Binding business data to vaadin components
Binding business data to vaadin componentsBinding business data to vaadin components
Binding business data to vaadin componentsPeter Lehto
 
My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainChristian Panadero
 
Android DevConference - Android Clean Architecture
Android DevConference - Android Clean ArchitectureAndroid DevConference - Android Clean Architecture
Android DevConference - Android Clean ArchitectureiMasters
 
20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-final20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-finalDavid Lapsley
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCaelum
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)Jose Manuel Pereira Garcia
 
Enforce Consistentcy with Clean Architecture
Enforce Consistentcy with Clean ArchitectureEnforce Consistentcy with Clean Architecture
Enforce Consistentcy with Clean ArchitectureFlorin Coros
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionChristian Panadero
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy
 
Parancoe and Lambico
Parancoe and LambicoParancoe and Lambico
Parancoe and Lambicobenfante
 
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRT3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRDavid Gómez García
 

Similar a MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study (20)

Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)Code smells in MVC applications (Dutch Spring meetup)
Code smells in MVC applications (Dutch Spring meetup)
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
MongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDBMongoDB.local Atlanta: Introduction to Serverless MongoDB
MongoDB.local Atlanta: Introduction to Serverless MongoDB
 
Generic DAOs With Hades
Generic DAOs With HadesGeneric DAOs With Hades
Generic DAOs With Hades
 
My way to clean android - Android day salamanca edition
My way to clean android - Android day salamanca editionMy way to clean android - Android day salamanca edition
My way to clean android - Android day salamanca edition
 
Binding business data to vaadin components
Binding business data to vaadin componentsBinding business data to vaadin components
Binding business data to vaadin components
 
My way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon SpainMy way to clean android v2 English DroidCon Spain
My way to clean android v2 English DroidCon Spain
 
My way to clean android V2
My way to clean android V2My way to clean android V2
My way to clean android V2
 
Android DevConference - Android Clean Architecture
Android DevConference - Android Clean ArchitectureAndroid DevConference - Android Clean Architecture
Android DevConference - Android Clean Architecture
 
20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-final20141002 delapsley-socalangularjs-final
20141002 delapsley-socalangularjs-final
 
Coding Naked 2023
Coding Naked 2023Coding Naked 2023
Coding Naked 2023
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptor
 
From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)From Legacy to Hexagonal (An Unexpected Android Journey)
From Legacy to Hexagonal (An Unexpected Android Journey)
 
Enforce Consistentcy with Clean Architecture
Enforce Consistentcy with Clean ArchitectureEnforce Consistentcy with Clean Architecture
Enforce Consistentcy with Clean Architecture
 
CDI @javaonehyderabad
CDI @javaonehyderabadCDI @javaonehyderabad
CDI @javaonehyderabad
 
L04 Software Design Examples
L04 Software Design ExamplesL04 Software Design Examples
L04 Software Design Examples
 
My way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca editionMy way to clean android (EN) - Android day salamanca edition
My way to clean android (EN) - Android day salamanca edition
 
Oleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoCOleksandr Valetskyy - DI vs. IoC
Oleksandr Valetskyy - DI vs. IoC
 
Parancoe and Lambico
Parancoe and LambicoParancoe and Lambico
Parancoe and Lambico
 
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTRT3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
T3chFest2016 - Uso del API JavaScript de Photoshop para obtener fotos HDTR
 

Más de Maurício Aniche

Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Maurício Aniche
 
Tracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeTracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeMaurício Aniche
 
Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Maurício Aniche
 
Software Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsSoftware Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsMaurício Aniche
 
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017Maurício Aniche
 
[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?Maurício Aniche
 
Métricas de código, pra que te quero?
Métricas de código, pra que te quero?Métricas de código, pra que te quero?
Métricas de código, pra que te quero?Maurício Aniche
 
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...Maurício Aniche
 
Métodos Ágeis de Desenvolvimento de Software: Uma introdução
Métodos Ágeis de Desenvolvimento de Software: Uma introduçãoMétodos Ágeis de Desenvolvimento de Software: Uma introdução
Métodos Ágeis de Desenvolvimento de Software: Uma introduçãoMaurício Aniche
 
The relationship between test and production code quality (@ SIG)
The relationship between test and production code quality (@ SIG)The relationship between test and production code quality (@ SIG)
The relationship between test and production code quality (@ SIG)Maurício Aniche
 
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)Maurício Aniche
 

Más de Maurício Aniche (13)

Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)Can ML help software developers? (TEQnation 2022)
Can ML help software developers? (TEQnation 2022)
 
Tracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to PracticeTracing Back Log Data to its Log Statement: From Research to Practice
Tracing Back Log Data to its Log Statement: From Research to Practice
 
Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019Pragmatic software testing education - SIGCSE 2019
Pragmatic software testing education - SIGCSE 2019
 
Test Automation Day 2018
Test Automation Day 2018Test Automation Day 2018
Test Automation Day 2018
 
Software Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and StroopwafelsSoftware Testing with Caipirinhas and Stroopwafels
Software Testing with Caipirinhas and Stroopwafels
 
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
 
[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?[TDC 2014] Métricas de código, pra que te quero?
[TDC 2014] Métricas de código, pra que te quero?
 
Métricas de código, pra que te quero?
Métricas de código, pra que te quero?Métricas de código, pra que te quero?
Métricas de código, pra que te quero?
 
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...
Defesa de mestrado: Como a prática de TDD influencia no projeto de classes em...
 
O que é código bonito?
O que é código bonito?O que é código bonito?
O que é código bonito?
 
Métodos Ágeis de Desenvolvimento de Software: Uma introdução
Métodos Ágeis de Desenvolvimento de Software: Uma introduçãoMétodos Ágeis de Desenvolvimento de Software: Uma introdução
Métodos Ágeis de Desenvolvimento de Software: Uma introdução
 
The relationship between test and production code quality (@ SIG)
The relationship between test and production code quality (@ SIG)The relationship between test and production code quality (@ SIG)
The relationship between test and production code quality (@ SIG)
 
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)
What Do the Asserts in a Unit Test Tell Us About Code Quality? (CSMR2013)
 

Último

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
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
 
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
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
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
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationKnoldus Inc.
 
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
 

Último (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
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
 
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
 
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
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
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
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
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
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Data governance with Unity Catalog Presentation
Data governance with Unity Catalog PresentationData governance with Unity Catalog Presentation
Data governance with Unity Catalog Presentation
 
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
 

MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study

  • 1. Are the Methods in Your DAOs in the Right Place? A Preliminary Study Maurício Aniche Gustavo Oliva Marco Aurélio Gerosa
  • 3. public class InvoiceDAO { @Inject private EntityManager em; public List<Invoice> getAll() { String sql = "select … from Invoice where ..."; return em.createQuery(sql).getResultList(); } public void save(Invoice inv) { em.save(inv); } }
  • 4. They can get complicated! SELECT p.name as project, c.id as commitId, a.name as artifactName, a.path as artifactPath FROM Projects p JOIN Commits c ON c.project_id = p.id JOIN Artifacts a on a.commit_id = c.id WHERE p.repository = ’Apache’;
  • 5. They can get complicated! SELECT p.name as project, c.id as commitId, a.name as artifactName, a.path as artifactPath FROM Projects p JOIN Commits c ON c.project_id = p.id JOIN Artifacts a on a.commit_id = c.id WHERE p.repository = ’Apache’; Belongs to ProjectDAO?
  • 6. … and more complicated! SELECT p.name as project, c.id as commitId, a.name as artifactName, a.path as artifactPath FROM Commits c JOIN or CommitDAO? Projects p ON c.project_id = p.id JOIN Artifacts a on a.commit_id = c.id WHERE p.repository = ’Apache’;
  • 7. … and more complicated! SELECT p.name as project, c.id as commitId, a.name as artifactName, a.path as artifactPath FROM Commits c JOIN ArtifactDAO! Projects p ON c.project_id = p.id JOIN Artifacts a on a.commit_id = c.id WHERE p.repository = ’Apache’;
  • 8. Where to put this query?
  • 9. finding the right place is very problematic! duplicated code modularity violation = bugs spend time searching
  • 10. RQ: How can one automatically identify methods that may have been placed in the ? wrong or in ambiguous DAOs
  • 11. Research Design Heuristic Implement a Tool Select Projects Qualitative Analysis
  • 12. the heuristic basically looks to the method signature! public class InvoiceDAO { public Invoice findById(int id) { … } public ShoppingCart find(User u) { … }) public List<Invoice> getAll() { … } public void save(Invoice inv) { ...} }
  • 13. the projects were... Project # of classes # of commits # of DAOs # of methods Gnarus 924 10451 39 233 Caelumweb 1321 12077 81 590 Codesheriff 56 339 10 70 java web MVC VRaptor Hibernate unit tested
  • 14. and the heuristic found out... Project # of DAO methods # of right methods # of wrong methods % of wrong methods Caelumweb 590 511 79 13.38% Codesheriff 70 57 13 18.57% Gnarus 233 200 33 14.16%
  • 15. the developers agreed! Project # of inspected methods # of agreement % of agreement Caelumweb 79 59 74.68% Codesheriff 13 8 61.53% Gnarus 33 16 48.48%
  • 16. What have we learned? A quick and cheap approach to identify methods in wrong DAOs Filters 13% to 18% of all methods and it is correct 50% to 75% of the cases
  • 17. Threats to Validity - Only three projects - Point of view of a single developer - We only validated the ones the heuristic has selected
  • 18. What are the next steps? - Understand the cost of this TD - Improve the heuristic
  • 19. Thank you! maurício aniche (aniche@ime.usp.br) gustavo oliva (goliva@ime.usp.br) marco gerosa (gerosa@ime.usp.br)