4 ms·
Can anyone recommend good tools for reading code? I find github.com to be very klunky for this purpose, and even emacs/vim make the task much more troublesome t
by coder5506 10y ago
Can anyone recommend good tools for reading code? I find github.com to be very klunky for this purpose, and even emacs/vim make the task much more troublesome than it could be. Is there such a thing as a "read-only IDE" anywhere out there? (Ideally features would include click-to-definition, navigate back and forth, add bookmarks and annotations.)
- japhyr 10y agoThis is a great idea, if it doesn't already exist. Edit: On a little further reflection, it would be really fun to build. I can imagine a site called something like readgithub.org, which is a dedicated site for reading the code hosted in github repositories. You could start focusing on projects in one language only.
- jakub_g 10y agoI recently came across something like that for opensource Java code, called `grepcode`: http://grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/8u40-b25/java/util/HashMap.java#HashMap http://grepcode.com/file/repository.grepcode.com/java/root/j... It supports quite a big number of Java code repositories it seems. Edit: Also sourcegraph (linked in a link in a sibling post) does something similar: https://sourcegraph.com/github.com/gorilla/websocket/-/blob/client.go#L71:2 https://sourcegraph.com/github.com/gorilla/websocket/-/blob/...
- RBerenguel 10y agoYou can have all these in emacs and (probably) vim, as long as you configure them properly for the specific language bindings (for jump to definition). For bookmarks, there's functionality in both, same for annotations (IIRC you can use org-mode to create annotations, for vim not sure what but definitely there is something)
- vicda 10y agoComing from Visual Studio, my impression is that a proper IDE should do all those things you mentioned. (minus annotations, but that's what comments are for) I am curious as to why you would want a read-only IDE though. I'd like to see what would be different if the IDE's focus was for reading a large code base rather than writing one.
- coder5506 10y agoYou're right, of course. I guess what I'm really longing for is ease-of-use and ease-of-setup. For ease-of-use, the default action is navigation (just like reading a web page) so that I can drill-down and mentally execute code not unlike being in a debugger. For ease-of-setup, I don't necessarily want to clone something, create tag files, and possibly install a language mode... I just want to read. Perhaps this seems a bit lazy, but I think of reading code as similar to reading books or articles: not everything is worth the same level of investment. Yes, some things I want to really get into, and get dirty running (or writing) tests, refactoring, and commenting. Other things I want to just (passively) read or even skim. I feel like a full IDE, or the recommendations in the parent article, lean toward the in-depth study that I don't find appropriate for every task. (It's been 20 years since I last used Visual Studio, so my understanding of its capabilities is obviously dated.)
- jlg23 10y ago> Perhaps this seems a bit lazy, but I think of reading code as similar to reading books or articles: not everything is worth the same level of investment. The point of reading code is to understand it. How to read code efficiently depends also on language and coding style. Which would require full blown IDEs just for proper code navigation. And honestly: If setting up an IDE for the language you want to read is too much trouble, programming is and therefore there is no need to read code at all. EDIT: When I review code that reads like a book, the programmer immediately makes into my hall of fame. Such code is so rare that its coders should be paid their weight in gold - per hour.
- pfranz 10y ago> The point of reading code is to understand it. There are varying levels of understanding (or desires to understand something). I use Python a lot. For a lot of the language and libraries my understanding is superficial; dicts have key/values, lists are ordered and mutable. As I use it more I'll dig more into specific parts as needed; how do lookups happen for a dict, how are lists allocated? If I downloaded cPython and read it top to bottom trying to understand everything I likely wouldn't retain those relevant parts I need. I also don't need to download and build all of cPython to answer most of those questions. Also, new projects get posted all of the time here. I'm curious about other languages and frameworks not because I need to know and understand everything, but I'm curious how I can approach something in a new way. It'd be nice to have a browsable interface on the web. Your argument here sounds like it would be against having syntax highlighting in anything that's not an IDE (like GitHub) because if you cared enough, just download it and open it in an IDE.
- mandudebruh 10y agothis chrome extension, octotree https://goo.gl/BZRqop https://goo.gl/BZRqop, is very helpful for reading code on github. Reading github is how I started learning how repos are structured and how to read other people's code when I was early in my cs degree.
- cbcoutinho 10y agoThis is awesome, thanks
- no_protocol 10y agoCheck out this recent comment and discussion. User TeMPOraL describes a similar wish and gets many nice responses. https://news.ycombinator.com/item?id=13020845 https://news.ycombinator.com/item?id=13020845
- coder5506 10y agothank you! that is a very helpful thread
- tmaly 10y agoI thought sourcegraph did something sort of like this.
- elliotec 10y agoWhy is vim more troublesome than it could be? With Nerdtree and Fzf/Ag plugins (or ctrl-P) I can't imagine how much easier it could get.
- deleted 10y ago[deleted]