Live data from Hacker News

Ask HN: What code do you frequently read?

news.ycombinator.com

31–40 of 64 posts

Re: Ask HN: What code do you frequently read?

#32
Back when I was playing with PLDI, I would read the source code for the simpler garbage collectors out there as well as several I wrote myself. Amazing how touchy and error-prone it can be. It taught me a lot, because programming a garbage collector is as one source who I can't remember off the top of my head put it: programming with your back against the wall. Every memory allocation is serious business.

Re: Ask HN: What code do you frequently read?

#33
post #8

My goal is to complete a game in C++ using SDL2 this year, so i've been reading a ton of that on Github just to see how other people do it.

If you're not already following it, check out Handmade Hero (https://handmadehero.org/). Great, free video series from Casey Muratori that guides you through building a game from scratch.

Re: Ask HN: What code do you frequently read?

#35
post #8

My goal is to complete a game in C++ using SDL2 this year, so i've been reading a ton of that on Github just to see how other people do it.

If you're not already following it, check out Handmade Hero ( https://handmadehero.org/ ). Great, free video series from Casey Muratori that guides you through building a game from scratch.

I am following it, slowly but surely.

Unfortunately, he's up to day 75 and i'm still on day 11.

Re: Ask HN: What code do you frequently read?

#37
post #3

Usually you don't just go read source code for the heck of it. You read the source code either to contribute a feature or fix a bug. There's no point in reading the src otherwise because you won't find a good enough reason to try to fully understand it.

I've been reading the code for Pound lately, trying to get a handle on where I'm getting some latency events. I'm really wishing I had something like dtrace for OpenBSD, since all I have is ktrace. You can get timing info out of it, but to get what I really want, I'm going to have to add some utrace calls at the appropriate points.

Re: Ask HN: What code do you frequently read?

#38
post #19

Golang stdlib is an excellent reference for how to write idiomatic Go code https://github.com/golang/go/tree/master/src

My experience with learning Go so far has involved:

* Do the tour (tour.golang.org)

* Read 'How to Write Go Code'

* Try to write a simple, concurrent program (I went with a web crawler)

* Read 'Effective Go', stdlib code

And now I'm trying to make the concurrent web crawler distributed! It's a lot of fun so far.

Re: Ask HN: What code do you frequently read?

#40
I read a lot of JRE/JDK source code (through IntelliJ, which probably comes from OpenJDK) just to see how they implement their classes. For example, I found out a few days ago that Collections.sort uses a dual pivot quicksort that I had never heard about before. I'm going to check out some Go stdlib next, I had no idea that was open source. Oh, and possibly the OpenBSD kernel.
Post reply on HN