Hacker Newsnew | past | comments | ask | show | jobs | submit | coder5506's commentslogin

It's a raster scan. Larger images are built one pixel at a time.


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.)


This 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.


I recently came across something like that for opensource Java code, called `grepcode`:

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/...


Check out this recent comment and discussion. User TeMPOraL describes a similar wish and gets many nice responses.

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


thank you! that is a very helpful thread


this chrome extension, octotree 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.


This is awesome, thanks


Coming 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.


I would generally agree an IDE should be the best place, but I've had trouble in practice. Maybe I haven't leaned on those features enough? My trouble with a brand new codebase (framework, language, or library) is sussing out separation of concerns (usually split between files/functions/modules) and flow of code. An IDE should definitely help navigate those things (sometimes you need to actually run the code and look in a debugger).

One reason a website might be more handy is skimming codebases you don't actually intend to build and compile. I do this to new projects all the time to stuff I see here (generally on GitHub). I'll also often look into the cPython codebase because I use Python, but it's very rare I have the need to download and build it.


You'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.)


> 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.


> 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.


[deliberately responding out of order]

> Your argument here sounds like it would be against having syntax highlighting

No, but syntax highlighting is just something that helps parsing a single page. I'm talking about "show documentation for function/var/whatever under cursor", "jump to definition", etc...

> 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 ....

That "digging" is what I am talking about. Code is rarely read sequentially; it's reading docs for functions/classes/vars, jumping to definitions and finding call-sites. To do this, you need a very good understanding of the target language by the "viewer"-tool. Thus: You need an IDE for proper code reading. And probably still a good grasp on /usr/bin/find for those things your IDE cannot help you with.


I still think I have different (lighter) needs when skimming code online. I do think an IDE would be the ideal solution. What I saw the parent looking for is a middle-ground, maybe you have something like VSCode, but cull out compilation, editing, and debugging to it loads more quickly.

> That "digging" is what I am talking about.

Those are examples I gave are where I don't need to navigate the codebase. The answer is in a single file. So far I manage with the current web interfaces. Locally, I'd use grep and vi. GitHub works ok, but it's hard (but possible) to compare versions or jump between files. Using Google Code or SourceForge I have trouble finding the "Browse" button to even find the code.


You 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)


Why 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.


I thought sourcegraph did something sort of like this.


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

Search: