10. A catalogue
of smells
specific to MVC
(after talking to 20+70 developers)
10
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
29. 29
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.
35. 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?
36. Project # of
classes
# of
commits
# of DAOs # of
methods
Gnarus 924 10451 39 233
Caelumweb 1321 12077 81 590
There are many queries!
37. 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?
38. 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.
39.
40. Test code stability
Not happen it should!
We hate system
testing because
we have to
rewrite them
often!
43. A catalogue
of patterns
43
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.
45. We do need hard evidence of the importance
of code smells… but how?
46. The solution?
How to measure
readability, ease to
maintain, ease to
test, ease for
someone else to
start to maintain,
etc, how much it
slows me down?
Answers I don’t have…
49. 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!