Read your Standard Libraries
blog.codingforinterviews.com
blog.codingforinterviews.com
Unfortunately, for C this is pretty hard to do, at least for the GNU libc. I'm not trying to critique the implementation, but every time I dive in (generally to help someone on Stack Overflow) I'm confused and get to spend a lot of time searching the code.
It's obviously optimized for a great deal of other parameters before ease of reading, which I totally understand yet still am a bit sorry to see.
I was just reading DJB's daemontools (less than 6K LOC, very tidy!), and he doesn't use libc. Actually his code has been collected in libdjb, which seems quite nice:
And also the Plan 9 / Go guys don't use ANSI libc as far as I remember.
Those are two examples of people who don't even use the ANSI libc interface. But there are plenty of people who don't use GNU libc, and use uclibc or various other source-compatible alternatives. I think Debian switched to eglibc awhile ago.
[1] - https://groups.google.com/forum/#!msg/golang-nuts/H-NTwhQVp-...
http://code.google.com/p/go/source/browse/include/libc.h
Which is definitely not ANSI libc. Go programmers won't care about this, because it's an implementation detail, but we're talking about reading source code.
It's a public domain C library, much smaller and less of a monster than glibc, plus you don't have to worry about any implications of reading GPL code.
The Java standard library is interesting and easy to jump into if you work with it every day. Guava is another good library to study.
I personally spend a lot of time looking at Riak, Cassandra, Hadoop, and Postgres since developing databases is my day job. I also follow mailing lists for both developers and users to understand the real world outcomes of their design choices and use that to inform how I think rather then going into every problem a blank slate.
Not to mention the horrible naming conventions (leading double underscores everywhere).
I often think about a C++ standard library written for educational purposes with proper naming, focus on readability instead of optimization, and maybe multiple possible implementations of certain specs.
http://apcentral.collegeboard.com/apc/members/courses/teache...
But IMO, naming is one of the hardest work.
http://www.gnu.org/software/libc/manual/html_node/Reserved-N...
In your opinion, what are some good starting points for interested Ruby readers ?
To be clear, there are good and bad parts of the standard library, just like there is all code. But much of it is basically a time capsule.
Ruby has so much utility wrapped up in places like Enumerator, that you don't see a lot of examples of low-level data structure implementation in the wild. You could look at MRI Ruby, you'd be looking at a lot of C, which tells you a lot about how Ruby works, but doesn't show you much actual Ruby. That's where Rubinius is really great. You get to see how a smart team would implement Ruby... in Ruby.
1. Easy access to standard libraries
2. Most (not all, re: java.util.Date) of the standard libraries are well thought-out and the documentation is top-notch
3. Tools like Maven + Eclipse/IntelliJ can provide insight to Java libraries source code easily (Maven has built-in capabilities to download the javadoc _and_ the source code from the designated Maven repository if the author publish them correctly).
Access libraries (3rd party or well-known ones) are a shortcut away.
PS: NuGet had this capability recently, which is great, but I rarely use it so I don't know how easy and to what extend NuGet can replicate what Maven has.
I learned a lot by reading the source code for Python dicts (which also comes with a lengthy motivation for why it was implemented that way) and any Haskell library (Hackage links from the manual page directly to the source code for the respective function, which makes it very easy to see what is happening).
Walkthrough of the implementation: http://www.laurentluce.com/posts/python-dictionary-implement...
However, what in the case of JavaScript/Node.JS developers? What could/should they read to help them understand their language/frameworks better?
I've been reading through the Express source code lately to understand the module better. I'm wondering what other source code I could read to get a better grasp on Node/JS.
Thoughts?
I think CMUCL had a really interesting and unique hash implementation that relied on two identically sized arrays, one for the keys and data, and another for a "next" index that showed you where to go for a key collision.