Hacker News new | ask | show | jobs
by catwind7 2642 days ago
i generally avoid looking at other peoples code unless 1) it's written for teaching purposes and aims to teach a concept I want to learn or 2) I have to because i'm having integration problem

I think looking at well-written code is a great way to learn best practices, but I think it's quite hard to do that in practice and probably not the best way.

there's a lot of garbage code out there and even if the code is good, often times you find that it's super out of date (using an old ass version of a language) or the logic is pretty obfuscated by unessential (to you) backwards-compatability / cross-platform compatability checks.

there's also a great deal of context around the intent of blocks of code that you don't have when looking at open source code in isolation in the example you gave. Some lines might seem like nonsense until you read the PR and understand the tradeoffs made at that point in time.

1 comments

What if you're having trouble with an API, you don't look at code to see what kind of arguments a function needs? You just go to the docs? What if the docs are sparse?
see my point #2

> 2) I have to because i'm having integration problem

i'll prob go to the docs first and source code last. that said, my point isn't "avoid looking at source code". It's "I don't seek out source code of libraries for the purposes of learning".

if i'm trying to get stuff done, i don't give two shits how a third party tool wrote its fancy functions. that's the point of abstraction.

and most of the time, when i'm using third party tools i'm just trying to get shit done.