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

Social Media Marketing: A Key to Business Success with Easy Digital Life

In today's digital-first world, businesses must adopt effective strategies to stay competitive. Social media marketing…

8 hours ago

Best 7 AI Tools Every UI/UX Designer Should Know About

62% of UX designers now use AI to enhance their workflows. Artificial intelligence (AI) rapidly…

2 days ago

How AI Enhances Photoshop Workflow: A Beginner’s Guide

The integration of artificial intelligence into graphic design through tools like Adobe Photoshop can save…

2 weeks ago

The Rise Of Crypto Trading Bots: A New Era In Digital Trading

The cryptocurrency trading world has grown significantly in recent years, with automation playing a key…

3 weeks ago

Real-World Insights on White-Label NFT Marketplace Development

The non-fungible token (NFT) market has witnessed explosive growth over the past few years, transforming…

3 weeks ago

Finding the Right Time to Build Your Software Instead of Buy

There are few things as valuable to a business as well-designed software. Organizations today rely…

1 month ago

This website uses cookies.