3 ms·
So what's good example code? Sadly (and tellingly) it's not necessarily the most successful code (success comes from meeting user needs, not from good code), b
by 6ren 15y ago
So what's good example code?
Sadly (and tellingly) it's not necessarily the most successful code (success comes from meeting user needs, not from good code), but how else can you judge it, apart from reading it. This is made worse because it's hard to tell if code is necessarily complex without understanding the problem it solves, which may be complex. Further, if you don't yet know what good code is, how can you recognize it? Of course, if you are intelligent and reflective and try ideas out, you can learn from both code and bad - it's all raw material, grist for the mill.
IMHO the hard part of programming is understanding the problem to be solved. The solving is easy.
- dchest 15y agoSadly (and tellingly) it's not necessarily the most successful code (success comes from meeting user needs, not from good code), but how else can you judge it, apart from reading it. Schools have suggested reading lists. Do they have the same for code reading? Fortunately, on the Internet, we have experienced people to help us: http://www.hnsearch.com/search#request/all&q=%22good+code+to+read%22&start=0 http://www.hnsearch.com/search#request/all&q=%22good+cod...
- 6ren 15y ago> [suggested code reading lists] That's a good idea, but I haven't heard of one. I think the best thing is just to read a lot of code, good and bad. BTW did you check the result of that search?
- dchest 15y agoBTW did you check the result of that search? Haha, just skimmed through it, sorry. I remember threads on this topic, but it seems like HN search for this request failed to find them.
- cturner 15y agoInteresting. You could teach blocks of code in a similar manner to the way poetry is taught. "Why did the author do this?" "What effect do you get when reading this block?"
- lurker14 15y agoBeautiful Code: http://oreilly.com/catalog/9780596510046 http://oreilly.com/catalog/9780596510046
- silentbicycle 15y agoI usually recommend the source to Lua, SQLite, and the BSD userland utilities (grep, awk, etc.). For C, at least.