Did JHotDraw respect the Law of Good Style?  An exploratory deep dive into the nature of false positives of bad code smells Developers need to make a constant effort to improve the quality of their code if they want to stay productive. Tools that highlight code locations that could benefit from refactoring are thus highly desirable. The most common name for such locations is bad code smell. A number of tools offer such quality feedback and there is a substantial body of related research. However, all these tools, including those based on Machine Learning, still produce false positives. Every single false positive shown to the developer places a cognitive burden on her and should thus be avoided. The literature discusses the choice of metric thresholds, the general subjectivity of such a judgment and the relation to conscious design choices, design ideas.  :119,examine false positives and the relation between bad smells and design ideas, we designed and conducted an exploratory case study. While previous research presented a broad overview, we have chosen a narrow setting to reach for even deeper insights. The framework JHotDraw had been designed so thoughtfully that most smells may be expected to be false positives. The Law of Good Style, better known as the Law of Demeter is a rather restrictive design rule so that we can still expected to find some potential bad smells, i.e. violations of this Law.  :212,combination led to 1215 potential smells of which at most 70 are true positives. We found generic as well as specific design ideas that were more important than the smell. Our confidence in that decision ranged from high enough to very high. We were surprised to realize that the smell definition itself required the formulation of constructive design ideas. Finally we found some smells to be the result of the limitation of the language and one could introduce auxiliary constructive design ideas to compensate for them.  decision :299,355,whether a potential smell occurrence is actually a true positive was made very meticulously. For that purpose we took three qualities that the smell could affect negatively into account and we discussed the result of the recommended refactorings. If we were convinced to have found a false positive, we described relations to design ideas.  realization that not only general design ideas but as well specific design ideas have an influence on :299,355,whether a potential smell is a true positive turns the problem of false positives from a scientific problem (What is the true definition of the smell?) to a engineering problem (How can we incorporate design ideas into smell definitions?). We recommend to add adaptations points to the smell definitions. Higher layers may then adapt the smell for specific contexts. After adaptation the tool may provide continuously distinct and precise quality feedback, reducing the cognitive load for the developer and preventing habituation. Furthermore, the schema for the discussion of potential smells may be used to elaborate more sets of true and false smell occurrences. Finally, it follows that smell detection based on machine learning should take as well signs of design ideas into account.

Aroma: Code Recommendation via Structural Code Search Programmers often write code that has similarity to existing code written somewhere. A tool that could help programmers to search such similar code would be immensely useful. Such a tool could help programmers to extend partially written code snippets to completely implement necessary functionality, help to discover extensions to the partial code which are commonly included by other programmers, help to crosscheck against similar code written by other programmers, or help to add extra code which would fix common mistakes and errors. We propose Aroma, a tool and technique for code recommendation via structural code search. Aroma indexes a huge code corpus including thousands of opensource projects, takes a partial code snippet as input, searches the corpus for method bodies containing the partial code snippet, and clusters and intersects the results of the search to recommend a small set of succinct code snippets which both contain the query snippet and appear as part of several methods in the corpus. We evaluated Aroma on 2000 randomly selected queries created from the corpus, as well as 64 queries derived from code snippets obtained from Stack Overflow, a popular website for discussing code. We implemented Aroma for 4 different languages, and developed an IDE plugin for Aroma. Furthermore, we conducted a study where we asked 12 programmers to complete programming tasks using Aroma, and collected their feedback. Our results indicate that Aroma is capable of retrieving and recommending relevant code snippets efficiently.