9 ms·
"‘Callback hell’ isn’t a problem for people who’ve written a lot of JS." So that makes it okay then? I don't know of any language that makes it impossible to
by scrabble 13y ago
"‘Callback hell’ isn’t a problem for people who’ve written a lot of JS."
So that makes it okay then?
I don't know of any language that makes it impossible to write bad code, do you?
JavaScript is a great language, but it's one that's been full of problems as well. It's great because people who traditionally aren't developers can get some JS snippet running to add something dynamic to a site, but at the same time if you are a developer who has spent time learning the language then you can do a lot more with it.
There are also alternatives to callback hell. I do take the method of naming functions instead of using a large number of anonymous functions. It helps significantly. If you prefer, you can easily use promises instead. That's been another effective approach.
I've never written any Ruby and can't speak to the comparison at all, but if it's a language that makes it impossible to produce bad code when you don't know the language and its idioms well then it's something I need to be learning.
- chewxy 13y agoNo, but there are languages that make it hard to write bad code. Go, Erlang, heck, even Python comes to mind.
- tel 13y agoI feel like making it hard to write code tend to correlate with making it hard to write bad code. This is a problem since many programmers do not like languages which make it hard for them to write code. I'm not sure whether it's the effect of "making it hard to write bad code" that makes it hard to write code or whether its "making it hard to write code" that makes you less likely to run into the effects of bad programmers.
- cuttle 13y agoSome people might consider Erlang a puzzle language, but Python and Go most definitely do not make it hard to write code.
- tel 13y agoI think one of the arguments for Ruby over Python is the whole Theres More Than One Right Way To Do It philosophy which does make things significantly easier to write down in Ruby, especially coming from scratch. This is much like Postel's principle---a computer should be receptive to many slightly malformed inputs because they will happen. That makes the computer more successful. The problem is that once you start accepting malformed inputs you can never be rid of them and thus you have a permanent tower of babble[1] problem. [1] intentional
- asdasf 13y agoThe bigger problem is that there are languages that make it hard to write good code. Javascript is one of them.
- collyw 13y agoI have had to re-wite some really shitty python. Two variable in the same function Index and index.
- dragonwriter 13y agoIts hard to write bad looking code in Python, but its quite easy to write bad code in Python.
- Mikeb85 13y agoNo, you can write bad code in Ruby. Ruby's advantages are that it's insanely flexible, very OO, very easy to write and get started with, but has lots of very powerful features. But in some ways Ruby is like C++; it gives you alot of rope to hang yourself with...
- tracker1 13y agoAnd JS has some incredible flexibility, with CoffeeScript (CS after) you can even get a more terse syntax similar to ruby/python. JS is not OO... IMHO OOP has not proven itself out to reduce confustion, or simplify code bases. It tends to make distributed systems which are increasingly necessary for large projects more complicated. In JS I tend to have two types of objects. The first being data, that which can be easily serialized, transported, stored and deserialized. The second being libraries meant to act against requests or use of said data. The second can be extended to those which tie a user interface to said data as well. When you break things down in such a way it's easier to develop systems that can scale out, and are easier to maintain as such. You can do similar things in most OO environments. I also tend to think that my Duck data class should probably NOT have a quack method. My DuckHandler class should. OO has brought us a lot of extremely bloated, over-engineered, "enterprise" monstrosities over the years, and imho should not be encouraged. JS is very much my favorite language, and in some scenarios (testing, and build scripts) I have started to use CoffeeScript. My second is actually C#, which I pick over Java because JNI is such a pain by comparison. It really depends on what you need. Sometimes you just need to get something done. You will not be able to use Ruby or C++ in client-side browser code any time soon. On the flip side node.js as a binding layer against a very nice set of C libraries is pretty awesome, and can be used to get closer to a "one language to rule them" ... it's often said, "don't let perfection get in the way of good enough."
- dragonwriter 13y ago> JS is not OO JS is definitely OO; its not class-based OO -- but its still OO. And its purer OO than, e.g., Java (class-based OO in which classes are not first-class objects but require jumping through hoops to get an object that represents the class are not as much OO as either protypical OO languages that lack classes as language features like JS, or class-based OO in which classes are objects like Ruby.) > IMHO OOP has not proven itself out to reduce confustion, or simplify code bases. It tends to make distributed systems which are increasingly necessary for large projects more complicated. In JS I tend to have two types of objects. IMHO, OO languages, per se, do not have that effect, though Java has that effect, due to the same limitations which make Java the poster child for repeated-code-template style design patterns.
- nbevans 13y agoOften when discussing JS as a language the conversation drifts off on tangents talking about all the amazing and wonderful libraries available for it. Unfortunately this is sorely missing the point. The conversation is about the language, not its ecosystem.
- ulisesrmzroche 13y agoWhat do you think libraries are written with? Glue? A language has a direct impact on a library, so no, you can't get out of that one this easily. Either defend your point well or don't try anymore.
- nbevans 13y agoJust because a book whose subject matter is of how to write better English and it itself is written in English doesn't make English itself a better language.
- ulisesrmzroche 13y agoDon't make yourself dizzy now.