Hi, I'm the editor of 500Lines. Thanks for posting this! A few notes:<p>- Code golf was strictly discouraged throughout the review process. When authors were faced with implementing functionality poorly to fit more in, we generally cut scope instead.<p>- 500 lines was selected as a limiting criteria because it is easy to specify and understand. You will see that the chapters written e.g. with Clojure do "more" (for some definition of more), but that does not make the lessons learned in the other chapters less interesting.<p>- The "or less" moniker is grammatically a bit offensive but sounds cute on paper, so we kept it.<p>- If you'd like to learn more about the philosophy or story behind this volume, Ruby Rogues hosted us a little while ago: <a href="https://devchat.tv/ruby-rogues/256-rr-reading-code-and-the-architecture-of-open-source-applications-with-michael-dibernardo" rel="nofollow">https://devchat.tv/ruby-rogues/256-rr-reading-code-and-the-a...</a><p>- The print version of this book (and the official launch on aosabook.org) should happen sometime in the next 4-6 weeks. You can follow this issue if you'd like to know when that happens: <a href="https://github.com/aosabook/500lines/issues/212" rel="nofollow">https://github.com/aosabook/500lines/issues/212</a>
From: <a href="https://github.com/aosabook/500lines/blob/master/ci/code/helpers.py" rel="nofollow">https://github.com/aosabook/500lines/blob/master/ci/code/hel...</a><p><pre><code> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((host, port))
s.send(request)
response = s.recv(1024)
s.close()
</code></pre>
Is that correct use of TCP? It seems to rely on response not being fragmented.
Here is a link to the pdf: <a href="https://dl.dropboxusercontent.com/u/29696071/500L.pdf" rel="nofollow">https://dl.dropboxusercontent.com/u/29696071/500L.pdf</a>
Offtopic. Why, in github, is the README always below the repository files, if the first thing you want to read about a project is the README?<p>Edit: Could we take the convention on HN to always link to the README in a github repo? In this case that would be:<p><a href="https://github.com/aosabook/500lines/blob/master/README.md" rel="nofollow">https://github.com/aosabook/500lines/blob/master/README.md</a>
This is a really interesting book by some brilliant people.<p>I wonder if the problems selected are the ones that many people would select though.<p>What would people here select as, say, the top 5 or 10 things to write in a short amount of code. Say perhaps in 1K lines of code.<p>A web browser?
A compiler?
A simple relational database?
> canonical problem in software engineering in at most 500 source lines of code<p>I'll reserve judgement of the book for when its in a form I can easily read, but this seems to come up on the wrong side of the "less isn't always more" line.<p>I can implement a lot of logic in 500 lines of code, but I won't be able to go back a month later and understand any of it, at least not without rebuilding the logic from scratch. And I certainly can't also implement the safety checks, corner cases, and tests in that line quota.<p>I would personally think there is more value in showcasing a single complete and well commented solution instead of a slew of partial solutions with "the error checking left as an exercise to the reader" (I'm not sure if this phrase is in the book, I plucked it from any number of poor college textbooks).
Looks like there's code in different languages, so the arbitrary 500 line count gets even more hazy. As an extreme case, consider 500 lines of APL vs. Java.
500 lines of <i>what?</i> 500 lines of APL / J / Q is enormous; 500 lines of Haskell / Scala / Ruby is quite a mouthful, 500 lines of Java or C is rather moderate, and 500 lines of assembly is precious little.<p>Also, since a line of code can contain zero or more statements, something like cyclomatic complexity, or just statement count, could give a better measure.<p>(Edited: fought autocorrect.)