8 ms·
Aroma: Using machine learning for code recommendation
- mlthoughts2018 8y agoThe primary use case I experience for searching for idiomatic usage patterns is to know how to do a higher level refactoring, meaning I don’t want results that have syntax tree similarity to what I’ve got or even the small bit I start from to create the query. I want the intention of my search query but expressed in a better design. Separately, for very micro-level idiomatic things, like use of a certain data type operation or efficient constructor patterns, I need to search by natural language descriptions of the subtle differences between options. This is what makes Stack Overflow so helpful, the accompanying natural language description of intentionality or special cases, even if the code that is found isn’t precisely what’s needed, it demonstrates directionally what to do. This tool seems like yet another example of trying to force machine learning solutions to problems nobody actually has. Considering the idea that I’d need to integrate this into my coding environment, I’ll say No Thanks!
- xpaulbettsx 8y ago> This is what makes Stack Overflow so helpful, the accompanying natural language description of intentionality or special cases, even if the code that is found isn’t precisely what’s needed, it demonstrates directionally what to do. You're entirely right, but if you're in an incredibly huge monorepo like Facebook, this information literally doesn't exist; that's part of the problem that Aroma is trying to solve - "how can we show people the Facebook App Way To Do That Thing, even if That Thing doesn't have current documentation" (Disclaimer: I worked on the coding environment UX for Aroma)
- mlthoughts2018 8y agoWouldn’t it make more sense to spend the effort annotating these things? Or building models to provide the annotation? I mean, I work professionally in embedding models for computer vision and NLP, and my reaction to the article is that this seems like totally the wrong approach. You’re putting all this effort to create the embedding model out of the part that is both most superficial and least human interpretable (the AST).
- franklsf 8y agoBuilding models for natural language _and_ code for either NL/intent-based code search or automatically annotating code is indeed another hot research area! I'd argue Aroma solves a different problem in that it surfaces more idiomatic patterns based on the code you already have. This also can be important especially in production environment, when you need to do things "the right way".
- cyc115 8y agoIt would be very helpful to help figure out how to do things in a large codebase with little documentation.
- jboggan 8y agoThe most interesting (and I think difficult) approach here is properly representing the ASTs as vectors. There is a lot more possible when you get this right.
- markphip 8y agoIf people are interested in this area and not already aware, there has been an Eclipse project that operates in this general area for a while. https://www.eclipse.org/recommenders/ https://www.eclipse.org/recommenders/
- steve76 8y agoWhat would be nice is if could write recommendations automatically, then you pick and choose which one you want. You could scaffold a project, and it runs, and then you check back to see what it recommends.
- bitL 8y agoThat's a pretty cool approach! Thanks for sharing! ;-)
- konamicode 8y agoSeealso: IntelliCode for Visual Studio.
- browsercoin2019 8y agoI also found for Code, https://visualstudio.microsoft.com/services/intellicode/ https://visualstudio.microsoft.com/services/intellicode/ however when I try to install it on Mac OSX, I get Couldn't find a compatible version of Visual Studio Intellicode - Preview with this version of Code
- bshipp 8y agoWas anyone able to find a link to Aroma in that document? I found the colours made it very difficult to differentiate the links from the text and I couldn't find it. A quick search through Facebook's profile on Github turned up nothing.
- franklsf 8y agoThere's a paper describing the approach in detail <https://arxiv.org/abs/1812.01158> https://arxiv.org/abs/1812.01158>, but Aroma itself is not open source yet.
- franklsf 8y agoSorry, HN screwed up my URL: https://arxiv.org/abs/1812.01158 https://arxiv.org/abs/1812.01158
- bshipp 8y agoGreat, thanks very much for finding that paper. Hopefully Facebook follows this up in the not to distant future with at least a rudimentary example. I can learn from a paper, but I learn much faster from an example!
- spott 8y agoI want something like this for math. Write an equation, or a definition and see a bunch of different 'versions' of that snippet and where they are being used. This would help so much with understanding concepts and merging fields. It is way too common for different fields to independently "discover" some concept and be completely ignorant of all the work that has been done on that concept by some other field.
- andrewnc 8y agoThat's actually a fascinating idea. Do you think it would have to operate on PDFs? How would that work without the LaTex source?
- fspear 8y agodoesn't wolframalpha give you something like this?
- tbenst 8y agoCheckout the work on homotopy type theory and proof assistants like Coq
- ihaveajob 8y agoIt reminds me of Haskell's type based function search: https://hoogle.haskell.org/ https://hoogle.haskell.org/
- saagarjha 8y agoOne danger I can see coming up is that if someone writes incorrect code it could end up propagating throughout other codebases. I guess this is still an issue without automatic tools, but I feel like this might make it easier…
- deleted 8y ago[deleted]
- mpolichette 8y agoIf you discover a better pattern, it might be easier to convert across the application if the same pattern is followed everywhere. So you might consider this a win.
- franklsf 8y agoAroma would only surface what it thinks is "idiomatic" coding patterns. So if you have many instances of incorrect code, you might already be in trouble :)
- taneq 8y agoGiven how many "everybody does X wrong" articles we see here, I think we're already in trouble. :P (Thinking specifically of the "binary search in the Java API was broken for X decades" one with the integer overflow.)
- muratsu 8y agoFrom what I read, it's doing search & clustering on AST based feature vectors. I'm a bit lost on the learning part, how does the system improve over time?
- seanmcdirmid 8y agoI’m guessing by learning the vectors over lots of ASTs?
- usefulcat 8y agoSeems like this could be a useful feature for Github, BitBucket, etc.
- azhenley 8y agoIf anyone wants to get a PhD in this topic, let me know :)
- jdc 8y agoYour website is the first I've heard of "Information Foraging" as a field of study. Absolutely fascinating. Any recommendations on where I might dive into the topic?
- azhenley 8y agoA good start that is easy to read would be: An Information Foraging Theory Perspective on Tools for Debugging, Refactoring, and Reuse Tasks https://dl.acm.org/citation.cfm?id=2430551 https://dl.acm.org/citation.cfm?id=2430551 The paper applies IFT to software engineering, but IFT has also been applied to navigating websites or even physical offices. Use Scholar.Google.com to find a PDF of the paper if you don't have ACM access.
- mcritz 8y agoI was seriously considering this until I remembered something. Didn’t Tennessee pass a law saying they’d stop abortion in the event of rape, incest, even to save the mother’s life? Hard pass.
- yazr 8y agoNot for PhD, but for research purposes ;) Can u point out any work on refactoring existing code for reduced code complexity? Obtaining same (non)functional behavior using less code. EDIT: i will read the CodeDeviant paper
- azhenley 8y agoThe related work cited in the CodeDeviant paper may help. CodeDeviant itself is a tool to help programmers perform manual refactorings without unit tests (in a visual programming language), so it may not be helpful for you :)
- deleted 8y ago[deleted]
- ccozan 8y agoMaybe ontopic: I would like a voice controlled system that works with me. For example: saying, "I need a loop over a list" and promptly I get served in my text editor the loop. Or "I need to open a file and read contents". Or "Create an object ThisAndThat, with three properties" ... etc. Of course ideally would even ask for more details like, what kind of list is that, or how shall the file be read. How hard would be?
- patternmaster 8y agoChain a text-to-speech component to tranx and you're done Paper: https://arxiv.org/pdf/1810.02720v1.pdf https://arxiv.org/pdf/1810.02720v1.pdf Code: https://github.com/pcyin/tranX https://github.com/pcyin/tranX Live demo (try Django out): http://moto.clab.cs.cmu.edu:8081/ http://moto.clab.cs.cmu.edu:8081/
- sansnomme 8y agoThis seems to be a lot better those those Seq-to-Seq natural language to SQL networks. Can you elaborate more about them?
- JudgeWapner 8y agoI've envisioned something like this even for written code. Basically unify the language and the editor, so that you could (theoretically) right-click on main() and say "add loop" and have the correct code auto-generated. Not because a mouse is somehow better (it's much worse in fact), but basically an editor/UI that only allows you to produce valid code. Currently for most languages, we have: "type productions of a particular syntax and try really-really-hard to color between the lines, and subject yourself to the chinese-water-torture of syntax errors till YOU get better at it". Why not invert that, whether via mouse input, a visual (as in literally, visual, not microsoft-visual) connection, or a text editor that simply doesn't let you type invalid productions. Like Intellisense, but taken to the function or block level. You cannot save the file or even leave insert mode until the code compiles. Or even better, you cannot even temporarily input invalid syntax. From the first keystroke, it inserts a variable declaration, click/type up or down to choose a function call, conrol structure, etc. Some vim-like integration would go as follows: command mode: * <space>+F outputs a function called func1, auto-highlighted for you to rename (or accept default). * <space>+R on the func name lets you set its return type * <space>+A for args, * <space>+B to edit the function body At no point would you be allowed to input non-compiling syntax. Things like indentation would be non-issues, set uniformly by defaults.
- z3t4 8y agoIs this project open source? I would like to experiment with something like this to generate boilerplate code. Often when programming I copy something that already do kinda what I want, then modify it until it does exactly like I want.
- sabujp 8y agoi expect to see this in intellij and cider https://code.google.com/archive/p/cider-ide/ https://code.google.com/archive/p/cider-ide/ soon
- userbinator 8y agoInteresting. In typical Facebook style, they do not attempt to fix the root problem (there's too much code, and much of it has been copy-pasted) but instead expend even more resources just to allow (or even encourage) it to proliferate. The effort would be far better expended on a tool to refactor out all that duplication, because they've created something that can clearly identify duplication. It reminds me of how they hit a limit in the Android VM because their code had so many classes, and decided to work around it instead of reflecting (no pun intended) on how they ended up with so much code in the first place: https://news.ycombinator.com/item?id=5321634 https://news.ycombinator.com/item?id=5321634
- occamschainsaw 8y agoNot directly about the article but I am annoyed that the FB AI blog is very much a part of FB the social network. While reading the blog I got three useless notifications (boxes in the bottom left corner). The whole page has no other indication that I am logged into FB nor any option to log out.
- orliesaurus 8y agoI wonder if anyone from Kite.com is reading this and if they have any comments?
- pgib 8y agoPerhaps not as fancy, but I have been loving TabNine with Vim. (works with most editors) Its suggestions are scary good some of the time. https://tabnine.com/ https://tabnine.com/
- Dragna 8y agoWhat is the IDE they are using ?
- arno_app 8y agoI guess it's VS Code
- SethKinast 8y agoThat's Atom with Nuclide.
- deleted 8y ago[deleted]