Generic Category (English)728x90
Introduction to TensorFlow for AI, ML, and DL.
Blockchain Council announces 25% off SITEWIDE,sale is valid until 20th May 2019.Use Coupon Code - 2yrsblockcouncil Blockchain Certification

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.
Aroma code recommendation engine

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.

    Parse tree representation of the code

    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.

    Aroma code recommendation samples

    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
Why You Really Need Facebook's AROMA code-to-code search and recommendation tool
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
%d bloggers like this: