6 ms·
500 Lines or Less
- archos1 10y ago*500 Lines or Fewer https://en.wikipedia.org/wiki/Fewer_vs._less https://en.wikipedia.org/wiki/Fewer_vs._less
- arsenerei 10y agoFrom your reference. > However, descriptive grammarians (who describe language as actually used) point out that this rule does not correctly describe the most common usage of today or the past and in fact arose as an incorrect generalization of a personal preference expressed by a grammarian in 1770. > Many supermarket checkout line signs, for instance, will read "10 items or less"; others, however, will use fewer in an attempt to conform to what is incorrectly perceived as required by the prescription although this is in fact a clear case of hypercorrection as explained in Pocket Fowler’s Modern English Usage. > Less has always been used in English with counting nouns. Indeed, the application of the distinction between less and fewer as a rule is a phenomenon originating in the 18th century.
- deleted 10y ago[deleted]
- jimminy 10y agoIt's still valid using less, though we could pedantically argue senantics. Lines of code is often used as a term of expense, or expressing a form of cost associated with technical debt. In that context, saying, "500 Lines or Less", is similar to "$50 or less".
- dexterdog 10y agoIs there any other way to argue semantics?
- Bromskloss 10y agoI guess "less" makes sense if you're talking about the amount of code, rather than about the number of lines.
- deleted 10y ago[deleted]
- curiousgal 10y agoThe 'Fewer' has the advantage of being grammatically correct, but it loses the pleasant alliteration :) This is a working title; we'll use this input at late-binding when we finalize what we're going to call this. https://github.com/aosabook/500lines/issues/55 https://github.com/aosabook/500lines/issues/55
- thomasahle 10y agoJust "500 Lines" also sounds better.
- dmolony 10y agoOr even '500 lines, max'.
- Bromskloss 10y agoIs there a compiled version somewhere? I don't think I will be able to build this on my phone.
- curiousgal 10y agoI couldn't build it on my laptop. I'd have to install 3.5Gb of Tex dependencies to do it so I'll pass.
- oneeyedpigeon 10y agoMe, either. Tried on OSX. Thought I'd get away with installing ~ 0.5 Gb when I read up about everything, but still run into problems. This is a book people. I shouldn't really need to compile it; even if I absolutely must, it should be at least possible, if not fairly straightforward. Disappointing.
- detaro 10y agoIt is not finished, so they haven't released a complete version yet, but previews of the individual chapters are on their website: http://aosabook.org/blog/ http://aosabook.org/blog/
- drauh 10y agoI was able to build on OS X with Fink's texlive. Output seems to be the same as the PDF already posted here (in a Dropbox link). No joy on epub, mobi, or html.
- Nullabillity 10y ago> This is a book people. I shouldn't really need to compile it; As opposed to what, exactly? txt files?
- satai 10y agoEarly Access: http://aosabook.org/en/500L/ http://aosabook.org/en/500L/
- falcolas 10y ago> canonical problem in software engineering in at most 500 source lines of code 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. 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. 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).
- fermigier 10y agoYou probably misread the intent of the book editors and writers. As @debo_ wrote above: "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."
- genos 10y agoLooks 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.
- nine_k 10y ago500 lines of what? 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. 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. (Edited: fought autocorrect.)
- JoeAltmaier 10y agoGood point. Tangentially, assembly language is extremely modal. Logic can be coded in almost exactly the same number of lines as any high-level language. Compare-and-branch is a single line as in any language. But compositing data (building argument lists or structured data) can be exhaustingly wordy. A single call with 2 or 3 arguments can take a hundred lines of assembler. So it all depends.
- userbinator 10y agoAnd even Asm, while traditionally one-instruction-per-line, can have macros and some syntaxes like RosAsm's allow more than one instruction per line: https://upload.wikimedia.org/wikipedia/commons/5/50/RosAsmTreeView.png https://upload.wikimedia.org/wikipedia/commons/5/50/RosAsmTr...
- chrisseaton 10y agoWhat on earth do you think this is? It's not a research hypothesis. Nothing is being measured. It's a clever way to get people to show that ideas many people think are beyond their understanding can be illustrated in just a few lines of code. 'Cyclomatic Complexity of N or Less' would work against that goal as it says nothing about length and is hard to explain. What a mindless criticism of a worthwhile project.
- nine_k 10y agoI'm actually all for books like this.
- 10y ago
- debo_ 10y agoHi, I'm the editor of 500Lines. Thanks for posting this! A few notes: - 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. - 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. - The "or less" moniker is grammatically a bit offensive but sounds cute on paper, so we kept it. - If you'd like to learn more about the philosophy or story behind this volume, Ruby Rogues hosted us a little while ago: https://devchat.tv/ruby-rogues/256-rr-reading-code-and-the-architecture-of-open-source-applications-with-michael-dibernardo https://devchat.tv/ruby-rogues/256-rr-reading-code-and-the-a... - 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: https://github.com/aosabook/500lines/issues/212 https://github.com/aosabook/500lines/issues/212
- AstroJetson 10y agoSkipping over the semantics of the title, and the war over the languages (btw, all programs can be written in one APL line), I thank you and the other authors for your work. If you are looking for other things to write, I'd like to suggest a simple editor and a text translator to go from one markup to another, which at the end could be combined to be a WYSIWYG editor.
- nojvek 10y agoWill this ever be able as a git book?
- dowjones123 10y agoI want to know as well
- bogomipz 10y agoThis book(and indeed the rest)is neat! Great work, looking forward to the finished copy.
- divkakwani 10y agoHere is a link to the pdf: https://dl.dropboxusercontent.com/u/29696071/500L.pdf https://dl.dropboxusercontent.com/u/29696071/500L.pdf
- deleted 10y ago[deleted]
- arve0 10y agoThis is "The Performance of Open Source Applications", not "500 Lines or Less". Edit: An older version?
- divkakwani 10y agoThis is 500L indeed. Don't know why the cover says POSA.
- amelius 10y agoOfftopic. 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? Edit: Could we take the convention on HN to always link to the README in a github repo? In this case that would be: https://github.com/aosabook/500lines/blob/master/README.md https://github.com/aosabook/500lines/blob/master/README.md
- deleted 10y ago[deleted]
- ams6110 10y agoWell, it's the first thing you want to read about the first time you visit the project. The rest of the time it's probably the last thing you are interested in.
- marssaxman 10y agoI considered Github links to be essentially content-free noise for several years because I did not know about their "README.md" convention. I think that people who live and breathe github probably don't realize how confusing their interface can be to a newcomer.
- mjrbrennan 10y agoYou didn't think to just scroll down?
- marssaxman 10y agoI didn't know to scroll to the bottom, as I had never used github and was unfamiliar with its interface. I thought it was basically just a prettier version of the classic auto-generated "index" page for a directory, so it didn't occur to me that there would be more to it than the file list if I scrolled down.
- pc86 10y ago> I didn't know to scroll to the bottom If only there was some sort of bar that could indicate your relative position on the page. Maybe in the same spot on all websites to make it easy to see. Maybe even part of the browser! In all seriousness this seems much less a GitHub issue and much more about how well you computers.
- sien 10y agoThis is a really interesting book by some brilliant people. I wonder if the problems selected are the ones that many people would select though. 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. A web browser? A compiler? A simple relational database?
- zem 10y agointerpreter for an interactive fiction language
- exabrial 10y agoHow about a competition to see who can write the clearest code for the next guy, in minimal lines of code?
- banthar 10y agoFrom: https://github.com/aosabook/500lines/blob/master/ci/code/helpers.py https://github.com/aosabook/500lines/blob/master/ci/code/hel... s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) s.send(request) response = s.recv(1024) s.close() Is that correct use of TCP? It seems to rely on response not being fragmented.
- smegel 10y agoNo it is not. You must keep reading from the socket until you have read as many bytes as required - he isn't even checking how many bytes recv returned.
- DSMan195276 10y agoIt's definitely not right as far as the C interface is concerned - and Google indicates that the Python interface doesn't do anything extra. That said, it probably does generally work considering the small size of the messages, especially if the dispatcher is run locally. It's unlikely that a two-byte or ten-byte message would get fragmented, though it technically could - and that's all that is sent by the dispatcher. That said, this should be a loop that combines all the responses until you receive a response of length zero, indicating EOF. The actual code to correctly handle this is really simple if you don't do any extra error handling - but it's not obvious if you haven't done some socket programming before. This code will probably work until the dispatcher and clients are expanded upon, resulting in more complex messages that eventually lead to sporadic fragmentation.
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]
- deleted 10y ago[deleted]