Best Tools/Open Source Libs

Why You Really Need Facebook’s AROMA code-to-code search and recommendation tool?

Don’t you think it would be good, if some tool could take code snippet as input query and returns a set of recommended code snippets from large code bases ? yes there is one. Facebook has just released Aroma which is code-to-code search and recommendation tool and enables developers to get insights from large code bases.

In this post, we take look at key features of Aroma code-to-code search and recommendation tool

  1. Aroma is a tool for code recommendation via structural code search. It indexes a large code bases that could include thousands of open-source projects.
  1. Aroma takes a partial code snippet as input,searches the indexed method bodies, clusters and intersects the results of search to recommend a small set of code snippets which contain the query snippet and which appears as part of several programs from the code bases.
Image – Architecture of Aroma code recommendation engine
  1. Aroma indexes the code corpus as a sparse matrix in two steps:
  • Featurization – Parses each method in the corpus and creates its parse tree. Then it extracts a set of
    structural features from the parse tree of each method.
  • Vectorization – Feature vectors of all method bodies are represented as a sparse matrix whose jth row represents the feature vector of the jth method body in the corpus.

    Image – Parse tree representation of the code

  1. In the recommendation stage, given a query code snippet, Aroma runs the following phases to create recommendations:
  • Light-weight search: As 1st step,it featurizes the query code’s parse tree into a sparse vector and then takes the dot product of this vector with the feature matrix. The top n1 method bodies whose dot products are highest are retrieved as the candidate set for recommendation.
  • Prune and ReRank: Aroma then ranks the retrieved code snippets from the previous phase based on their similarity to the query snippet.
  1. Code snippet recommended by Aroma is generated from several similar looking code snippets via intersection hence it increases the likelihood of appropriateness.

    Image – Aroma code recommendation samples

  1. Aroma does NOT require mining common coding patterns or idioms ahead of time hence It is not limited to a set of mined patterns it can retrieve new and interesting code snippets on-the-fly.
  1. Aroma is fast enough to use in real time. It first retrieves a small set of snippets based on approximate search, and then performs the heavy-duty pruning and clustering operations on this set. This enables to create recommended code snippets on a given query from a large code base containing millions of methods within a couple of seconds.
  1. Though Aroma is code recommendation engine,it could also be used to perform efficient and precise code-to-code structural search.
  2. On average, Aroma takes 1.6 seconds to create recommendations for a query code snippet. It has been evaluated using code snippets obtained from 5,417 GitHub Java Android projects and code snippets from Stack Overflow.

References :

More details about Aroma here

        1. Like this post? Don’t forget to share it!
Summary
Article Name
Why You Really Need Facebook's AROMA code-to-code search and recommendation tool
Description
In this post, we take look at key features of Aroma code-to-code search and recommendation tool
Author
Publisher Name
Upnxtblog
Publisher Logo
Karthik

Allo! My name is Karthik,experienced IT professional.Upnxtblog covers key technology trends that impacts technology industry.This includes Cloud computing,Blockchain,Machine learning & AI,Best mobile apps, Best tools/open source libs etc.,I hope you would love it and you can be sure that each post is fantastic and will be worth your time.

Share
Published by
Karthik
Tags: aroma

Recent Posts

Navigating Volatility: Investing in Crypto Derivatives and Risk Management Strategies

The cryptocurrency market is famed for its volatility, presenting each opportunity and demanding situations for…

1 week ago

How Game Developers Use AI in Mobile Games in 2024?

Games since time immemorial have been winning at captivating the users and teleporting them onto…

2 weeks ago

The Impact of AI on Software Development

We are living within an innovation curve wherein cutting-edge technologies are making a hustle and…

2 weeks ago

AI Tools for Research Paper Writing: Learn What They Can Do

Whether it’s the healthcare industry or the automobile sector, artificial intelligence has left its impact…

4 weeks ago

Embracing Innovation: 5 Ways AI is Transforming the Landscape in 2024

Facts only- The big Artificial Intelligence push is unraveling in 2024. No, it wasn’t merely…

4 weeks ago

The Startup Guide to Acquiring Exceptional Developers

In the fiercely competitive world of Hire Developers for Startup, success hinges not just on…

1 month ago

This website uses cookies.