3 ms·
What programming language should you learn first? (Answer: JavaScript)
- Communitivity 10y agoYour first language shaped how you look at all future languages. I was (am?) an odd duck, and because of what I had available I learned lisp as my first language. I think that has helped me a great deal, and would recommend it highly to anyone learning programming. It sounds strange, and no you won't likely be writing your next SAAS sw in lisp (though you could, check out Seaside), but the investment will pay off when you learn your second language (which should probably be Javascript, Java, or Python, depending on the market you intend to work in).
- i_feel_great 10y agoThis is true for me as well, although I picked up Smalltalk first, then Lisp (Scheme actually). After learning Smalltalk learning Java, C#, and Python just meant learning the details. Ditto with how Scheme made it easier to learn OCaml and Erlang.
- ivraatiems 10y agoI don't agree with this. As someone studying JavaScript right now, I think it's simply too irregular and quirky to make a suitable first language. Part of learning your first language is being exposed to the underbelly of the computing process, learning how things really work instead of how they appear to work. That's already a complex and sometimes challenging process, and JS makes it worse by adding layers of vagueness and unnecessarily confusing design choices. A good first language, in my opinion, is one that is regular and reliably self-consistent and reasonable, so that you can focus on how the computer science techniques powering it work and not on how it muddies them. Java, C#, Python, and, yes, Lisp/Scheme are all good examples of languages that can do this to greater or lesser extent. Something like C isn't a bad choice, except that if anything, it gets too close to the metal (even intermediate-level programmers with some experience struggle with pointers and references sometimes). PHP, JavaScript, and honestly a lot of web technologies generally are not good places to start. They're just too darn wacky.
- ankurdhama 10y agoThose "wacky" things about any language are things that doesn't quite fit with your knowledge of already learned languages.
- ivraatiems 10y agoI mean, not really. Lisp isn't "wacky" even if all you know is Java; it's just different. JavaScript is wacky coming from anywhere because there's lots of seemingly illogical or confusing behavior baked into it by design.
- shakna 10y agoJS is leaky. It's Type Coercion often relies on the inner string representation of its objects. So many of its oddities come from this. JS doesn't have integers. It only has floating point numbers, and the complexity they can bring. > 10.8 / 100 => 0.10800000000000001 Its inconsistency on dealing with things that become NaN confuse the hell out of a good deal of people, because it simply doesn't reflect the way other languages deal with it. > Array(2).join("wat" - 1) => NaNNaN > Array(2).join("wat" + 1) => wat1wat1 JS is "wacky" because a programmer often has to understand implementation details to debug. A C programmer in rare cases may need to understand how their code translates to assembly, yes. But it is incredibly rare. A Python programmer almost never needs to understand how the object type is constructed, or how instanceof works. A Ruby programmer can get by without understanding how their numbers change from integers to BigNums and back. A Scheme programmer doesn't need to understand Cheney on the MTA or how their compiler generates C code. It explains speed and other tradeoffs, but it rarely if ever changes the actual code they write. In JS, I have to be careful not to use arrays and currying together, because I might get a false where I expected an array. This isn't a language I would want to hand to someone who has never programmed.