by auggierose · 13y ago · 0 comments
Javascript is a good programming language, in that it's expressive, fast (much faster than Python), and more importantly it runs everywhere. No ecosystem can grow without developers, and the success of Node.JS clearly shows that developers like a system they can dive into without much prior effort, using skills they already have.
Tessel allows web developers to use skills they already have to do new things. How could that possibly be a bad thing? Just because Javascript has '==' and '===' and both 'null' and 'undefined' and {} + [] !== [] + {}? I swear, everybody seems to have seen the 'Wat' talk and thinks they're now experts on Javascript development.
Javascript, like many languages (even PHP!) can be written in a 'good' way and a 'bad' way. Thankfully, it's not very hard to write in a good way and it lends itself very well to I/O bound applications like webservers. Embedded devices, depending on the application, could also be very I/O bound, waiting on sensors, cameras, wifi, etc.
Javascript is actually one of the fastest interpreted languages in existence and thousands of new programs are being written in it daily. It's easy enough for a total beginner to use yet powerful enough to port Unreal Engine 3 to it. Get over your biases and recognize that JS brings with it something that Haskell, Scala, etc., will never be able to match: large numbers of ready developers.
It's not the best tool for the job. It's also not the worst tool for the job, and it's an extremely popular language. If it brings more people into the hardware space (which is its expressed goal), it will be a success.
Wait... when did we get to the point where things that were faster than Python were deemed "fast"?!
And of course, "fast" isn't the right term for embedded systems. The right term is "efficient". In embedded terms, Java barely qualifies as passable, let alone Python.
Javascript only has so much room for the bad to hide in--it's a little quirky, but isn't half as open to WTFs as, say, C++ (any generation thereof).
Don't be hating just because these new kids don't have to bang their faces into machine code or shitty C macros--it's great to have a way of trying different programming techniques for embedded systems.
You know, I only know JavaScript about a fraction as well as I know C++, and I can say with a great deal of confidence here... no.
C++ has lots of WTF's in strange little corner cases (mostly around the C compatibility issue). C++11 has done a good job of cutting down WTF's. In JavaScript you needn't go to the corner cases... it's right there in the normal cases.
We're talking about a language that still doesn't have a standard way of reading and writing bytes... for talking to hardware. Think about that for a moment.
> Don't be hating just because these new kids don't have to bang their faces into machine code or shitty C macros--it's great to have a way of trying different programming techniques for embedded systems.
Honestly, I'd not have blinked if the idea was to use Java (even with its lack of unsigned arithmetic), C#, Objective-C, Lua, or even say Go to do the job. I mean, you need to use some kind of a language and you want it to be something that a lot of programmers will find accessible.
But picking JavaScript for this job is kind of like picking Forth to build the new, more accessible database query language...
Wrong. Javascript has typed arrays. When's the last time you actually looked at Javascript? 1998?
"Honestly, I'd not have blinked if the idea was to use Java (even with its lack of unsigned arithmetic), C#, Objective-C, Lua, or even say Go to do the job."
They are using lua. They just have a front end to lua that uses javascript syntax, it would seem. Because languages without curly braces are scary, and the goal is to make this stuff accessible.
To the expert, making your niche accessible to plebes is scary. I understand.
See comments here: https://news.ycombinator.com/item?id=6468339
As recently as a few months ago I had to base64 encode a binary protocol because the JavaScript guys couldn't handle decoding the raw bytes.
> They are using lua.
Yes, but it seems like lua is merely used as a target rather than a programming language. What language people actually code in is highly relevant if your goal is to make a domain more accessible.
> They just have a front end to lua that uses javascript syntax, it would seem. Because languages without curly braces are scary, and the goal is to make this stuff accessible.
There are a lot of languages with curly braces that aren't half as scary as JavaScript.
> To the expert, making your niche accessible to plebes is scary. I understand.
I appreciate your "understanding". Next time you are trying to make the big "I can read your mind" power play, you might want to read the context a bit more carefully.
I don't generally do programming that talks directly to hardware, so even by your rationale I have no reason to be threatened, and I'm all for making this niche more accessible. I've seen excellent jobs of making hardware accessible to novice programmers using Java, Smalltalk, and even things like SCRATCH and Alice. I think that stuff is great. As you put it, "making a niche accessible to the plebes" is a great endeavour and what I have spent most of my career striving for. I've learned a thing or two about that path along the way. This isn't the first time a choice like this has been made. I thought I'd share that this particular choice, if anything, undermines the goal.
Regarding the limits of how far this Lua / javascript combo can or should take us I refer you to the words of Roberto Ierusalimschy, creator of Lua, himself (I agree with him):
> I must confess that I would be very reluctant to board a plane with flight control implemented in Lua or any other dynamic language.
http://lua-users.org/lists/lua-l/2008-10/msg00405.html
I think if the goal is to make little gadgets that put large block letters over jpegs of cats and post those jpegs to social media sites, Tessel's software side is on the right track. It might not be so great for "internet of things" gadgets that interface with the real world, in real time, in novel ways.
(in fairness their hardware looks interesting, though currently overpriced)
Happy?
And of course, C++ isn't exactly a great choice for making hardware programming more accessible. I hear tell that's how a lot of it is done already. ;-)
No. Don't compare the unalduterated failure that Javascript is to the sound reasons behind C++ messiness.
The road to Hell is paved with good intentions.
C++ isn't merely messy--it's a bloated festering gibbering idiot swimming in a fetid pool of infectious waste, the true depth and horror of which is hidden beneath a tapestry of warts and scabs. For the unwary, it seems sound enough, and then a few steps and templates later and the whole rotten structure has given way beneath their feet, plunging them in over their head in offal.
Again, Javascript is a relatively tiny language compared to C++.
I am concerned that many of these products will not hit practical state until issues like power consumption and cost can be addressed. I don't want to have my device wired and I don't want my $1 dollar light bulb to cost $40.
If these guys insist on using JS they should compile it to 8bit code, so that we can better address to cost and power issues. Right now they have something that is larger than an Arduino. My gut reaction is that python might be a better fit.
Using JS for hardware is an audacious, repulsive, brilliant, horrifying idea - maybe people don't want to call it web assembly language, but it's certainly web lingua franca. If you want to execute in the client, you have to use it. If you don't like it, everybody is writing frontends that compile to it (e.g. coffeescript), asm.js to compile it to, and writing books about the "good parts". So... every web developer knows javascript... and assuming it's they who will make the "web of things"... it makes sense to harness all that work and future work around JS (though I'd think the "internet of things" would be made by more hardcore folk, like the TCP/IP designers).
I don't know if this will pay off for them, but kudos for the chutzpah to actually do it (and for even considering it!) But it really could work out - whoa dude, awesome leap of faith!
Javascript is basically Scheme/Self with a C-based syntax[1][2], and both Scheme and Self are well regarded.
It has a bad reputation because of the terrible code people write using it in web browsers, but as languages go, it's pretty nice.
Browser/DOM APIs OTOH are historically pretty awful.
I suspect many of those who think it is terrible do so based n language snobbery, or they cannot separate the language from what it has been used for.
I may well be wrong, though - what actually makes it a bad language in your opinion?
Javascript has first class functions. It has closures. it has nice object/literal syntax. If you don't consider it cheating to use a library, it does have macros if you use sweet.js. It has a metacircular evaluator, from the very beginning called "narcissus", and if it had homoiconicity, it would be even more direly hated than it is now. Having syntax, for better or worse, is a strength that means that people actually use the language. For reals. Not just that one time at college.
The real question is how are any of those features actually useful from anywhere but a theoretical purity standpoint? We're not exactly writing AI systems here. At the end of the day the language is there to write programs. And the sophistication of the programs you need to write in javascript doesn't really need those things most of the time.
But basically, ask anyone with Lisp experience. Only JavaScript people without Lisp experience argue that JavaScript is Lispy.
Remember, I was recruited to "do Scheme", which felt like bait and switch in light of the Java deal brewing by the time I joined Netscape. My interest in languages such as Self informed a subversive agenda re: the dumbed down mission to make "Java's kid brother", to have objects without classes. Likewise with first-class functions, which were inspired by Scheme but quite different in JS, especially JS 1.0.[1]
I presume you saw the word basically in my post? There's no doubt it is simplified, but that's a strength as well as a weakness.
But anyway:
A metascircle evaluator: https://github.com/mozilla/narcissus
It's not Homoiconic, and nor does it have macros - but a number of the languages the OP named as "good" languages lack both these features too.
I stand by my point: Javascript is a perfectly good language.
At the same time it's a double edged sword - because it looked so similar to C, it most likely was so successful.
I'm talking historically as someone who was the typical C / Perl programmer back in the 90s when the web took off and made this exact mistake.
You forgot to mention "and without a native way to read and write bytes", which is one of just a few highly relevant examples of why it might not qualify as "a good programming language" for the job. (Others might include having a probabilistic parser...)
Oh, and look here:
http://www.khronos.org/registry/typedarray/specs/latest/
We have an "editor's draft", updated on July 2013, littered with "non-normative" sections, and not on the ECMA site.
You can check out the language standard itself and searching for "typed arrays" there: http://www.ecma-international.org/publications/standards/Ecm...
So yeah... not standard.
Javascript is not a choice for many web-devs and for all front-end devs, that's basically the only thing you can use in a browser. And even if one uses a transpiler, 3rd party scripts are still in JS. That's why the hate. Otherwise people would not give a damn about wether it is good or bad. When one is used to something better (like Scala), one doesnt want to spend its time in this poor ecosystem.
DOM apis are quite good ,that's the only reason why most people are using JS today. They are just still inconsistent between browsers.
That is an absolutely absurd claim. Javascript shares similarities to smalltalk, perhaps you confused it with scheme?
I shouldn't have said this, but it's not a very inappropriate response to your comment.
JS sure has its warts. But it isn't really that hard to know what to avoid. Once you do that, it is expressive enough to write apps without sacrificing productivity. It has all the basics you'd need; higher-order functions, closures, decent performance etc. The big win though, is that it is the only truly cross-platform language available today.
The major difficulty today (on the server-side) is that JS has no language support for handling callback interspersed code. This will be mostly resolved in ES6, due next year. We use ES6 features today, via flags.
I also have no problem with a Javascript Kiddie programming my oven in Javascript. AS LONG AS HE/SHE COULD HAVE ALSO DONE IT IN SCALA/OCAML/CLOJURE/HASKELL.
What are you getting at with that?
Really.
Someone has spent a lot of time trying to innovate. This is all you have to contribute?
It's not about bandwidth. It's about latency.
No one is even suggesting that Node is a suitable substrate on which to build, for example, a flight control system, and reduction to absurdity does nothing to improve your argument.
No one except parent.
I don't want to come off as a spoil sport, but can you please edit your comment into something insightful and/or constructive?
As for myself, I will spin this into a question: What existing javascript library or program would most likely benefit from being able to run on this device? Is it just appealing to web devs? the presentation doesn't really get into what compelling use cases this device enables.
Scala (http://www.scala-lang.org/) Clojure (http://clojure.org/) Haskell (http://www.haskell.org/) OCaml (http://caml.inria.fr/)
As much as I dislike it, sometimes PHP is "the right language".
Single threaded. Concurrency via processes, impossible to share state. And, among the more efficient dynamic languages out there now due to the browser performance race.
Which language doesn't have these options? This could be a description of Bash.
It's practically C and everybody likes C!
Actually, they are compiling to Lua bytecode in this case.
> JS syntax is quite good for I/O
And you can pass around blocks in Ruby.
Once upon a time Javascript was this fragmented language, mostly associated with blinking effects, pop-ups and lame attempts to protect a web page from being viewed as pure HTML. After years of misery the community was tired of how things was and said, "No more"! And so html-tables and javascript was sent to a zip-drive (you probably won't remember those, think of it like a SD-card) to never be seen on the web again.
But evil people who sold out to the dark forces was destined to bring javascript back. By making frameworks they masked the incompatibilities of the language, making it seem like a friend. And the young people who never fought the war, they welcomed this new technology with open arms.
But seriously, we took a typesetting language made for writing documents (just like word) and turn it into a technology for making software. It turned out into a total mess, and now you wonder why taking a language made for manipulating the DOM and using it for manipulating the stack is a bad idea? "When all you have is a hammer..."?
A lot of people are building awesome things with it. JS haters used to say that it was because it was the only choice for the web browser, but now we see more awesome stuff outside the browser: on the server with node.js, for windows apps, and now on embedded devices.
Seriously, a language that allows you to write awesome things could not be such a bad language. Ranting about people using a language that's not your favourite is a waste of energy.
I code Javascript only because I have to, but its a miserable language.
The same could be said of Visual Basic. I still wouldn't want my thermostat running VB.
"Another major advantage of Javascript is that it is continuously optimized in the ongoing race for performance in the browser"
In an embedded system like this, what you want is something continuously optimized to be bug free and work without fail, not something optimized to be mostly ephemeral and need to work in an environment where if you leak memory for 45 days, people rarely notice.
Browser performance is also not optimized for anything that matches the application workload of this kind of device.
Anyone who tries to bring a product to market with this will presumably be crushed by those who can use less expensive components from better optimized code. At scale, even a few pennies per unit can make a huge difference in your profitability. It seems quite unlikely, for at least the foreseeable future, where you will buy an off-the-shelf thermostat with one of these inside - or anything else running Javascript for that matter - simply due to component costs, if nothing else.
But if you are a web developer who wants to hook up a light that flashes when someone visits your web page, something like this might be a reasonable choice. Being able to build something that works reasonably well with minimal effort is appealing. Who cares if it adds $30 to your BOM and maybe doesn't work every single time?
Personally, this is probably not a device I would be interested in. Playing with embedded systems at a low level is what makes it fun for me, but not everyone wants to learn C and assembly just to throw together a project in their spare time. I think this could be a pretty great product for that certain niche.
You mean like this [1]? These guys have been around for years. How do you know your microwave doesn't already use one of those?
[1] http://www.basicstamp.com/catalog/microcontrollers/basic-sta...
I mean more like what they are using, which is a very young, heavyweight runtime not even meant or really tested for the purpose they use it for.
Look, just because you can make something "easier to program" doesn't actually make it "easier to make work".
Besides, you can choose sensible things. if you need something stable you stay on a known stable version of node (which has it's own issues of course).