Ask HN: What source code is worth studying?
141–150 of 176 posts
Re: Ask HN: What source code is worth studying?
#142Lots of great suggestions here, but I'm interested in how you go about reading source code, especially very large codebases?
http://www.amazon.com/Code-Reading-Open-Source-Perspective/d...
Re: Ask HN: What source code is worth studying?
#143Also can someone suggest what is the best way to approach code reading? When I open a library in Python, I am not sure where to start reading, just a bunch of files. Should I randomly pick one file and start reading from there? Is there any common strategy?
I load it into a repl and play around. See how changing little things effects tests. I add print statements to give a narrative. I draw diagrams of the code flow, especially startup, shutdown and sometimes error/exception handling.
Re: Ask HN: What source code is worth studying?
#144Earlier quoted context omitted.
Thanks for this list. I was mostly looking for Python, Javascript, Haskell and C#. Any help regarding that? Also, as I believe this thread will also help others, you can go ahead and post about any other code-bases for other languages.
Modules within the Python standard library are very well written. The source code also provides very good examples of decent unit tests.
Here is a link to cpython 2.7 libraries: http://hg.python.org/cpython/file/70274d53c1dd/Lib
Those that are implemented in C are in the "Modules" folder from the top level.
I think you [OP] will get the most benefit from reading libraries that you use often because it will give you some direction.
If there are 3rd party libraries you use heavily those will be interesting too.
It is very very difficult to just pick up megabytes of code and start reading them and find it useful. You will be able to pick up style and conventions but not really high-level engineering decisions.
My suggestion is to take software that you use regularly and run it through a debugger. Since you use it you know the problem domain. And with the debugger the code you're reading gets real context. I've done this with Git for example.
And also look at the design documents for big OSS projects.
Re: Ask HN: What source code is worth studying?
#145== 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…
OT question, what's up with programmers and "Zen and the Art of Motorcycle"? I usually finish all the books I start reading and this was one of the exceptions. After an idea saying something like "we can't define quality ergo everything is quality" or something of the sorts I had to put it down, nothing made any sense and it all seemed to be a grandiose philosophical scheme based on random half-baked ideas.
Re: Ask HN: What source code is worth studying?
#146I'd echo the advice to read the Arc source, and I'd add the various versions of Quake (C, C++). I learned a lot reading John Carmack's code.
Re: Ask HN: What source code is worth studying?
#147Earlier quoted context omitted.
Not at first. But work with people you like and respect, and learn from them. Then ask them when looking for your next job. Any place worth working isn't looking for the absolute best candidate for X at any cost. A good fit with someone with a good work ethic who wants to learn always works out better than just raw expertise. And a reference from someone you both respect is the fastest most reliable place to find the…
Whenever I hear this, I find I don't recognize the world the poster lives in. Is it a thing to tell coworkers when you're looking for a new job? If not, how many jobs do you need to have and leave before you have a big enough network for this to be a viable strategy? How do you get those jobs?
I have found user groups meetings a great place to network though. Everyone is helpful when someone says they are looking, even if it is that persons first time at a meeting.
Re: Ask HN: What source code is worth studying?
#148Re: Ask HN: What source code is worth studying?
#149== 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…
Re: Ask HN: What source code is worth studying?
#150Any suggestions for smaller codebases? A lot of these are great and you'll pick up idioms here and there, but they're massive .
Here is a link to the self hosted source code: https://www.fossil-scm.org/index.html/tree?ci=trunk