3 ms·
There are different vectors of attack when it comes to optimization. The point of CS is to optimize for developer productivity and happiness, so I think your q
by M1573RMU74710N 16y ago
There are different vectors of attack when it comes to optimization.
The point of CS is to optimize for developer productivity and happiness, so I think your questions are largely missing the point. It's like asking "well that's a good screwdriver, but does it hammer nails?".
The correct question to ask is: what do I get from this syntactic sugar, and what do I trade. Or to stick with our metaphor:
"What does this screwdriver bring to the table, and does it INTERFERE with the hammering of nails etc?".
So as stated, CS lets you write code faster, express yourself more clearly, and removes headaches common to Javascript. These headaches are problems that are largely not addressed by other tools like jQuery (which have different goals).
To answer your questions:
> Does it fix browser incompatibilities for you
Yes, but only in terms of the language. CS compiles to lowest common denominator Javascript, so you know the compiled code will run just about anywhere.
So you don't have to worry about whether or not the browser's JS engine supports list comprehensions, because you're using CS.
The question is not so much "Does it fix browser incompatibilities for you".... but "Does it introduce browser incompatibilities?". To that, the answer is no.
>Does it optimize Javascript to run faster?
CS allows you to write really expressive code that gets compiled down to simple (but verbose) forms. This has the side-effect that CS code will generally be faster than Vanilla JS code that is written with a similar expressiveness.
In Vanilla JS you would generally have to introduce a library to get the same expressiveness, and that has a run-time penalty. For example: Something that is compiled to a simple for-loop in CS would require a bunch of function calls in a library in vanilla JS, adding a lot of overhead.
CS is not a tool to optimize code, so asking if it optimizes code misses the point. The real question is whether or not it introduces inefficiency, because if it does....that's a drawback that needs to be contrasted to it's benefits.
In this case, no it doesn't...and the code it produces is sometimes faster than similar vanilla JS code.
>Does it have a kick-ass library that's optimized for it?
CS is not meant to fill the same role as a library.
The question is not "does it have a library"...but "what's the implications of using CS vis a vis libraries?" The answer is CS interacts with JS seamlessly, use any library you like.
>Is it easier to debug?
No, because that's not the point of CS. CS is not a debugging tool. The right question is: "is it harder to debug?".
Here we hit what imho is the only real trade-off involved in CS.
Some will hem and haw about having an explicit compilation step; but the tooling support for CS is great and any serious JS developer can fit it into their dev process seamlessly (via commit hooks, watch, build scripts, etc).
Debugging problems is a legit concern, but in my experience it does not add significant problems. Errors in CS syntax are generally caught during compilation and other errors can often be easier to find because the CS code is cleaner and it's easier to catch errors in logic.
I think beginners will often hit problems with debugging and CS because it adds a layer to confuse them. Experienced JS devs on the other hand should be able to cleanly separate the layers and debug them effectively.
The tooling for debugging CS in the future looks promising and will improve the situation.
As for your suggestion that you could just improve your text-editor, use macros, etc....I think that's a good tool to have in your belt but it just doesn't compare to what CS brings to the table.
Either you'd be duplicating CS's efforts ...or you'd not hit the same level of capability...
In the first case, it'd be a pointless re-inventing of the wheel, but your wheel would have drawbacks CS lacks.
With CS there is:
- Lot's of editor support. Your suggestion is tied to 1 editor.
- Lot's of tooling support. There is framework support, and possible browser support in the future...etc etc. Yours would have none, or would need it written.
- Widespread use. Lots of coders will understand my CS
code right off the bat, or can learn it easily. Not only will no one understand your crazy macros etc, there's little incentive to learn them.
In the latter case, it's not a valid comparison.
The real question here is what does CS bring to the table, and what do you trade for it. CS had demonstrable benefits and demonstrable drawbacks.
It's my opinion that the benefits dramatically outweigh the drawbacks, but that's a question every developer must ask and answer for themselves.
I get that your contention is somehow, "well if it doesn't do these specific things, it's not 'life changing'", but that seems a pretty arbitrary line to me.
I don't see how you can say developer productivity is not a vital factor in development....and that something that improves productivity, readability, development speed, etc...is not "life-changing", at least as much so as the other factors you mentioned.
When judged in terms of what it's goals are, I think CS is highly effective and far from "pure syntactic sugar" (which to me implies something that simply saves typing).
- bad_user 16y agoDude, long post, little content. The point of CS is to optimize for developer productivity and happiness. That's a subjective claim that I also think is untrue. CS doesn't have any new paradigms, the type system is the same as Javascript, scoping rules are the same, it's really nothing more than syntactic sugar over JS. Even Ruby and Python have a lot more differences. well that's a good screwdriver, but does it hammer nails This analogy holds only when you're talking about (a) a screwdriver + (b) a hammer, i.e. totally different tools, with totally different use-cases. Personally I never understood why people use it to make a point.
- M1573RMU74710N 16y ago>Dude, long post, little content. I find sometimes you have to repeat yourself a lot before people will understand a point. > That's a subjective claim that I also think is untrue. It's obviously my opinion, and I can't speak for the developer....but it's fairly accurate. To say it's "untrue" it's just plain wrong, and if you're going to suggest that it's "untrue", you should offer your opinion as to what is "true". Anyway, it's perhaps a simplification and incomplete, but it's demonstrably true. If you go and read the docs for Coffeescript and what the creator has said, here is the general point made: - Coffeescript is designed to make Javascript easier and faster to write. - Coffeescript is designed to reduce some of the headaches associated with Javascript, and make it more expressive. Those are the immediate goals, but the reason behind those goals is to increase productivity. Increased productivity is WHY those things are desirable. Nobody just wants to type more JS code per minute for no reason at all. >CS doesn't have any new paradigms Well for one, that's not entirely accurate. For one, In CS everything is an expression, which is not the case in JS. However, even if we were to grant that point...it's moot. See, this is why I have to repeat myself. Although it seems despite debunking this misconception over and over you still managed to maintain it. CS isn't meant to be the latest and greatest language, or exist in a vacuum. If that was the point, why implement it on top of Javascript and put so much effort into making it compatible with Javascript? CS doesn't introduce new "paradigms" (at least the kind you are getting at) because that's not what it's FOR. CS isn't supposed to exist independent of Javascript, it exists to generate Javascript. The fact of the matter is, for some reason some people don't analyze technology based on objective reasoning about it's merits. In the Javascript world, jQuery and Coffeescript are prominent victims of this. There's lots of reasons to dislike jQuery....but by far people hate on it for reasons entirely removed from facts. Same with Coffeescript. Remarking that Coffeescript doesn't optimize code is a complete non-sequitur. More importantly this stupid implication that "syntactic sugar" is somehow pointless. Haters always make some smug implication about CS being "only syntactic sugar", as if that's some sort of actual critique or something. What these people don't understand is: Syntactic sugar is a method whereby languages are improved. There's nothing wrong with syntactic sugar, and it is very much a powerful and useful thing. I can write list comprehensions in Cofeescript....you can't do that in vanilla JS unless you want your code to only run on certain engines. That is one example of the power of "syntactic sugar". People get confused because they mistake it for simple examples of syntactic sugar where bar (x, foo(x, y, z)) is created from: foobar( x ) In that case the transformation is useful, but so sleight it's questionable whether the effort is worth it. ...but that's not what we're talking about. >This analogy holds only when you're talking about (a) a screwdriver + (b) a hammer, i.e. totally different tools, with totally different use-cases. YES... and that is what we are talking about. At least it's sure what I'm talking about. When you compare Coffeescript to things like: - Libraries - Code optimizing tools - Debugging tools - etc Those are totally different tools with totally different use-cases. If I'm curt it's because I'm sick of this nonsense every time CS comes up. There's a few people who make actually informed points either for or against it based on facts and technical merits... ...and thens there's a bunch of techno-hipsters who either put it down or blindly adopt it without knowing what they are talking about. (not saying you are in this group, but read the comments any time CS is mentioned and you will see this group)