4 ms·
I would have thought this was obvious, but orders of magnitude more developers know Javascript than Lua[1], thanks largely to the popularity of browsers as a pr
by seldo 13y ago
I would have thought this was obvious, but orders of magnitude more developers know Javascript than Lua[1], thanks largely to the popularity of browsers as a programming environment.
According to some recent research[2], the three primary factors affecting the adoption of a programming language by developers are, in this order:
1. Libraries available
2. Familiarity
3. Performance
And per the paper, this order of preference is extremely strong. Which means, because of the huge mass of Javascript developers out there, that as soon as a library becomes available to do something in Javascript, Javascript will rapidly become the most popular way to do that thing, regardless of the performance hit.
[1] http://redmonk.com/sogrady/2012/09/12/language-rankings-9-12/ http://redmonk.com/sogrady/2012/09/12/language-rankings-9-12...
[2] http://www.eecs.berkeley.edu/~lmeyerov/projects/socioplt/papers/adoptquant.pdf http://www.eecs.berkeley.edu/~lmeyerov/projects/socioplt/pap...
- taylorbuley 13y agoI think JavaScript might be most successful on Arduino for the same reason - it's a platform with which most tinkerers are familiar. http://blog.safaribooksonline.com/2013/07/16/javascript-powered-arduino-with-johnny-five/ http://blog.safaribooksonline.com/2013/07/16/javascript-powe...
- tlrobinson 13y agoI suspect Arduino (at least the ones I've used, Uno?) are a bit underpowered for higher level managed languages like JavaScript.
- wyager 13y agoAbsolutely. On AVRs, `new` and `malloc` work, but just barely. RAII/stack-only programming is basically a necessity. That is simply not possible with languages like Python or Javascript.
- taylorbuley 13y agoJS doesn't necessarily have to run natively for this kind of programming model to work out. Johnny5, the library discussed in the link I provided, rather provides an interface to the Arduino's StandardFirmata API http://firmata.org/wiki/Main_Pager http://firmata.org/wiki/Main_Pager
- gfwilliams 13y agoTo be fair, the Espruino JavaScript interpreter manages this pretty well (in around 8kB of RAM). http://www.espruino.com http://www.espruino.com
- ams6110 13y agoAnyone with a tinkerer's mind would not have a moment's trouble picking up Lua particularly if they already knew Javascript (or any other scripting language for that matter).
- Florin_Andrei 13y ago> the three primary factors affecting the adoption of a programming language by developers are, in this order: > 1. Libraries available Not just programming languages. Microcontrollers too. You could get much better performance out of a bare AVR, but where are the libraries and modules? Whereas an Arduino comes with a library for anything that moves - of course most people are going to prefer it.
- icebraining 13y agoWhat makes the Arduino non-"bare"? The Arduino language is just C++, which gets compiled using gcc and uploaded using avrdude. It's not exactly running on a VM or using an interpreted language.
- Florin_Andrei 13y agoSure, but with Arduino you're still floating on top of the Wiring libraries for almost anything you do. Coding a bare-metal AVR is a bit different: http://florin.myip.org/blog/how-make-halloween-creepy-blinking-eyes-atmel-avr-microcontroller http://florin.myip.org/blog/how-make-halloween-creepy-blinki... There's no significant difference, unless you want fully predictable real-time behavior (of which my piece of code is NOT an example, but that's all I have online). Most people shouldn't care.
- euroclydon 13y agoThanks for sharing. I'm working (very slowly at the moment) on an AVR simulator in order to teach myself C. I think this is a great little program to compile and test with.
- marssaxman 13y agoYou can start with a straight-up Arduino program and mix in as much bare-metal AVR code as you like. There's nothing in between you and the hardware, and that's important when you discover that time matters. I've done a fair amount of embedded work, some with AVRs and some with various ARM chips, mostly Cortex-M3... I always start with the nice libraries because why waste your time reinventing that stuff if you don't have to? But when you have to reach deeper and gain finer-grained control over your hardware - and almost every project eventually has to do that eventually - it's really, really nice not to have some VM in the way, not to have to start over in a lower-level environment.
- ams6110 13y agoLanguage popularity is a pretty fickle thing. It was not too long ago that you'd be laughed out of the room if you suggested using Javascript for any kind of serious work. Perl, once the king of scripting languages by orders of magnitude, is now viewed as being something close to COBOL: a few old guys know it, but none of the cool kids will touch it.
- WalterSear 13y agoThe more things change, the more things change. Javascript isn't Perl and isn't being used like Perl. For example, people aren't turning it into an hardware embedded language.
- smacktoward 13y agoJavaScript has a uniquely privileged position, though. It is the only language you can use to script the browser. As long as that is the case (and browsers are a relevant programming environment), you will always have web developers who know it, either as their primary language or as a secondary one. Imagine if the only way you could script Linux servers was in Perl -- it's hard to imagine it falling off in popularity the way it did in our universe. Other languages supplanted it because other languages could supplant it.
- gmac 13y agoAlso, of dynamic languages, JS is among the most performant, and many times faster than (say) Ruby.