Live data from Hacker News

Replace CoffeeScript with ES6

robots.thoughtbot.com

91–100 of 178 posts

Re: Replace CoffeeScript with ES6

#91
post #74

Earlier quoted context omitted.

If you've got any sort of programming skill your js will only be concatenated on test and production builds, not on development. Your last paragraph makes little sense as you should never, ever be debugging a problem on live and I think minification has caused me a problem like twice in the 8 years since it's been popular. And it was pretty obvious when it did as the is wasn't even compiling.

> you should never, ever be debugging a problem on live Until you have to

Then you've done it wrong. Very, very wrong. You should be able to replicate your live environment locally and not being able to is a sign of a very broken development process.

I just cannot emphasise this enough. One of my skills is debugging, everywhere I've worked I've been one of the top debuggers if not the top debugger.

Never, ever debug on live. If you can't recreate the problem locally, you don't understand the problem yet. Keep trying to replicate it until you do. I'm talking days of trying, not 10 bloody minutes.

The key to all debugging, the very fundamental skill, is consistent replication. If you can replicate a problem consistently, you can fix it.

There's a class of problems where this isn't necessarily true, especially for desktop apps, but web development problems and javascript, you can almost always replicate locally.

Re: Replace CoffeeScript with ES6

#92

The reason that I like CoffeeScript is that it removes, what I consider, the unnecessary boilerplate of JavaScript and replaces it with a shorthand equivalent and good conventions. I feel that CoffeeScript is better at representing the intent of JS than JS. I can visually sift through CoffeeScript and understand the code much quicker than normal JavaScript, which in my opinion leads to more maintainable code. I'm not…

Ex-Coffeescript ,now Javascript with lot's of Python experience guy here.

The "I understand CS code much quicker" argument is a valid one theoretically, but In my opinion, it does not hold up practically that well.

CS got one thing wrong that Python got right: There are many ways to do things.

When writing CS, I understood MY CS just fine... but it always took me longer to understand the CS of other people. Sometimes even longer than JS. This is such a huge drawback, and even if there is coffeelint, for teams, this is deadly.

A lot of devs need to read a fair amount of foreign code. Even worse a lot of coffeescript writers also need to read and understand a lot of JS code.

Understanding and reading YOUR code slightly faster gets mitigated by having longer to understand foreign code.

While some JS purists fail to see that Coffeescript has some benefits, CS people also underestimate how "quickly" you can understand JS code, if you're experienced. It's all about what your brain is trained to do.

In my opinion, with ES6, I would argue for most people (ceteris paribus) it just makes sense to read and write JS exlusively, if you want to maximize output-productivity of a full, practical project.

Shaving off a couple of seconds "understand-time" of your personal, well written CS vs well written JS will just not compensate other things that will take you longer to do with CS.

Re: Replace CoffeeScript with ES6

#93
post #60

Earlier quoted context omitted.

Coffeescript's origin is in the Ruby community. The first interpreter was also written in Ruby. Ruby interpolates strings with #{} so that was a logical choice for Coffeescript. The significant spaces thing was ironic given that Python is kind of the biggest competitor of Ruby (×) in the modern scripting languages space. Personally it's the main reason I'm not using CS (or Python or HAML or Slim), transpiling is numb…

I don't understand why significant indentation is a bad thing. It's easier to read indentation than it is to try and match brackets in your head. The only times it bites me is when I accidentally mix spaces and tabs in the same block, which could use a warning.

I'm more into Ruby than in JavaScript even if I have 10 years of Ruby vs 20 of JS on my shoulders. In my experience Python is always easier to read than JS. It's easier than Ruby for the part that spares me from a silly looking sequence of end end end at the end of some nested block (but that : before a new indentation level looks silly too.)

The syntax of both Ruby and Python beat squarely any C-like language, even if Python looks strange to me. Perhaps is the mix of objects and functions that makes it look a little C-ish, or the many __name__ one has to write in same cases. Anyway...

I would do without JavaScript's {} () and ; or Ruby's end (which bugged me a lot 10 years ago) but unfortunately that easier syntax is offset by the too many times it came biting me with nasty bugs after I cut and pasted code around during refactoring. Or having to take really care of how many spaces I'm deleting to match the indentation level I must reach. The editor can't autoindent all the file for me. It's bad enough when I'm working in YAML files (the format of Rails's i18n db, another ironic choice) and I don't want to deal with it in all my codebase.

So in my experience significant indentation is evil because as a matter of fact is making me less productive. Lot's of people share the same feeling, lots of people are happy with that. No problem, there are so many choices that we can always pick what's best for us.

PS: I just thought that maybe an editor could autohide Ruby's end (or color it almost away) and still be able to autoindent code. Maybe I'll try to tell emacs to color end in dark blue (black background) and see what happens to code readability.

Re: Replace CoffeeScript with ES6

#94
post #74

Earlier quoted context omitted.

> you should never, ever be debugging a problem on live Until you have to

Then you've done it wrong. Very, very wrong. You should be able to replicate your live environment locally and not being able to is a sign of a very broken development process. I just cannot emphasise this enough. One of my skills is debugging, everywhere I've worked I've been one of the top debuggers if not the top debugger. Never, ever debug on live. If you can't recreate the problem locally, you don't understand t…

> Never, ever debug on live. If you can't recreate the problem locally, you don't understand the problem yet.

I am guessing you have not been exposed to highly complex live environments. What you say is largely true but you state it as an absolute fact, which is a bit naive. Live environments tend to be far more complex than test or local environments and sometimes that complexity is what creates the bug. Sometimes the only solution is to debug live, but of course that is a last resort.

Re: Replace CoffeeScript with ES6

#95
Minimizing javascript code using a minimizer currently cannot be done well in a guaranteed way, because the minimizer must make too many assumptions. Therefore, I think javascript is too dynamic for a web-language.

Unfortunately, they didn't solve this with ES6.

Re: Replace CoffeeScript with ES6

#96

Earlier quoted context omitted.

The things I hate most about CoffeeScript are the dash rockets and white-space significance. These are just opinions though. There are things I like about CS as well, like destructuring assignment and splats. Sometimes when I'm writing JS, I miss is, unless, etc... That said, I'd put my money on ES6 in the long run, though it doesn't really matter. People should use whatever makes them (and their team) happy and prod…

Significant indentation is a good thing. Haskell and Python do it too. It's much easier to read indentation than it is to match up pairs of brackets in your head. In other languages, if the indentation doesn't match the brackets, you'll naturally read the indentation first and get the wrong impression of what the code does. In those languages, the indentation is supposed to match the brackets anyway. Why be redundant…

Significant indentation is enough for me to avoid Python. It just doesn't have enough to offer vs. the available alternatives without significant indentation.

It's much easier to read indentation than unindented/badly indented pairs of brackets, but you're setting up a strawman - it's not either or - and then you tear down the strawman yourself by pointing out we match the indentation anyway.

My code generally is properly indented and has start/end markers (though I mostly write Ruby, so rarely brackets), but what makes me stay away from significant indentation is that in the 30+ years I've been coding, I've never gone long without coming across situations where indentation has broken "in transit" e.g. with cut and paste between systems in annoying ways, or someone loading the code into an editor that butchers the indentation with tabs using "non-standard" tab settings.

When that happens, I'd rather "get the wrong impression" than have the code be broken.

That's one reason I want redundancy. My tools can trivially and automatically fix the result of breaking indentation when the indentation can be derived from the code.

Additionally, I want the visual redundancy, much like I find it far more comfortable to read syntax highlighted code even though it conveys no additional information.

Re: Replace CoffeeScript with ES6

#97
post #88

Earlier quoted context omitted.

I'm sure this has been argued to death but the counter argument is invisible formatting changing behavior is a bad thing. Sure if you get your entire team to use spaces or the same tabs great but passing open source code around to lots of programmers some of which use tabs and some of which use spaces ends up leading to wasted debugging time when someone used a tab where they should have used a space or visa versa. O…

Python 3 does not allow you to mix spaces and tabs. I don't know if Coffeescript is similarly strict. I guess you've developed a habit where you're completely OK with having incorrect indentation a lot of the time, whereas I can't stand it. Just because it's easier to read for you doesn't make it easier for everyone, especially beginners.

I can't stand incorrect indentation either, but my experience is that it regularly happens anyway, and I'd rather not have that break my code.

And "incorrect indentation" has a very different meaning when the indentation is purely for presentation: As illustrated above, some people like to use the indentation to call out specific aspects of the code. That may be "incorrect" from Python perspective, but it is a way of visually providing additional information that is not available to you if you use a language that requires a specific indenting style.

Re: Replace CoffeeScript with ES6

#98
post #74

Earlier quoted context omitted.

> you should never, ever be debugging a problem on live Until you have to

Then you've done it wrong. Very, very wrong. You should be able to replicate your live environment locally and not being able to is a sign of a very broken development process. I just cannot emphasise this enough. One of my skills is debugging, everywhere I've worked I've been one of the top debuggers if not the top debugger. Never, ever debug on live. If you can't recreate the problem locally, you don't understand t…

Sometimes your problem turns out to be a problem with production hardware or wiring, or depending on interaction with external partners who may not be able to replicate their interactions accurately for your dev/test environment, or otherwise impossible for you to replicate in dev/testing without already having figured out what the problem is.

While I agree with your overall sentiment, in any kind of remotely complex environment you sooner or later come across problems that you have no sensible way of reproducing in dev, and which will require you to debug on a production environment without it saying anything about the quality of your development process.

Re: Replace CoffeeScript with ES6

#99

Earlier quoted context omitted.

I sure hope you're wrong. The unnecessary clutter of plain JS is just painful to look at. I can't remember how many times I've looked over a 40 line block of JS searching for a missing. When there are many )} )}; } ; } ; } -- it is just downright frustrating to be be wasting any time on what is effectively irrelevant syntax. With CS, it's indent and be done with it. It's like SASS vs. SCSS. Or Haml vs. ERB. I can't,…

Ditching all the useless lines of closing brackets and parenthesis is my favorite part of using coffeescript. Matching up brackets is a pain. The less I have to do that, the better.

My editors have had bracket/parenthesis matching for 30+ years, and automated indentation support as well. I don't get why anyone would do that manually.

Re: Replace CoffeeScript with ES6

#100
post #7

I give credit to CoffeeScript with really helping to push the ES specs forward and think it helped introduce more people to JS and grow the ecosystem. Heck, I used it for a year, liked it, and had it change some of my approaches to writing JS. That said, I hope it slowly fades into the background as more people go back to vanilla ES6 or go with something more powerful such as TypeScript (or Flux). With the progress a…

I sure hope you're wrong. The unnecessary clutter of plain JS is just painful to look at. I can't remember how many times I've looked over a 40 line block of JS searching for a missing. When there are many )} )}; } ; } ; } -- it is just downright frustrating to be be wasting any time on what is effectively irrelevant syntax. With CS, it's indent and be done with it. It's like SASS vs. SCSS. Or Haml vs. ERB. I can't,…

> "With CS, it's indent and be done with it"

As others have said, it's all fun and games until two people edit the same source file, one of whom has the dangerously incorrect opinion that tabs are better than spaces :-)

I use a lot of semantic whitespace languages (CS, Haskell, Python), and it's a tradeoff: you gain in terms of redundancy, true, but there's an additional human overhead of making sure everyone's got their editors set up correctly. The larger the team, and a fortiori the number of teams, the bigger that overhead is. Smacking people about the head with PEP8 goes quite close to solving the problem in the Python world, but CS's Rubyish commitment to TIMTOWTDI militates against that.

"It's like SASS vs. SCSS. Or Haml vs. ERB. I can't, for the life of me figure out why anyone would prefer more to less."

Because HTML and CSS, despite their verbosity, are linguae francae. A CSS file is valid SCSS by definition - a less technical prototyper person can give you their code (perhaps even generated code from some wysiwig monstrosity) and you can refactor over it to remove redundancy, enforce conventions etc using the special SASS sauce. The SASS syntax does not.

A HTML file, likewise, is already an ERB file. HAML is 'backwards compatible' with ERB/plain HTML, so far as I recall, but mixing the two syntaxes is very, very ugly and a dreadful idea, and I'm not sure if it's possible to mix the two in similar template languages (Jade etc).

Point is: there is a human factor involved in picking shinier toys. I like HAML/Jade type templates, and Coffeescript for that matter, but I am far more comfortable using them on small teams or solo projects.

Post reply on HN