Aroma: Using machine learning for code recommendation

Thousands of engineers write the code to create our apps, which serve billions of people worldwide. This is no trivial task—our services have grown so diverse and complex that the codebase contains…

Celeste Barnaby
9 min readadvanced
--
View Original

Overview

Aroma is a machine learning-based code recommendation tool designed to assist engineers in navigating large codebases by providing insights into common coding patterns. It simplifies the process of finding idiomatic usage by clustering similar code snippets, thus enhancing productivity and reducing the time spent on manual code searches.

What You'll Learn

1

How to use Aroma for code recommendations in Android projects

2

Why clustering similar code snippets improves code search efficiency

3

How to implement feature-based search for code retrieval

Key Questions Answered

How does Aroma enhance code search for engineers?
Aroma enhances code search by utilizing machine learning to cluster similar code snippets, allowing engineers to quickly find idiomatic patterns without manually sifting through numerous results. This significantly speeds up the coding process and improves the quality of code by providing best practices derived from existing codebases.
What are the advantages of using Aroma over traditional code search tools?
Aroma offers several advantages including syntax tree-based searches, automatic clustering of similar results, real-time recommendations, and language-agnostic capabilities. This allows for more relevant and idiomatic code suggestions compared to traditional string-based search tools.
When should engineers consider using Aroma for their projects?
Engineers should consider using Aroma when working with large codebases, especially when they need to quickly find common coding patterns or best practices. It is particularly useful in environments where documentation may be outdated or unavailable.
What is the process Aroma uses to create code recommendations?
Aroma creates code recommendations through a three-stage process: feature-based search, reranking and clustering of similar code snippets, and intersecting methods within clusters to identify common patterns. This systematic approach ensures that the recommendations are relevant and useful.

Technologies & Tools

Some links below are affiliate links. We may earn a commission if you make a purchase.

Tool
Aroma
Code recommendation and search tool using machine learning
Platform
Github
Source of open source Android projects used for examples

Key Actionable Insights

1
Utilize Aroma to streamline your code development process by quickly accessing common coding patterns.
This can save significant time during development, especially in large projects where finding idiomatic solutions manually would be cumbersome.
2
Leverage the clustering feature of Aroma to discover best practices from similar projects.
By examining recommendations generated from clusters, engineers can adopt proven solutions and avoid common pitfalls in their own code.
3
Implement feature-based search techniques in your own tools to enhance code retrieval capabilities.
Understanding how Aroma indexes code can inspire improvements in your own development tools, making them more efficient and user-friendly.

Common Pitfalls

1
Relying solely on outdated documentation can lead to inefficient coding practices.
Documentation may not always reflect the latest coding standards or practices, making it essential to utilize tools like Aroma that provide real-time insights from actual code.

Related Concepts

Machine Learning In Software Development
Code Search Optimization
Best Practices In Android Development