13 ms·
Forgive me for not being hip but why try so hard to put JS in new places? It seems to be just an unfortunate historical accident that JS is one of the most popu
by farnsworth 13y ago
Forgive me for not being hip but why try so hard to put JS in new places? It seems to be just an unfortunate historical accident that JS is one of the most popular languages in the world - does anyone actually like it compared to other modern scripting languages? Could we invest in CoffeeScript instead, at the very least?
- bpodgursky 13y agoWhen all you know how to use is a hammer, everything looks like a nail...
- jfb 13y ago"True. When your hammer is C++, everything begins to look like a thumb." [1] [1] http://www.anvari.org/fortune/Quotations_-_Random/3041_quote-324-true-when-your-hammer-is-c-everything-begins-to-look-like-a-thumb.html http://www.anvari.org/fortune/Quotations_-_Random/3041_quote...
- drdaeman 13y agoWhy it's always C/C++ (not even Pascal or Oberon) in another corner of the ring? If hardware is powerful enough to sustain Node.JS, why not use OCaml, Racket or, maybe, some JVM-based language? Or, if the scripting is a requirement, Lua, Tcl or maybe Python.
- jarek 13y agoBecause a lot of people know Javascript and C/C++.
- drdaeman 13y agoOkay, maybe Racket and OCaml are relatively obscure options, but quite a lot of people know Java and Python. And I can't say Lua's not popular, too.
- jarek 13y agoI'd expect Javascript programmers dwarf Lua programmers by a couple of orders of magnitude. At least one OOM if you want to limit to people who only know the language "well."
- kyllo 13y agoIn the game programming industry (PC games, not iOS/Android games), the two most popular languages are C++ and Lua. That's probably part of the reason why these two languages keep getting brought up in this thread to compare against Javascript.
- JoshTriplett 13y agoC/C++ is always in one corner because it's the go-to language (heh) for code that needs to do direct hardware access and manipulation. That said, if I don't strictly have to run C/C++, I'd much rather run Haskell or Python. And you'd be surprised where you can run high-level languages like Python; one project I work on runs Python in the GRUB2 bootloader to test BIOS and hardware, giving Python full ring0 privileges, raw memory access, ACPI method invocation, and SMP support. Some of the Python standard library is missing (an HTTP server, for instance), but quite a bit of it is available. See http://biosbits.org/ http://biosbits.org/ for that project.
- 14113 13y agoI love python. It's nothing like javascript really. It's more like C, but with an approachable wrapper.
- TheLegace 13y agoWell I have been trying to play around with LLVM on ARM Cortex-M4 micro controllers specifically the STM32F4 series of my controllers there is a github project that tries to use Clang. Now if I had the time and experience I wanted to try and compile this library called py2llvm. The library that can compile static variables and python syntax into LLVM bitcode with C like performance. I think that is the best of both worlds.
- adrianpike 13y agoI enjoy JS a lot, and will frequently choose it over Ruby or Python. A functional style plays nicely with a lot of the problems I'm solving, it's nearing ubiquity, and there's lots of big names and smart people working on optimizing it even more. In my day job, we write mostly Coffee - which is little more than a preprocessor to JS, IMHO. It's definitely nice to have, but I don't consider it an independent language unto itself. If you know JS well, it shouldn't take more than a day to get up to speed with CS.
- phillmv 13y agoPython, okay, but how are you prevented from using a "functional style" in Ruby?
- PommeDeTerre 13y agoIt's disappointing to see the false "JavaScript is functional" claim thrown around time and time again. Just because it has first-class functions it does not mean that JavaScript is a "functional" language. JavaScript does not promote the use of pure functions, referential transparency, and the minimization of state. JavaScript does not encourage the use of recursion. JavaScript has an atrociously broken type system, rather than a robust and theoretically sound one. JavaScript does not offer pattern matching and other functionality offered by modern functional languages. In fact, it goes out of its way to promote a very imperative, non-functional style of software development, even when efforts are made to try to use it in a functional way.
- 10098 13y agoMy thoughts exactly, instead of killing it off or at least limiting it to the browser, we're trying to shove that abomination everywhere. This is sad.
- scriptproof 13y agoI like JavaScript. It is a very intelligent language, far ahead in its design than more recent products like Dart. If you was not insanely focused on its drawbacks, you could see its qualities too.
- lmm 13y agoYour post is content-free. What do you consider explicit advantages of Javascript over Dart? Because to my eyes Javascript looks like a similar language with no type system and terrible scoping.
- Tichy 13y agoJavaScript 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.
- peterhunt 13y agoBecause JavaScript runtimes are the best dynamic language VMs by a long shot.
- admax88q 13y agoThe JVM would like to have a word with you.
- drdaeman 13y agoNitpicking: while JVM implementations can run, they're not particularly tailored for dynamically typed languages.
- SimHacker 13y agoLuaJIT would like to have a word with JVM. Plus, Lua isn't controlled by a creepy asshole who thinks the NSA is essential and says stupid shit like "Who's ever heard of government misusing information?"
- drdaeman 13y agoI'm curious. I persume, with quite powerful hardware, task's not going to be trivial and may require some concurrently running processes. JVM has threads. Akka adds actors (those seem quite nice when used with Scala). Does Lua/LuaJIT offer something simple-looking-yet-powerful in that area?
- dysoco 13y agoOf all the great languages out there... we had to choose Javascript. It's a shame, would love to see more Smalltalk posts.
- fizzbar 13y agoIf Smalltalk ran on every.single.browser.ever, you would.
- pekk 13y agoThis is an argument for writing JS against browsers, not stuffing it into every domain possible.
- taf2 13y agoJS is great - it's so hackable, via simple straightforward syntax that's familiar to anyone who programmed in c,c++,c#,java,php and is similar in ease of use to python and ruby - why on earth would you think it's a bad thing... Javascript is easy - few constructs that together can build just about anything is a big plus IMO - to each is thier own right
- nfoz 13y agoMany of JS's "straightforward syntax" that "looks similar" to other languages, is subtly different in profound and dangerous ways.
- mayanksinghal 13y agoCoffeeScript is JS. And to be more honest and judgemental, CoffeeScript is the sweeter-but-poorly-documented Javascript. The reason people are attempting to put javascript everywhere is because they can and because others enjoy it. And those who do enjoy JS, know what parts of JS are to be avoided at all costs. And I actually like it compared to other modern scripting languages for two reasons:(1) I don't have to worry about whether my end-user will have to worry about installing 100 dependencies to consume my code/service (2) I can choose how robust my setup is (Closure Compiler) or how sweet (CoffeeScript), and spend time sharing my setup with others who like the language instead of using proverbial sarcasm on topics about languages that I don't want to use.
- swang 13y ago> poorly-documented what?
- vinceguidry 13y agoWho needs documentation when you can just pop open a REPL and copy-paste your functions to see how they compile?
- fordi 13y agoPeople who don't know javascript.
- ahoge 13y agoThere still isn't any language specification, is there? JavaScript, TypeScript, and Dart have one.
- luikore 13y agoBut the one-page manual of coffeescript is far more useful to users than those looong specifications. No document about the syntax is better than the annotated source of the parser. And you can find specifications about all kinds of javascript runtimes elsewhere, they document the coffeescript runtime too.
- brianpgordon 13y agoYou do understand that CoffeeScript compiles to JavaScript, and that by supporting JavaScript they're supporting CoffeeScript, in addition to TypeScript, right?
- benihana 13y agoBecause everyone* knows JavaScript. I'd wager that the vast majority of professional software engineers work on the web, or very close to the web, and JavaScript is the lingua franca of the web. I mean just look at the front page of Hacker News on any given week. It's full of talk of JavaScript and new JavaScript libraries and new things to do in JavaScript. When you think about how many more people this can reach without them having to learn yet another language for a very specific thing, it makes sense. *hyperbole, please forgive me for being not being completely literal.
- 10098 13y agoCorrection - everyone thinks that they know Javascript. It's a more twisted language than it appears.
- hrabago 13y agoIt's still more approachable though than C or Lua where only some people think they know it.
- nakkiel 13y agoVery nice analogy (the lingua franca). The state of CS and the convergence we're seeing toward the web worries me though.
- ams6110 13y agoI'd think Lua would have made a lot more sense.
- OWaz 13y agoWhen I see a device like this I like to think that people familiar with JS can now tinker with hardware devices. I know some people who are comfortable with JS but aren't engineers and they may not be willing to learn Arduino C. Whatever language it is I'm glad prototyping devices are coming out at a cost that basically makes them an impulse purchase.
- zhemao 13y agoSo, I don't really buy arguments like this. Would your friends who are comfortable with JS but aren't engineers actually be interested in learning microcontroller programming because they can do it in JS? When you move from scripting a web page to programming on a very limited embedded system, you're changing to a completely different paradigm. Instead of worrying about the DOM and AJAX, you're worrying about GPIO and PWM and interrupts. The actual syntax of the language is a rather minor detail compared to all of this. Now, I'm not saying that we should all be coding microcontrollers in ASM or AVR C, but what makes Javascript more approachable than, say, Arduino?
- invisible 13y agoBecause it takes a lot more time to learn another language proficiently than it does to adapt what you already know to a different platform. It's accessible.
- soapdog 13y agojust to answer you: I Like Javascript. I like my functions as first class citizens. I like my prototypes and my inheritance model. I like my callbacks and my closures. I like how I can move from client-side, to server-side, to my TV, all with the same language. I like how easy it is for beginners to produce something useful and for seasoned developers to produce something good. There are many other languages that share such traits but Javascript is one of the few that can be picked up by beginners interested in any field (eg: games, web, apps) and keep surprising you. It is extremely powerful in the hands of those that devote time to learn how things work. Its one of the few languages that you can learn as a beginner and keep with you as you become a better programmer. I don't think it should be the only language someone knows but it should be a language that everybody knows. So yes, there are people who like javascript.
- PommeDeTerre 13y agoHow much experience do you personally have with other programming languages, aside from JavaScript (and perhaps PHP, if you're familiar with it)?
- TheCrownedFox 13y agoI'm not who you originally asked, but I share his sentiment that javascript is a nice language. I've used python for years, have a few open source applications with Java, and written several scripts for my own purposes in C. I've also explored C++, haskell, scheme, ruby, and MIPS assembly. Not a whole lot of PHP. So I use javascript for everything? Not even close. But I still like it.
- soapdog 13y agoIn recent times I have delivered commercial products in PHP, Python, Ruby and LiveCode. In the past (way past more than 10 years) I used to work with VB, Delphi, REBOL and some Java. While I was coursing engineering, we learned scheme (its great!)
- farnsworth 13y agoIt sounds like you don't like Javascript as a language, you like it because it just happens to be successful and ubiquitous.
- tlrobinson 13y agoJavaScript certainly has it's quirks, but if you get to know it it's not a bad language. And since CoffeeScript compiles to JavaScript you can use it anywhere JS runs...
- marssaxman 13y agoIt's not a bad language as long as you know it well enough to know which parts of it are the bad parts so you can avoid them. ...and that's what makes it a bad language.
- tlrobinson 13y agoOr just don't learn the bad parts to begin with. That's why there's a book called "JavaScript: The good parts" :)
- namuol 13y agoCoffeeScript is JavaScript. There should be nothing stopping anyone from doing everything with CoffeeScript on this device, or anything that supports JS.
- pherz 13y agowhy try so hard to put JS in new places? Because its the current trendy thing. And chasing that dragon isn't necessarily a bad thing if it gets people in the door. Sure its an evolutionary dumb step in some ways but lowering the barrier to entry means that ideas that might not otherwise come to the space could get a chance to grow. Or if nothing else the trendy attention means more libraries get written, which helps someone else down the road. There are a lot of blind optimism in that statement, but we all know that the best tech doesn't win. What wins is the good enough-ist tech that also pops enough buzzwords win the to interest of the dude that claims to only care about the best tech.
- LordHumungous 13y agoThe goal is seamless integration between physical hardware and a web application without the need for a server on the device. Sounds pretty awesome to me.
- deleted 13y ago[deleted]
- aphelion 13y agoIt's my fervent hope that developments like source maps and asm.js will eliminate what it basically Javascript's sole competitive advantage; that it's the only language that runs in a browser. If it's possible to write performant, robust code with good tooling in CoffeeScript/Dart/TypeScript/Python/Clojure/etc., then the peculiarities of Javascript become a lot less important.
- mr_spothawk 13y agoI like it. It was the first language I learned because edu materials were more accessible (to me) than Perl/python/Ruby
- mr_spothawk 13y agoI like it. It was the first language I learned because edu materials were more accessible (to me) than Perl/python/Ruby
- naunga 13y agoFull disclosure I'm not a JavaScript programmer. I dink around with it. I can work with it. I understand it enough to maintain the code I need to at work, but I'm not a "JS Guy". At the heart of my programming heraldry is C. From there I branched out into C++, Java, Perl, C#, etc. In effect you are comparing JavaScript to Assembler, since CoffeeScript compiles to JS. I'm certain most people would agree that this is a ridiculous comparison, because as quirky as JavaScript can be it is far easier to work with than assembler. I wish people would stop making that comparison (I've been guilty of it myself, but I've stopped as of late). In my view, the popularity of JavaScript comes down to two things: Interactivity and instant gratification. I first played with JavaScript while in college in 1995. It blew my mind that I could just put some code into a text file and load it into Netscape and see stuff happen. No compiling, no linking, just text making the browser do things, and unlike Java it did not require me to upload an applet and hope that my target user had a JRE installed. Today you have things like Chrome dev tools and JS Fiddle where you can get even more of that. The velocity of going from idea to web app (site) is a lot nicer for most people. IMHO JavaScript is the programming equivalent of an LLC. It's quick to start, low capital investment, and doesn't expose you to a lot of risk. Anyhow...that's my two cents that I had to throw in before more veins in my head popped.