SlideShare a Scribd company logo
1 of 19
Download to read offline
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)

More Related Content

Viewers also liked

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
 

Viewers also liked (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 to 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 to 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
 

More from 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
 

More from 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)
 

Recently uploaded

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 

Recently uploaded (20)

SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 

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)