6 ms·
JavaScript is my favorite programming language. It's not perfect, but still. (Other languages I know: Ruby, Python, Java, Go, Scheme, C, Erlang).
by Tichy 13y ago
JavaScript is my favorite programming language. It's not perfect, but still. (Other languages I know: Ruby, Python, Java, Go, Scheme, C, Erlang).
- dkuntz2 13y agoWhy? I really would like to understand, because I see JS as a necessary evil, and would rather use something else if given the option.
- eob 13y agoAs someone who has come around to Javascript after many years avoiding it, I think I can answer you: people like Javascript for a similar reason to why people like Python. As long as you stick to a strict set of conventions, Javascript is a very compact and manageable language, with a bit of extra flexibility to spice things up due to its prototypal nature. With Python, you don't have to worry about the conventions part, since there is one "Pythonic" way to do everything. But at least with JS there are only a few different standard ways to implement, for example, OOP. So once you've gotten used to it, when you read someone's code, you can quickly notice what style they use and contribute your code to match it. My biggest remaining gripe with Javascript is the lack of a good base set of libraries for container and string manipulation. Sure there are packages (like Underscore) you can use, but it would be nice to have them as a standard part of JS.
- nakkiel 13y agoSame same. Though I'm happy with having a lot of stuff out of the stdlib because we know where that kind of things leads. As long as performance is good enough, that probably won't be a problem and discoverability is still ok (agreed the ecosystem not yet too vast although we're getting there). My gripe is with all the unfinished stuff in just about any javascript library out there.
- alexhutcheson 13y agoAny chance you could point out a couple of good resources that cover the "strict set of conventions" you mention for Javascript? I've been dabbling in Javascript projects for a while now, and one of my biggest frustrations has been that I haven't been able to find any great resources that cover best-practice code design (above the level of style guides that cover mainly syntax issues). It would be great to have a couple of resources that cover the "right way" of doing things.
- Tichy 13y agoI think most frameworks for JS are opinionated, I mean things like jQuery, Sencha, AngularJS, emberJS, or also various server side frameworks. Once you specialize on using one of them, you'll probably adopt their conventions. I myself haven't settled yet, too my own dismay. It's not easy.
- Tichy 13y agoIt's extremely simple - basically everything is a hash. It has full lambda, not just crippled lambda like Python. It's very fast (I think it is the fastest scripting language except for Lua, and getting faster because of the browser wars). It usually doesn't require a lot of boilerplate code. What is not to like? The one thing I worry about is the limited range of integers.
- dkuntz2 13y agoI personally don't like that everything's a hash. It's nifty, and it means you don't really need objects, but I kinda like objects, even if I don't use them frequently in Python. Your preference makes sense, it's just not the same one I have. More on topic for this thread, I'm still not convinced that it's a good thing for an embedded system.
- Tichy 13y agoYou can use objects in JS if you want to - but fair enough, different tastes and preferences.
- dkuntz2 13y agoI didn't say you couldn't, I just skimmed over them. The prototype stuff is funky to me, I'd rather just have a straightforward syntax with objects.
- DonPellegrino 13y agoIt takes less than an hour to learn and get used to it if you know the standard Java-style OOP already. It's worth it and it'll give you a whole new opinion on what OOP means. I made this a while ago, see if you can figure out how it works: http://jsfiddle.net/AXTdj/ http://jsfiddle.net/AXTdj/
- dkuntz2 13y agoI know how it works, I just find it worse, by far. There's a whole lot more overhead to getting it working, specifically all of the foo.prototype stuff, and it doesn't require that everything be together. Sure, it's kinda nice that you're able to extends objects later on, but I'd rather have everything neatly declared in one place. It definitely does not "give me a whole new opinion on what OOP means", it furthers my opinion that I'm not a fan of JavaScript.
- dkuntz2 13y ago@eob - same problem, couldn't reply directly to you. My main reason for liking Python isn't that it's compact and manageable (unless by compact, you mean the code one writes), but because I like the elegance of the language. You're saying you have to stick to strict conventions for JavaScript to be any good? That would imply that it isn't any good to me. I use it, frequently, I just prefer not using it.
- Tichy 13y agoI think JS is more elegant than Python - just different tastes, I suppose. I find the crippled lambda unacceptable, and I don't like things like len() as a standalone function (in Python).
- dkuntz2 13y agoYeah that len thing's weird, I probably had similar thoughts when I started using Python, but got over it. I don't use lambdas, so that doesn't carry into how I compare languages.
- twerquie 13y agoReasons to like js: 1) There are very fast implementations in production, as well as an arms race between some of the world's most powerful titans of software development to outdo each other at js vm performance. 2) It is a thin abstraction over the Reactor Pattern, which is very useful for certain kinds of event-based applications. 3) Very lively and robust package ecosystems in npm (node) and jQuery (web). Virtually all packages are async by default.
- deleted 13y ago[deleted]