5 ms·
Ask HN: Book of Programming Examples?
I was curious if anybody knows of a book that's comprised of a collection of well commented code from various languages. Sort of like a collection of short stories, but each 'story' is a snippet of code performing a particular task. Ideally the book would contain examples from various languages such as Java, C, C++, Python, Ruby....
Reason why I'm looking for this is I'd like to gain familiarity with other languages in case I ever encounter them. I try an take breaks from the computer an go for walks throughout the day and would love to be able to bring a book with me and I felt like this would be great since I can continue learning but it's something where I can hopefully finish looking over a section each walk or something. Also wouldn't hurt to see how procedures and best practices are carried out in various languages.
- smt88 11y ago"Well-commented" doesn't mean explaining how the language works, what the syntax means, what the standard library does, etc. That's what you'd find in the language documentation, textbooks, and tutorials. Just pick up an introductory book on each language and be sure it has lots of examples. Honestly, though, I don't think there's any point in becoming familiar with those languages. If you know how to program, you're probably familiar enough to read what's going on...
- dm03514 11y agoI like looking at design patterns in various languages, Examples are often short sweet and discrete https://github.com/faif/python-patterns https://github.com/faif/python-patterns
- Sean-Der 11y agoI am a big fan of Rosetta Code Here is an example with a good amount of entries http://rosettacode.org/wiki/Sorting_algorithms/Quicksort http://rosettacode.org/wiki/Sorting_algorithms/Quicksort
- thorin 11y agoThere used to be lots of cookbook type books like http://chimera.labs.oreilly.com/books/1230000000393 http://chimera.labs.oreilly.com/books/1230000000393 if you want longer examples getting annotated source code for open source projects for things like jquery or underscore. Look at github projects also.
- cafard 11y agoThe book Beautiful Code from O'Reilly Associates aims to do that. A glance into the book shows C, Java, Perl, Python, Ruby, and Scheme.