TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

500 Lines or Less

377 pointsby divkakwanialmost 9 years ago

11 comments

debo_almost 9 years ago
Hi, I&#x27;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 &quot;more&quot; (for some definition of more), but that does not make the lessons learned in the other chapters less interesting.<p>- The &quot;or less&quot; moniker is grammatically a bit offensive but sounds cute on paper, so we kept it.<p>- If you&#x27;d like to learn more about the philosophy or story behind this volume, Ruby Rogues hosted us a little while ago: <a href="https:&#x2F;&#x2F;devchat.tv&#x2F;ruby-rogues&#x2F;256-rr-reading-code-and-the-architecture-of-open-source-applications-with-michael-dibernardo" rel="nofollow">https:&#x2F;&#x2F;devchat.tv&#x2F;ruby-rogues&#x2F;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&#x27;d like to know when that happens: <a href="https:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;issues&#x2F;212" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;issues&#x2F;212</a>
评论 #11796919 未加载
评论 #11798130 未加载
评论 #11797882 未加载
评论 #11797516 未加载
评论 #11797442 未加载
评论 #11797064 未加载
bantharalmost 9 years ago
From: <a href="https:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;blob&#x2F;master&#x2F;ci&#x2F;code&#x2F;helpers.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;blob&#x2F;master&#x2F;ci&#x2F;code&#x2F;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.
评论 #11798602 未加载
评论 #11798563 未加载
divkakwanialmost 9 years ago
Here is a link to the pdf: <a href="https:&#x2F;&#x2F;dl.dropboxusercontent.com&#x2F;u&#x2F;29696071&#x2F;500L.pdf" rel="nofollow">https:&#x2F;&#x2F;dl.dropboxusercontent.com&#x2F;u&#x2F;29696071&#x2F;500L.pdf</a>
评论 #11798471 未加载
评论 #11797229 未加载
ameliusalmost 9 years ago
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:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;blob&#x2F;master&#x2F;README.md" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;aosabook&#x2F;500lines&#x2F;blob&#x2F;master&#x2F;README.md</a>
评论 #11798322 未加载
评论 #11798394 未加载
评论 #11798815 未加载
评论 #11798250 未加载
Bromsklossalmost 9 years ago
Is there a compiled version somewhere? I don&#x27;t think I will be able to build this on my phone.
评论 #11796958 未加载
评论 #11796851 未加载
评论 #11796570 未加载
sienalmost 9 years ago
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?
评论 #11798973 未加载
falcolasalmost 9 years ago
&gt; canonical problem in software engineering in at most 500 source lines of code<p>I&#x27;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 &quot;less isn&#x27;t always more&quot; line.<p>I can implement a lot of logic in 500 lines of code, but I won&#x27;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&#x27;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 &quot;the error checking left as an exercise to the reader&quot; (I&#x27;m not sure if this phrase is in the book, I plucked it from any number of poor college textbooks).
评论 #11797486 未加载
exabrialalmost 9 years ago
How about a competition to see who can write the clearest code for the next guy, in minimal lines of code?
评论 #11798847 未加载
archos1almost 9 years ago
*500 Lines or Fewer<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fewer_vs._less" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Fewer_vs._less</a>
评论 #11796507 未加载
评论 #11796509 未加载
评论 #11796562 未加载
评论 #11796508 未加载
评论 #11798397 未加载
评论 #11796516 未加载
genosalmost 9 years ago
Looks like there&#x27;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.
nine_kalmost 9 years ago
500 lines of <i>what?</i> 500 lines of APL &#x2F; J &#x2F; Q is enormous; 500 lines of Haskell &#x2F; Scala &#x2F; 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.)
评论 #11797011 未加载
评论 #11796750 未加载
评论 #11797627 未加载