SlideShare a Scribd company logo
Code	quality	in
MVC	systems
Maurício Aniche
@mauricioaniche
Code quality in MVC systems - BENEVOL 2016
60k	and	110k	lines	of	
Java	code!
Me beautiful	code
5
Sugar	level																150																							[70,120]
6
Coupling																				10																								<	15
How	to	find
this	number?
7
Benchmarking
Benchmark
in Controllers
8
Why? their	own	concerns	each	
part	of	the	architecture	
has!
10
Quantiles
Coupling	(CBO)
Aniche, M., Treude, C., Zaidman, A., van Deursen, A., Gerosa, M.A., “SATT: Tailoring Code Metric Thresholds for Different Software
Architectures”. 16th IEEE International Working Conference on Source Code Analysis and Manipulation, 2016.
11
Experts
explained to us
SATT for the rescue
12
13
14
Talk	to	developers	you	
should,	young	
padawan!
A catalogue
of smells
specific to MVC
(after talking to 50 developers)
15
Grrrrrr…
Controllers that offer many
services
Grrrr…
Repositories that deal with
many Entities
Grrrrr…
Aniche, Maurício, Bavota, Gabriele, Treude, Christoph, van Deursen, Arie, Gerosa, Marco.“A Validated Set of Smells in Model-
View-Controller Architecture”. Software Maintenance and Evolution (ICSME), 2016, 32th International Conference, IEEE, 2016.
16
They	are	indeed
bad…
(prone	to
change	and	to	defects)
It	indeed	became	a	tool!
17
Bettercodehub like	it!	J
Database-centric	code
Because	in	the	wrong	
place,	they	are!It’s	very	hard	to	
find	some	SQL	
queries	in	my	
codebase…
Project #	of	
classes
#	of	
commits
#	of	DAOs #	of	
methods
Gnarus 924 10451 39 233
Caelumweb 1321 12077 81 590
There are	many queries!
Queries	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’;
Where	
should	I	put	
it?
public class InvoiceDAO {
public Invoice findById(int id) { … }
public ShoppingCart find(User u) { … })
public List<Invoice> getAll() { … }
public void save(Invoice inv) { ...}
}
By	the	method	
signatures	we	
should!
Where	should	
we	start?
Project #	of	DAO	
methods
#	of
”correct”
methods
#	of
”wrong”	
methods
%	of	
wrong	
methods
Caelumweb 590 511 79 13.38%
Gnarus 233 200 33 14.16%
Project #	of
inspected
methods
#	of
agreement
%	of
agreement
Caelumweb 79 59 74.68%
Gnarus 33 16 48.48%
Aniche, Maurício F., Gustavo A. Oliva, and Marco A. Gerosa. “Are the Methods in Your Data Access Objects (DAOs) in the Right Place? A Preliminary
Study.”. 6th Workshop on Managing Technical Debt, in conjunction with ICSME2014, Canada. Short paper.
Phil	Calçado just	
(re-)blogged	
about	it!
http://philcalcado.com/2010/12/23/how_to_write_a_repository.html
Test	code	stability
Not	happen	it	should!
We	hate	system	
testing	because	
we	have	to	
rewrite	them	
often!
Large	selenium	code	is!
A catalogue
of patterns
27
Fixture API
ID in HTML
Move Fast, Move Slow
…
Aniche, M., Guerra, E., Gerosa, M. “A Set of Patterns to Improve Code Quality of Automated Functional Tests of Web Applications”. 21th
Conference on Pattern Languages of Programs. 2014.
Code quality in MVC systems - BENEVOL 2016
Thanks!
@mauricioaniche
Young	me	working	on	a	low	
quality	code	that	I	wrote	myself	at	
my	first	international	project	
(Dominican	Republic,	2006).
Sorry	about	my	hair.
My	bosses	doing	peer	press…	oops,	
pair	programming!

More Related Content

PPTX
Code smells in MVC applications (Dutch Spring meetup)
PDF
A Validated Set of Smells for MVC Architectures - ICSME 2016
PPTX
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
PDF
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
PDF
Efeitos da Prática de Revisão de Código na Caelum: Um Estudo Preliminar em Du...
PPT
Você tem um xerife olhando seu código?
PDF
Como eu aprendi que testar software é importante?
PDF
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web
Code smells in MVC applications (Dutch Spring meetup)
A Validated Set of Smells for MVC Architectures - ICSME 2016
A Collaborative Approach to Teach Software Architecture - SIGCSE 2017
SATT: Tailoring Code Metric Thresholds for Different Software Architectures (...
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?
Como eu aprendi que testar software é importante?
Proposta: Métricas e Heurísticas para Detecção de Problemas em Aplicações Web

Viewers also liked (20)

PDF
DNAD 2015 - Métricas de código, pra que te quero?
PDF
TDD depois do mainstream. E agora?
PDF
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
PDF
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
PDF
Eu meço, tu medes, ele mede.. Mas medimos o quê?
PDF
Code coverage for MSR Researches [Work in Progress]
PPT
ASP.NET MVC - Vinicius Quaiato
KEY
Aprendendo solid com exemplos
PPT
Apresentação programação orientada à objetos
PDF
SOLID Principles
PPT
O que é código bonito?
PPT
Orientação a Objetos e Design Patterns
PDF
Conheça a nova arquitetura do compilador do C# (DNAD 2015)
PPTX
Build e release pipeline com docker
PDF
Minicurso sobre Evolução de Software no CBSoft 2011
PDF
O que estamos temos feito com mineração de repositório de código no IME?
PDF
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
PDF
Test-Driven Development serve pra mim?
PDF
ASP.NET Core com Linux, Docker e Azure
PPT
ASP.NET Identity - O Novo componente de Membership do ASP.NET
DNAD 2015 - Métricas de código, pra que te quero?
TDD depois do mainstream. E agora?
MTD2014 - Are The Methods In Your DAOs in the Right Place? A Preliminary Study
MetricMiner: Supporting Researchers in Mining Software Repositories - SCAM 2013
Eu meço, tu medes, ele mede.. Mas medimos o quê?
Code coverage for MSR Researches [Work in Progress]
ASP.NET MVC - Vinicius Quaiato
Aprendendo solid com exemplos
Apresentação programação orientada à objetos
SOLID Principles
O que é código bonito?
Orientação a Objetos e Design Patterns
Conheça a nova arquitetura do compilador do C# (DNAD 2015)
Build e release pipeline com docker
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?
Does the Act of Refactoring Really Make Code Simpler? A Preliminary Study - W...
Test-Driven Development serve pra mim?
ASP.NET Core com Linux, Docker e Azure
ASP.NET Identity - O Novo componente de Membership do ASP.NET
Ad

More from Maurício Aniche (11)

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

Recently uploaded (20)

PDF
Mushroom cultivation and it's methods.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
1. Introduction to Computer Programming.pptx
PDF
Getting Started with Data Integration: FME Form 101
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
Tartificialntelligence_presentation.pptx
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
August Patch Tuesday
PPTX
cloud_computing_Infrastucture_as_cloud_p
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
OMC Textile Division Presentation 2021.pptx
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PPT
Teaching material agriculture food technology
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Programs and apps: productivity, graphics, security and other tools
Mushroom cultivation and it's methods.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
1. Introduction to Computer Programming.pptx
Getting Started with Data Integration: FME Form 101
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Tartificialntelligence_presentation.pptx
Heart disease approach using modified random forest and particle swarm optimi...
Unlocking AI with Model Context Protocol (MCP)
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
August Patch Tuesday
cloud_computing_Infrastucture_as_cloud_p
Advanced methodologies resolving dimensionality complications for autism neur...
Group 1 Presentation -Planning and Decision Making .pptx
Per capita expenditure prediction using model stacking based on satellite ima...
OMC Textile Division Presentation 2021.pptx
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Teaching material agriculture food technology
Empathic Computing: Creating Shared Understanding
Programs and apps: productivity, graphics, security and other tools

Code quality in MVC systems - BENEVOL 2016