Top products from r/readablecode

We found 1 product mention on r/readablecode. We ranked the 1 resulting product by number of redditors who mentioned them. Here are the top 20.

Next page

Top comments that mention products on r/readablecode:

u/Neurotrace ยท 2 pointsr/readablecode

Regardless of if the code is contrived, it's still a possibility. I wasn't saying that I couldn't figure out if it was an if statement or an assignment. I was saying that I can more quickly parse one over the other if you end all of your statements with a semicolon.

I said I don't agree with much of his stuff but Crockford has written entire books on JavaScript so disagreeing with much of it still leaves a whole lot to be taken in to account. As I'm sure you've heard from others, I would highly suggest reading The Good Parts to see what he's all about. Perhaps saying "much" was a bit strong. Really I only disagree with his idea of placing all of your variables at the top of a given scope.

How can you say that code statements don't flow one after the other like sentences? The very notion of programming is that steps are executed "programatically" i.e. one after the other (we could argue about asynchronous code but the reality is that async code just adds a level of variability in the line of execution).

I find semicolon-free code less readable because, again, the moment I see a semicolon my brain automatically says "that's the end of the statement." For example: I might write some jQuery like this

$('#really-cool-thing').css('color', '#FFF')
.css('background-color', '#000')
.attr('value', 'Awesome');

Because I always end with a semicolon I automatically know that this is a chain and I don't even have to look at the beginning of the line to check if we're acting on a new object. Without semicolons, I have to scan back to the beginning of the line, check to make sure there's only a period, then continue to read. It adds more time and forces me to load just the tiniest bit more complexity into my head. Why should I "allocate" some of my mental memory to checking for where semicolons are going to be inserted when I can just insert them myself and never even think about it?

Most C based languages (i.e. most programming languages are semicolon terminated or, in the very least, semicolon separated. So if you program in any of these regularly then typing them in becomes second nature. I literally don't even notice when I type a semicolon anymore.

If you have a background in languages like Python then I can see the anti-semicolon sentiment because while Python allows semicolons, it isn't considered "pythonic." Likewise, I would make the argument that although semicolons can be left out in JavaScript, it isn't considered "JavaScriptic" to do so.

Do whatever suits you best but I don't understand the idea of having to keep track of more things, no matter how small, in your head rather than covering your ass. In the case of the bootstrap code that I linked you to, it can also cause issues in minification if you don't use a minifier that puts in your semicolons for you. Finally, it does make your application a little bit slower because the parser has to read in the line break, attempt to read in the next statement, determine if it can be considered part of the previous statement, and if not rewind back and shove a semicolon in. But if you place it in explicitly then the interpreter reads it, automatically understands the statement has ended, and goes about its business.