Live data from Hacker News

Ask HN: Where do I find good code to read?

news.ycombinator.com

101–110 of 216 posts

Re: Ask HN: Where do I find good code to read?

#101

One thing to look for are programs that use advanced techniques as opposed to programs that are just simply clear or well-commented. For instance, instead of learning a new programming language, you should learn how programming languages are made. Most of the secrets that computer science majors know that you probably don't were learned in compilers class. (Unfortunately many people are chasing the Holy Grail of "fun…

> and never finding it because "functional programming" is a pale shadow of what's possible when you understand how compilers work

My area so I'm extremely interested - please elaborate

Re: Ask HN: Where do I find good code to read?

#102
post #87
post #17

Give up on “good code”. Its pursuit is how junior devs pesters senior devs based on a delusion that such a thing is possible. Good code is working code, code that pays the bills. Focus instead on writing code you can throw away easily, code that you are wholly unattached to and is isolated enough that rewriting it won’t cost absurd hours.

This is what "top down" coding looks like. In "top down" coding you're told what to do by the boss, given too short a timeline, and forced to push something out the door. Congratulations on figuring out how to create a massive churn rate among your actual good engineers.

Give me engineers who value solving problems, sometimes with code, over “good” engineers every single day of the week.

Re: Ask HN: Where do I find good code to read?

#103
There was a blog post from Peter Seibel recently called [Code Is Not Literature)](https://gigamonkeys.com/code-reading/) which pointed out that although everyone seems to agree reading code is great, very few tend to do it regularly.

I feel like I get a lot more out of messing with / hacking on code than I do from reading it. I'm sure people vary, but I've got loads more out of open source contributions to sometimes small projects, and not very much out of trying to do something like read the code for the Glasgow Haskel Compiler or something.

So for code to read, I think having an in is crucial, at least for me. So I'd say, find a cool, maybe small open source project, look at the issue tracker if it has one, and try to implement something. You'll only really know if it's good code (or why) after you start trying to change it.

Re: Ask HN: Where do I find good code to read?

#105
post #36

Earlier quoted context omitted.

"write code that is easy to throw away" is generally a good piece of advice

With the caveat that "easy to throw away" means "easy to understand the implementation front to back so you can know the full impact of throwing it away without crossing your fingers"

I don't know about front to back, a good module should be explicit on what it affects and _ideally_ abstract its implementation. We were talking about what a module should aim to be, and that aim is a good proxy for a lot of properties of well architected applications, even when not perfected. And even when you don't plan to ever throw the module out.

Re: Ask HN: Where do I find good code to read?

#106
post #9

Peter Norvig's Pytudes was recently posted here. I think that's some of the best code I've read, although they're only small problems and not a bigger project. Still very much worth a read, he goes through the whole problem solving through code process. https://github.com/norvig/pytudes

I second this; there's a lot one can learn about how to think about problems from Norvig's Pytudes.

Re: Ask HN: Where do I find good code to read?

#107
post #93

Earlier quoted context omitted.

> Unfortunately many people are chasing the Holy Grail of "functional programming" and never finding it because "functional programming" is a pale shadow of what's possible when you understand how compilers work: this is how Common LISP and scheme are so much more profound then, say, Haskell Huh? What does this even mean? Both languages are very different from each other and the only thing they really have in common…

I've met a few young programmers who heard somewhere that object-oriented programming was bad and they want to get the enlightenment of functional programming that they've heard about. Frequently they travel from job to job like itinerant martial artists always looking for somewhere where they practice the true technique but they always seem disappointed as it is just as easy if not easier to screw up handling errors…

What are these iternant code students trying to achieve with all this? Performance? Productivity? Lower defects?

Safety critical code seems to still be usually in C/C++, for reasons having nothing to do with the language being safe. Why are these people not studying Erlang, MISRA C, Rust, some kind of formal proof solver language, or OpenCL?

What do people aspire to one day work on that would make the Haskell or LISP more appealing than a more locked down, static checking, kind of language?

Programming culture is more confusing than the code itself!

Re: Ask HN: Where do I find good code to read?

#108
post #17

Give up on “good code”. Its pursuit is how junior devs pesters senior devs based on a delusion that such a thing is possible. Good code is working code, code that pays the bills. Focus instead on writing code you can throw away easily, code that you are wholly unattached to and is isolated enough that rewriting it won’t cost absurd hours.

I am a self taught LAMP guy that wrote a mini saas that 34 companies pay for and use. It pays the bills, and works surprisingly fast compared to most CRMs, but I can assure you, it is not good code. Even I'm pissed how shitty I let it get.

every journey starts with a single jira. -C#onfucius

Re: Ask HN: Where do I find good code to read?

#109

I'm sorry these are videos, but your question made me think of these. If you're looking for programming inspiration I love these videos Jon Bentley - Three Beautiful Quicksorts https://www.youtube.com/watch?v=aMnn0Jq0J-E Bret Victor - Inventing on Principle https://www.youtube.com/watch?v=PUv66718DII

OP might also be interested in Bentley's book, Programming Pearls:

https://www.amazon.com/Programming-Pearls-2nd-Jon-Bentley/dp...

Re: Ask HN: Where do I find good code to read?

#110
post #93

Earlier quoted context omitted.

> Unfortunately many people are chasing the Holy Grail of "functional programming" and never finding it because "functional programming" is a pale shadow of what's possible when you understand how compilers work: this is how Common LISP and scheme are so much more profound then, say, Haskell Huh? What does this even mean? Both languages are very different from each other and the only thing they really have in common…

I've met a few young programmers who heard somewhere that object-oriented programming was bad and they want to get the enlightenment of functional programming that they've heard about. Frequently they travel from job to job like itinerant martial artists always looking for somewhere where they practice the true technique but they always seem disappointed as it is just as easy if not easier to screw up handling errors…

> which is so crazy-complicated primarily because the Drools language is Java-based so you need all sorts of things that Clara or CLIPS don't need

from drools website

"Drools is a Business Rules Management System (BRMS) solution. It provides a core Business Rules Engine (BRE), a web authoring and rules management application (Drools Workbench), full runtime support for Decision Model and Notation (DMN) models at Conformance level 3 and an Eclipse IDE plugin for core development."

No expert here, but it doesn't come across as a fair apples-to-apples comparison.

Post reply on HN