Python => SQLAlchemy Very clean, feature-rich yet pragmatic and well documented. https://github.com/zzzeek/sqlalchemy
Ask HN: What source code is worth studying?
131–140 of 176 posts
Re: Ask HN: What source code is worth studying?
#132Re: Ask HN: What source code is worth studying?
#133Re: Ask HN: What source code is worth studying?
#134Lots of great suggestions here, but I'm interested in how you go about reading source code, especially very large codebases?
Do you generate tags and hop around functions as you discover them? Do you do a high level overview of the important bits first, and then dive in later? I am sure it is different for everyone, but would still be interested to read about others approaches.
I've had this idea for awhile about bringing up a project in a methodical way in its source control history, and adding new features in a similar manner, so that it would be easier to introduce a codebase to those starting out in it. The problem with lots of large codebases is that as time goes on, configuration details or special cases are added on that obscure the meat of the program. If it were trivial to see the early version, and its evolution, it would be easy to pick out the mental model of what the code actually does.
Re: Ask HN: What source code is worth studying?
#135== Vim or Emacs == Just pick one and force yourself to use it to the exclusion of other editors. Future you will thank you later, because you'll still be using it 20 years from now. "We are typists first, programmers second" comes to mind. You need to be able to move chunks of code around, substitute things with regexes, use marks, use editor macros, etc. == 6.824: Distributed Systems == http://pdos.csail.mit.edu/6.8…
Wow, if you done all that, I want to see your code :) Particularly the distributed systems in Arc. Mind sharing a link to any code you have online (even if it's not that)? I took SICP a long time ago... all the pure functional stuff was great and elegant. I never really got how you can program "real world" / stateful stuff like distributed systems in Lisp dialects. When I look at Lisp code with hash tables and so for…
(Note: These html pages are rendered incorrectly on mobile. In particular, the spacing is wrong due to vimscreenshot not inserting instead of actual spaces. Sorry about that. Try viewing these links from a desktop computer instead.)
https://dl.dropboxusercontent.com/u/231528979/arc/html/index...
Lab 1 in Go:
client.go https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
server.go https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
tests https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
output https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
Lab 1 in Arc:
client.arc https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
server.arc https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
tests https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
output https://dl.dropboxusercontent.com/u/231528979/arc/html/locks...
Git commit log: https://dl.dropboxusercontent.com/u/231528979/arc/html/log.h...
All diffs between my local codebase and the stock arc 3.1: https://dl.dropboxusercontent.com/u/231528979/arc/html/all-d...
I was interested in seeing how much code can be eliminated by using Arc instead of Go. Turns out: quite a lot. The server is almost 200 lines of Go code, but about 65 of Arc. The client is almost 120 lines of Go, about 35 of Arc. The unit tests are pretty similar in length (~480 vs ~410) but the Arc version is easier for me to read since there's less visual noise.
Anyway it was fun.
Re: Ask HN: What source code is worth studying?
#136C++: (Complex software with elegance + performance )
Dart source code
V8 source code (Same people as Dart)
LevelDB
Chrome (the only downside: too much virtual dispatch -> "javism")
C: SQLite
Redis
Nginx
Solaris and Freebsd
Java: Rich Hickey implementation of the clojure runtime in Java
(it was there in 2009.. maybe now this is in clojure itself??)
Go: The Go standard librariesRe: Ask HN: What source code is worth studying?
#137Common Lisp - "Paradigms of Artificial Intelligence Programming" by Peter Norvig and "On Lisp" by Paul Graham
C - "C Interfaces and Implementations"
Minix 1 and XMonad are also very good suggestions too.
Re: Ask HN: What source code is worth studying?
#138Earlier quoted context omitted.
Actually, it's an important point. One way to learn a given coding technique is to copy-paste it into your own project, modify it until it works, and then delete it and re-implement it yourself. (The "delete and then reimplement it yourself" is the important part. Don't just copy-paste code!) That way you can build up an understanding of the code as you go, without having to understand it in its entirety from scratch…
I suspect that your suggested use of the code would fall under the fair use statute in 17 U.S.C. § 107 and the guidelines from Folsom v. Marsh since it seems explicitly for pedagogical or research purposes. IANAL, but if this were me it seems safe enough that I'd be willing to do it and fight Colin in court if need be. :)
But one quickly realizes that the concept of software license restrictions is a fundamental reason for the strength and momentum of open source software. Therefore, it must be true that a central tenant of being a good developer is to respect software licenses. Not merely respect them to the letter of how they're written, but to respect their spirit as well. If an author wishes you don't do something with their code, then you don't do it. There are plenty of reasons why this should be the case, but the most compelling for me is that it'd be lame to ignore the author's wishes while using their work, even if the author won't ever know about it.
If people are still feeling tempted to lift code, well... Remember that you only get to destroy your reputation once.
Re: Ask HN: What source code is worth studying?
#139Erlang: Riak https://github.com/basho/riak Riak is actually a layering of a few different projects including Riak KV, Yokozuna (Solr), Riak Core, etc. It was grown out of the Dynamo paper. Haskell: Snap https://github.com/snapframework/snap Snap is another project built in layers (snap-server, io-streams, snaplets, snap-core). The 1.0 release makes some pretty massive structural changes behind the scenes changes with…