Hacker News new | comments | ask | show | jobs | submit login
Ask HN: RapGenius for code?
96 points by fizwhiz on Mar 21, 2015 | hide | past | web | favorite | 33 comments
I think RapGenius (i.e. Genius) is a really powerful way to arrive at a crowdsourced understanding of what content is. This works well for static content like lyrics of a song, text in some literature etc. I got curious what something like this might look like for code and after a cursory google, I stumbled upon Omniref, which looks like they're targeting this exact problem. Of course, they're aiming to provide a very comprehensive solution that scours and indexes the web to surface code that can be annotated. AFAIK, their solution works for Ruby and more recently Javascript.

I'm curious if this could be packaged as some github plugin that is language agnostic. Think of it as a persistent Q&A that holds a "conversation/discussion" on specific lines of code. Naturally, this feature is available when you send a PR to start a discussion, but once the PR is closed that's the end of the discussion. One problem code presents that other literature doesn't is the fact that it tends to be less static (i.e. code keeps changing over time whereas lyrics to a song may not.) If there were an elegant workaround to this problem (where prior versions of a line of code and its Q&A is cached so that an interested user could view what the past conversations were) I'm tempted to say that this could really streamline the learning and collaboration process when it comes to using/writing code.

Anyone here play around with this idea in the past? If so, I'd love to hear your stories. If not, anybody interested in joining me on hacking some POC up to see what this could end up looking like?




You can annotate code with the new Genius beta!

For example: http://genius.com/5077469/gist.github.com/RogerPodacter/3e8a...

And actually you can put "genius.com/" in front of ANY url to annotate that page. For example: http://genius.com/5077492/www.paulgraham.com/yahoo.html

There's also a chrome extension: https://chrome.google.com/webstore/detail/genius-beta/ccaokn...

You can sign up for the beta at http://genius.com/beta.

(Questions / feedback welcome – tom@genius.com)


But that code is just a html page you are annotating. What happens on a new commit. The annotations should persist somehow across code changes. That would require specialised solution for code annotation I suppose.


Well take this for example: http://genius.com/5079163/github.com/rails/rails/blob/master...

This annotation will always be on the version of active_model.rb at master, even if it changes.

And we try pretty hard to anchor annotations even when the underlying text changes. Here's a talk I did explaining our approach to "fuzzy annotation anchoring" if you're super interested: https://www.youtube.com/watch?v=FJyqfRcyYIQ

But it's definitely not perfect! Hit me up with suggestions: tom@genius.com


It would have to be a state-of-the-art code diff tool. I've never used a diff tool that can accurately track a line of code through big refactoring changes. They are really only good for small incremental localized changes.

I think that says more about the weakness of mainstream diff tools than it says about the problem. I don't really know how difficult it is, but I'm guessing just a slight amount of semantic understanding would get you way beyond the quality of current diff tools. Kind of sad that nobody is doing it. I use Perforce every day on a really large, old code base, and it's depressing how awful the differ and "blame" tool are. Especially because those tools's usefulness seems to increase in proportion to the size and age of the code base. I guess programmers are masochists; we really haven't put that much effort into our own tools...


My bit of feedback would be that having the annotation dialog cover any part of the code at all is going to create a lot of frustration. Omniref's side-by-side approach is much easier to read.


Hot damn that's badass. Just signed up for the beta. It's a shame that I work for a big corp with code behind the company firewall so prefixing a code repo link like httpS://github.bigcorp.com/code-repo/funstuff.py with "genius.com/" resolves to a 404.

Regardless, this looks really exciting. I'm going to annotate a bunch of stuff just for funsies.


Check out Sourcegraph: https://sourcegraph.com. It semantically analyzes code, makes it searchable, and lets you find usage examples of how others use it. One of the features we're planning to ship soon is commenting on pieces of code.

Because Sourcegraph understands the code at a semantic level, we can tie comments to a specific function/class/module and show the discussion history even as the specific lines of code change over time. Right now, we do comments for code reviews, but want to add this for any existing version of the code. I'm one of the creators of Sourcegraph and would love to hear any feedback/suggestions the HN community has to offer!


Hey, sourcegraph looks really neat! Another commenter provided the following example: https://sourcegraph.com/github.com/golang/go@ac452349e4f40c3...

I love the fact that I can hover over anything (primtive, function etc) which surfaces a blurb on what its accomplishing .

>> Right now, we do comments for code reviews, but want to add this for any existing version of the code

Any idea on when you may roll such a feature out? I'd be hugely interested in using something like this for my team.


We're shooting for sometime soon; it's high on our priorities list, and we'd love to find partners to help test out the feature. Want to shoot me an email at beyang@sourcegraph.com?


"Omniref (YC W15) Is Rap Genius for Code":

https://news.ycombinator.com/item?id=8821117



I wasn't able to locate an example (weak google foo i guess), so thanks for providing it. My only mild gripe with this is that the "code" is actually "static" on which the comments are being applied.

For most code bases, the code is bound to evolve and change, so I wonder what the version reconciliation model would look like if there has to be constant syncing between what's on GitHub and what's hosted on genius (how would we capture multiple versions for example). Moreover, it appears that genius is great for annotating lines, but doesn't have the same Q&A feel that Omniref does[1]. I think what would be of real value is having the Q&A hosted "closest" to the codebase which is why I was thinking about a GitHub plugin. This in turn automatically has the ability to reconcile any old/deprecated questions that were relevant when the code was old.

[1] https://tctechcrunch2011.files.wordpress.com/2014/12/screen-...


>weak google foo

At risk of being pedantic, it's "fu" as in "Kung fu", which loosely translates to English as something like "work and effort".


Duly noted.


Think the chaps at Sourcegraph are already on it. Here's an example:

https://sourcegraph.com/github.com/golang/go@ac452349e4f40c3...


This would be an awesome pedagogical tool.

I'm a student and often find myself struggling with pseudocode to the point that I end up writing it out by hand and annotating it in a similar fashion on paper.


I agree. Answer-hubs like stackoverflow have their own place, as do Git discussions for PR's. But I'm tempted to say that there's a gap for more effective collaboration in the "in-between parts" you know, where some new contributor takes a look at the codebase and says "Huh, why is this written like this?". Instead of chat/email, the entire conversation history can be preserved adjacent to the codebase itself without being intrusive.



And partially related to the task of understanding/navigating a code-base:

https://github.com/OpenGrok/OpenGrok


In an ideal world, this would be pointless because if the code requires "annotations", it should be rewritten, or annotations may be just a specific kind of comments in the code itself rendered in a specific way.

But in the real world, I think, the use case for annotations is when one group of people writes code, and another group of people annotates it because authors and collaborators can be opinionated, stubborn, lazy, or too busy, or there may be too much bureaucracy on the project, so it is much more realistic to just put annotations on some third-party website than to try to collaborate with the authors to add comments in the code or refactor it.


Something like Google Docs comments hanging off the side of the document? It fits less for the Rap Genius example since the annotations explain the line, and in code if the line needs explaining then it should have a comment within the code itself.

I like the idea for discussions, but does the discussion stay there? Would an individual line get bogged down in "stupid questions" that someone has to trawl through to find what they want? If it's on by default, would it just be annoying to those trying to read the code, and if it's off how many people would go out of their way to turn it on?

It's certainly interesting, anyway.


This is what I had in mind (lifted off of the techcrunch article on Omniref): https://tctechcrunch2011.files.wordpress.com/2014/12/screen-...

It's available if the person browsing the code is actually "interested" in looking at the conversations around a particular part of the code.


There are a lot of code review tools that might be suitably repurposed for this sort of thing. Lots of quality/community issue I expect though.


So I reached out to them about this a few months back - some of their engineers have pitched it and done it internally.

Check this out: http://genius.com/3410852/Genius-engineering-jobs-at-genius/...


So this would be something like "Literate Programming as a Service", then?


I'd never heard of that before, but just checked it[1] out and it looks pretty cool. I guess the only distinction I'd make is for cases where people have a bunch of code already written out, and someone comes in and says "Hmm, why was this written like this?" and the original dev (or some other contributor) can respond with answers that have votes and the possibility of follow ups. Basically like an HN discussion board where the highest rated/popular answers are up top and each comment can have its own children.

[1] https://en.wikipedia.org/wiki/Literate_programming#Example


I think it is a good idea - one piece of advice, do not make your UI black :)



i don't wana;turn.to look at yo face.man look atchyo mama man look at the phaze.

                                               by:kole


StackOverflow?


[flagged]


Even if they were idiots, so what? There is no proof that idiots can't be successful in business.


I would agree with you but Genius is actually a pretty great idea! So it doesn't matter.


> I think RapGenius (i.e. Genius) is a really powerful way to arrive at a crowdsourced understanding of what content is.

I dunno if I agree with that.




Applications are open for YC Summer 2019

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: