9 ms·
I don't have a strong opinion on the article itself (it seems well-reasoned to me, but I don't use CoffeeScript personally so who knows)... but the comments att
by smacktoward 14y ago
I don't have a strong opinion on the article itself (it seems well-reasoned to me, but I don't use CoffeeScript personally so who knows)... but the comments attached to it are hilarious.
I think CoffeeScript has great readability, because I’ve taken the time to learn how it works.
If you have to take the time to learn how to read something, it's not easily readable.
CoffeeScript is only hard to read if you try to read it with a JavaScript mindset.
Yes, why would anyone approach a tool pitched explicitly at JavaScript developers, whose "golden rule" is "it's just JavaScript" (see the top of http://coffeescript.org/ http://coffeescript.org/), with a "JavaScript mindset"? Truly, it is a mystery.
- masklinn 14y ago> If you have to take the time to learn how to read something, it's not easily readable. I don't think that's completely true. If you're used to algol or C-style, Lisps tend to be hard to read. Concatenative languages even more so. Not necessarily because they're hard to read in and of themselves, but because the "shape" of the code is "all wrong" compared what you're used to, and your usual anchors (keywords, binary operators, infix assingment, ...) are nowhere to be found. I mean Arabic or Korean are not necessarily harder to read than English, but you've got to know them and how they work before you even recognize patterns in the squiggly lines and little squares.
- Daishiman 14y agoNot really; Lisp is hard to read because the syntax is unusual, but it's not hard to understand because it's complicated. On the contrary, it has the most consistent syntax of any language. They author's point is that Coffeescript is hard to read because it has too many edge cases which are not easily understood under a smalla and consistent set of rules. I have not programmed with CS, but it sounds like a convincing argument.
- wonderzombie 14y agoOr, to restate this and amplify it a bit, Lisp syntax is hard to read because most people are unfamiliar with it. This isn't -- or should not be -- a problem if you need to learn to read a language in order to use it. (This is orthogonal to whether you want to learn it in the first place, or whether you "ought" to.) It is a problem if learning how to read and write the language isn't enough. The point TFA raises is that people who're familiar with CoffeeScript syntax may still make mistakes resulting in completely erroneous but valid code. Yikes. And the inherent nature of whitespace or indentation makes the problem harder to detect by cursory inspection. I have no strong opinions about CoffeeScript, myself. I just thought this was an interesting distinction, and a rare case where syntax makes a significant difference.
- lmm 14y agoMere consistency is not enough. List is hard to read because humans do not have a natural feel for how deep a set of nested brackets are, and you have to be able to spot the matching open-bracket to understand the code.
- wonderzombie 14y agoAgain, it's hard to read if you are not familiar with it. Even as someone relatively new to Lisp, indentation and formatting makes a world of difference for readability. This isn't specific to Lisp, either. I posit that if you took your average C-like and removed indentation from any reasonably sized function or method (one or more loops, one or more if/else), you would have a hard time counting brackets.
- wonderzombie 14y agoI agree that consistency is necessary but not sufficient, though, which is what I think you're getting at. Most of the time, though, consistency is clearly better than inconsistency. There's less to remember or, if you prefer, less to screw up. :)
- masklinn 14y agoPlease note that I was not replying to TFA, I was replying to smacktoward's assertion that if you need to learn how to read a language it's not easily readable.
- jaequery 14y agoi'll stick to javascript. coffeescript doesn't add a whole lot to the table, javascript is the standard and that's a good thing, re-writing the language is not the answer in my opinion. i'd have to imagine that saving a few keystroke might sound sexy to lesser experienced developers, but that really is all it adds to the table. being able to code on any project immediately off the bat with a standardized language is a huge plus, in terms of flexibility and scalability. you don't want to limit your company to exotic language, only to later find out few months later another new language called "frapscript" is now the new cool thing to do. i recall the days when i was thrown into a project where the requirement was to use mootools, rather than jquery. even though they are both "javascript" in nature, it severely limited my productivity. i can see the same thing happening to companies trying out coffeescript, it may seem like you are doing the better thing long-term wise, but in reality, it is not so much. it's better to just stick to standards and you'll be more productive down the line, i can almost guarantee it.
- encoderer 14y agoYour last paragraph confuses me. So you had jQuery experience and were inhibited by working on a MooTools project. I get that, makes total sense. But then you say that switching to CoffeeScript may seem like a better long term choice but "in reality it is not so much." Surely MooTools would've been fine for you as a long term choice. Yes, there is a penalty to switching. Whether it's jQuery to MooTools, JS to CS, whatever. But that doesn't make it a bad long term choice. Also, CoffeeScript is more than just saving keystrokes. That makes it seem like it's all about initial up-front cost savings. Instead, it's about having shorter, more expressive code. That pays dividends for the life of a project.
- jaequery 14y ago"Instead, it's about having shorter, more expressive code." yes, but at the expense of a lot of other negative baggages that comes along with it. by having it's own compiler rather than leaving that to the browser seems like it's opening a can of worms. and just reading from the comments, i can see how we could soon see a birth of "another language", that's supposed to be solve all problems coffeescript'ers face. for one, i guess readability seems to be the common problem, which isn't good for productivity.
- wtetzner 14y ago> If you have to take the time to learn how to read something, it's not easily readable. What? What language can you read without knowing it first?
- smacktoward 14y agoIf you're used to one C-style language, it's generally not hard to read code written in another. This is not to say that you'll grok it 100% accurately on your first go, but another C-style language will be more readable to you than, say, a Lisp-flavored one would be.
- Evbn 14y agoOf course that "readability" leads to devs writing C in Java, or what have you, and naking subtle mistakes, instead of learning the new language. See Dijkstra's "On the cruelty of really teaching computer science"
- Evbn 14y agoOf course that "readability" leads to devs writing C in Java, or what have you, and naking subtle mistakes, instead of learning the new language. See Dijkstra's "On the cruelty of really teaching computer science"
- eswangren 14y ago...because, at one point, you learned to read C.
- tikhonj 14y agoSo is mathematical notation not readable? On the one hand, it takes quite a while to learn how to read it. On the other hand, it can condense literally pages of text into a few equations which somebody experienced can understand almost at a glance. The same is true for programming languages. Sure, anybody can read Python. But it's fairly verbose and attempts to mirror English. On the other hand, Haskell is somewhat terse and attempts to mirror mathematical notation. I've found that, after about the same amount of time with either language (about a year of off-and-on use for both), Haskell becomes far easier to read than Python. So just because something is easier immediately does not mean it is any more readable. It could, in fact, be less readable and merely more familiar!
- rdw 14y agoMathematical notation is not readable, no. It requires extensive training to be able to understand it, and even experts will take quite a while to comprehend a document they are not already mostly familiar with. It is not like you cross some threshold and immediately become able to understand all mathematical notation with equal ease. There's plenty of evidence for this; recently we had this quote about the ABC theorem: "It can require a huge investment of time to understand a long and sophisticated proof, so the willingness by others to do this rests not only on the importance of the announcement but also on the track record of the authors" (http://www.nature.com/news/proof-claimed-for-deep-connection-between-primes-1.11378 http://www.nature.com/news/proof-claimed-for-deep-connection...) Other examples that highlight how understanding of mathematical research involves much more than just reading: https://docs.google.com/viewer?a=v&q=cache:5NM3XjxAWfUJ:www.math.ucdavis.edu/~tlewis/rfg/jclub/read_math.pdf+&hl=en&gl=us&pid=bl&srcid=ADGEESgi8dTklxgiYanWIo7AnXM84H_TPs55T7WfXYxYoVTDKrRTaSEIwmtaPAOPto04_pgOw-nifQ6tz8BR9cTx9uz-5M7PQpmo-ASALBblyYRd_-gkUHrYYNe3aVxLYBW5liA381ny&sig=AHIEtbRMzKqWEwLJJLQ2UDyqoobtmMHUJQ https://docs.google.com/viewer?a=v&q=cache:5NM3XjxAWfUJ:... http://math.stackexchange.com/questions/13460/how-to-read-a-mathematical-paper http://math.stackexchange.com/questions/13460/how-to-read-a-...
- lloeki 14y ago> even experts will take quite a while to comprehend a document they are not already mostly familiar with Experts don't take time to read notations. They take time to understand the full scope of consequences embedded in a line composed of such a condensed and readable notation, within the frame of an otherwise complex proof. > Mathematical notation is not readable, no. I beg to differ. You mention the recent possible proof of the ABC conjecture, and I happened to browse through various materials on the subject. While I am far from being able to understand the crux of the proof, I can perfectly read the various components of it. In fact the notation system is so readable it actually helps tremendously in grasping concepts previously unknown to me.