Live data from Hacker News

Ask HN: What code do you frequently read?

news.ycombinator.com

51–60 of 64 posts

Re: Ask HN: What code do you frequently read?

#52
I read Magento's code (both 1.x and 2) every time I implement something for it. I seen some developers just started to write something, resulting the coding style been quite different than it should be. Reading the core also helps to get comfortable with the coding standard and naming conventions.

Also, Magento 2's code is beautiful, despite it's written in PHP :)

Re: Ask HN: What code do you frequently read?

#55
I enjoy reading well-written C code, and in my opinion, two very good examples are redis and the Quake 3 source (the same goes for all other id/Carmack code).

Reading the Quake stuff is doubly enjoyable thanks to Fabien Sanglard's excellent Code Review series: http://fabiensanglard.net/quake3/ (he's also done them for many (all?) of the other open sourced id games.

Re: Ask HN: What code do you frequently read?

#60
post #19

Golang stdlib is an excellent reference for how to write idiomatic Go code https://github.com/golang/go/tree/master/src

I write a lot of code and have an interest in new languages. I've looked in to Go quite a bit (especially since I spend a lot of time working with Docker) and I guess I might be missing something. Taking a random method here:

https://github.com/golang/go/blob/master/src/strings/reader....

Some questions that come to me when looking at that code:

- In general, why is everything abbreviated? Storage isn't an issue and IDEs solve the typing problem. It feels really old school. Plus you lose a lot of meaning throughout the code (r.prevRune is actually an index, so why not reader.previousRuneIndex, or at least r.prevRuneIdx)

- What is int64? A cast? Why would you need to cast what appears to already be an int?

- what is a Rune? Why are we setting it to -1? -1 just seems like a special number that would make this more readable as a constant with a relevant name.

- Where does copy come from? why does it appear to work backwards compared to any other language array copy implementation?

- Why does the last return statement return nothing?

I'm not here to start a language war, I truly believe it is my inability to see the forest for the trees, but I find Go code to be hard to read and understand.

Post reply on HN