9 ms·
To a lot of people CoffeeScript promotes the intangible benefit of happiness. (Similar to ruby.) If working in CoffeeScript makes everyone's work much more enjo
by gfodor 14y ago
To a lot of people CoffeeScript promotes the intangible benefit of happiness. (Similar to ruby.) If working in CoffeeScript makes everyone's work much more enjoyable (for whatever reason), with minimal cost, isn't it worth it? I, for one, want to minimize the amount of things I need to "deal with" at work, be it shoddy programming language workarounds or a half-broken coffee machine.
- MatthewPhillips 14y agoNo, the parent is correct. JavaScript developers do not lose any sleep because '1' + 0 = 10. We learned to do integer math with integers and moved on. We learned to just use === and moved on. The Dropbox devs apparently didn't want to go through that learning curve, which is fine, but rewriting your application in another language just so that you don't have to look at semicolons is a big bikeshedding mistake. Writing new code in CoffeeScript and only rewriting legacy code as needed would have been a more sane way to transition.
- scott_s 14y agoHow can you say it was a mistake when it only took one week? There was a cost, they paid it, now they can reap the benefits. I program in C++ extensively. I "deal with it" a lot. I write things like this all the time: MapType::const_iterator it = map.find(x); if (it != map.end()) { // x is in map, process it } I've done it for years, I know how to do it, and there are great benefits to getting iterators back from my data structures. Yet, I always feel a warm fuzzy when writing data processing scripts in Python, and I get to say: if x in map: # x is in map, process it My point: even though one can have learned to "deal with it," there can still be a benefit to not having to deal with it anymore.
- MatthewPhillips 14y ago> How can you say it was a mistake when it only took one week? There was a cost, they paid it, now they can reap the benefits. The cost is not just time (although that's certainly a big cost). They rewrote working production code for fun. Why this is a bad idea will likely derail the conversation so I'll just direct you here: http://www.joelonsoftware.com/articles/fog0000000069.html http://www.joelonsoftware.com/articles/fog0000000069.html
- scott_s 14y agoJoel's excellent essay does not apply here. The Netscape re-write was a re-write. That is, it was not a translation. Netscape looked at their code base, and decided, "We don't like the design of the architecture of our code. We're going to throw it out, re-design it, and re-implement it from scratch." The Dropbox team clearly did not do that. They translated it from one language to another; the design did not change. Much of that translation was with an automatic tool. Again, there is a difference between re-implementing something, and translating it. Further, the examples in Joel's posts took years. This took a week. The situations are completely different. Personally, I find it disingenuous to link to an article and say "He has my argument" without actually stating what your argument is.
- MatthewPhillips 14y agoThe scope is much smaller, but the problems are still the same, namely introducing new bugs to working production code and surrendering ground to competitors.
- scott_s 14y agoThe scope is so small that it's on par with any other feature.
- deleted 14y ago[deleted]
- jsight 14y agoIf they really rewrote it in a week, then either it was trivial or they were able to reuse the bulk of it. The Spoelsky article applies to neither of those cases.
- btilly 14y agoRead the article. Their first step was to run their existing JavaScript through a js2coffeescript converter.
- adgar 14y ago> There was a cost, they paid it, now they can reap the benefits. Quick example of how you're wrong: their version history is now trashed. They're going to pay the price for that for years.
- rimantas 14y agoAnd the price will be about zero.
- tolmasky 14y agoIn C++'s defense in the one example you gave, you could have just done this and had the same amount of code: if (map.find(x) != map.end()) { }
- scott_s 14y agoNo, because then I would need to find it again (eiter through the find() member function, or through operator[]) to get a reference to it. Without a reference, I can't process it.
- tolmasky 14y agoWhy? In your original example you said "process x". You can also "process x" in mine: if (map.find(x) != map.end()) { // do stuff with x } You don't need the iterator to do anything with x. And if you do need the iterator (to perhaps keep iterating or something?) then you would also need to do extra work in the JavaScript example.
- pjmlp 14y agoSome people seem to enjoy more hacking than doing what makes business sense. Every hour spent converting JavaScript to CoffeeScript code, could have been spent improving Dropbox. Doing the math of salary per hour that each Dropbox coder involved in such conversion earns, what is the cost of converting the code to CoffeeScript?
- lazerwalker 14y agoIn this specific situation, the conversion was done as part of a Dropbox hackweek. There are almost certainly other projects they could have worked on for that week that would have resulted in a more tangible business gain for Dropbox as a company, but the point of teamwide hackweeks/hackathons/etc is more employee morale than anything else. It seems to me that it succeeded pretty well at that goal.
- MatthewPhillips 14y agoRewriting working production code is not something to be done for fun at a hackweek. It's a very serious thing. And since it took a week they had a significant amount of code to rewrite. What new bugs were introduced by the rewrite? Did they open the door to any XSS attacks? Who knows.
- btilly 14y agoDid you read the article? A lot of that week was spent testing that there were no regressions in the code, and not actually rewriting. I'd be comfortable that no new attack vectors were opened.
- gfodor 14y agoYou really seem to be on a crusade to convince people that this was a reckless, short-sighted, waste of time. Clearly these developers are professionals because they went into detail how they prevented regressions. I wouldn't be surprised if they inadvertently fixed a number of bugs due to the fact those bugs are impossible to make in CoffeeScript, or because they filled in gaps in their test coverage. Porting JS code to CoffeeScript is not very hard to do safely. I've done it myself for fairly large pieces of code (not this big.) In this case, it was for a hack week project and was a modest amount of code. It sounds like they got buy-in from the rest of the team that using CoffeeScript is a net win. It sounds like they are moving forward, it was a good decision and use of time, and they are happy with the result. Why do you think you can make arguments that it is in fact not any of these things, when the people who did it are stating otherwise, and the organization is acting otherwise? Why do you think you can make arguments against re-writes that suggest avoiding them because they never ship, when this project has, in fact, shipped, and did so in a week? Either you are missing something, or Dropbox is deluding themselves and are just falling for hype. What do you think is more likely?
- deleted 14y ago[deleted]
- lowboy 14y ago> The Dropbox devs apparently didn't want to go through that learning curve That's not a fair statement. I'm a competent js developer, having trudged up that curve, and I still love cs. Not for lack of learning, but because I value brevity and reduced keystrokes.
- MatthewPhillips 14y agoYeah, I'm not anti-CoffeeScript, but from the article this sounds like a big reason why they switched, which is a perfectly valid reason.
- gfodor 14y agoFirst, it's not a matter of just learning to do something and moving on. There is incremental mental baggage that comes with every one of these "tricks". Since we are both Javascript developers, I won't list any, but I think we both know that some of the things you need to remember to do go beyond adding an additional equals sign. The sum of this is you can often find yourself falling into one of these traps, even after many years of experience, because there are just so many places you can be tripped up. Second, I'm going to disagree with you on having a polygot codebase. If the developers decided that CoffeeScript is a better environment than Javascript (which you may disagree with), then I think it's clear the ideal scenario for them is their entire codebase is in a single language. Since it was tractable for them to convert the existing code, it seems logical to do that (not withstanding concerns like version control history, etc, which seems like an academic concern not really that important in practice.) In fact, converting an existing code base is a common way to learn CoffeeScript and come to a judgement if it is suitable for future development. Such seems to have been the case here.
- mibbitier 14y agoIf you're unable to deal with broken, buggy, or poorly designed things, that makes you a bad developer. Just deal with it and move on. It's really not worth trying to achieve some sort of "Wow I love this language the best it's brilliant" state. It's far better to achieve a "I'm creating some cool stuff that solves a problem" state. Language syntax is simply not very important. Every single language has quirks. Learn them, and move on. If you're unhappy working in a particular language, maybe you're not cut out to be a software developer. You should be happy you're creating things that solve problems - if you're not, reconsider your career choice.
- prospero 14y agoNice false dichotomy you got there.
- mibbitier 14y agoI'm just saying... Good developers concentrate on building things. Bad developers concentrate on how much they like their tools. You see it in everything in life though. The best way to become a fantastic cyclist say, isn't to buy the best bike out there. It's to buy a crappy cheap bike, and learn how to get the most out of it.
- Yahivin 14y agoAnd then to buy a better bike.
- scott_s 14y agoThat's a curious metaphor, because the best cyclists - the ones who win professional races - have very expensive bikes.
- bicknergseng 14y agoSeriously... if I were to pick something I'd pick music. Miles Davis on a $100 trumpet could make better music than almost anyone else with a $10k one.