Live data from Hacker News

JavaScript right on the hardware

technical.io

301–310 of 320 posts

Re: JavaScript right on the hardware

#301

Earlier quoted context omitted.

Well, that's just unnecessarily offensive. I'm proficient in Python, Java, and C, and was at some point also fluent in PHP, Ruby, and Lisp. While I wouldn't particularly enjoy coding in Javascript, CoffeeScript is, to date, the best language I've worked with. I debug in JavaScript, so I'm not that far away from it. Why is "class-based OO" necessary? There's nothing wrong with prototypal inheritance. The way modules a…

There's nothing "offensive" about pointing out realities, even if they may be painful for some people to accept. I find your arguments somewhat odd. You do openly admit that you "wouldn't particularly enjoy coding in Javascript". People don't say such things about good programming languages, especially when arguing in favor of them to some extent. I also find it odd that you argue that there's nothing wrong with prot…

JavaScript has issues, but they are largely syntactical. Yes, `==` means something different than it does in every other language - but it is still a useful construct (if not worthy of its own operator). Yes, `Class.prototype.method` is overly verbose, but in CoffeeScript you get clean syntax without losing the beauty of prototypical inheritance.

The strengths of JavaScript, on the other hand, are deep. Everything is an object, functions as first-class citizens, the inheritance model, etc. The callback-based I/O of Node.js wouldn't work nearly as well in any other language I've seen, because JavaScript is such a good language.

I will take a language with syntactical deficiencies but a beautiful underlying model over the opposite any day, and I don't see anything about that statement that indicates that I'm a poor programmer who's only been exposed to PHP and JavaScript.

Re: JavaScript right on the hardware

#302

Earlier quoted context omitted.

What 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.

Sure, 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-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.

You 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.

Re: JavaScript right on the hardware

#303
post #199

Earlier quoted context omitted.

What 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.

The Arduino library provides a lot more flexibility compared to the bare AVR + libc, but at the expense of performance. Notably using digitalWrite() can be up to 50x slower than writing to the port registers directly.

Yes, but you can still write to the port registers directly. Using the Arduino libraries doesn't lock you out of anything. There's a smooth, continuous path from high-level C++ abstractions built on the Arduino primitives down to the bit-twiddling low-level C world.

If you're walled off in a Javascript VM, you can never have that kind of transparent access to the hardware - which seems like a big problem when you are building electronics, and controlling the hardware is the entire point of the job.

Re: JavaScript right on the hardware

#305

Earlier quoted context omitted.

Well, that's just unnecessarily offensive. I'm proficient in Python, Java, and C, and was at some point also fluent in PHP, Ruby, and Lisp. While I wouldn't particularly enjoy coding in Javascript, CoffeeScript is, to date, the best language I've worked with. I debug in JavaScript, so I'm not that far away from it. Why is "class-based OO" necessary? There's nothing wrong with prototypal inheritance. The way modules a…

There's nothing "offensive" about pointing out realities, even if they may be painful for some people to accept. I find your arguments somewhat odd. You do openly admit that you "wouldn't particularly enjoy coding in Javascript". People don't say such things about good programming languages, especially when arguing in favor of them to some extent. I also find it odd that you argue that there's nothing wrong with prot…

> I also find it odd that you argue that there's nothing wrong with prototype-based OO, yet claim that CoffeeScript is the best language you've worked with

You don't have to use the OO inheritance features in CoffeeScript in order to like it on the whole.

Re: JavaScript right on the hardware

#306

Earlier quoted context omitted.

You seem to think these programmers are content with simply learning only what they need to know and calling it a day. As a self taught developer, I find it offensive that you think I would go through all the trouble of teaching myself how to code, and then rest on my laurels, like I wasn't inherently curious and thoughtful. Since learning Javascript front to back, I've developed a curiosity with strictly typed langu…

I don't intend to offend you, but I think you illustrate a problem with many programmers who have come into the field with a self-taught JavaScript or PHP background, and without any sort of a formal education. Type systems, complexity analysis, and assembly language programming, for example, aren't "hardcore disciplines in computing". They're the basic foundation upon which the rest of our knowledge is built. They a…

https://yourlogicalfallacyis.com/notruescotsman

Re: JavaScript right on the hardware

#307

Earlier quoted context omitted.

You seem to think these programmers are content with simply learning only what they need to know and calling it a day. As a self taught developer, I find it offensive that you think I would go through all the trouble of teaching myself how to code, and then rest on my laurels, like I wasn't inherently curious and thoughtful. Since learning Javascript front to back, I've developed a curiosity with strictly typed langu…

I don't intend to offend you, but I think you illustrate a problem with many programmers who have come into the field with a self-taught JavaScript or PHP background, and without any sort of a formal education. Type systems, complexity analysis, and assembly language programming, for example, aren't "hardcore disciplines in computing". They're the basic foundation upon which the rest of our knowledge is built. They a…

> Type systems, complexity analysis, and assembly language programming, for example, aren't "hardcore disciplines in computing". They're the basic foundation upon which the rest of our knowledge is built.

Your second sentence pretty much defines "hardcore". The "hard core" of anything is what supports the rest. Originally the term is from the mid-19th century and refers to a layer of broken stones and bricks that provided support for a building project, commonly roads.

http://boards.straightdope.com/sdmb/showthread.php?t=523412

Re: JavaScript right on the hardware

#308
post #24
post #12

Earlier quoted context omitted.

Why? Because it uses JavaScript? I'd rather stick with my Arduino and use C. I don't get the whole "JavaScript Everywhere" meme, I'd rather use almost any other modern language (note the almost).

You prefer C over JavaScript? Header files? Pointer arithmetic hell? Precompiler Macros? Manual Memory Management? Seriously? To each their own, though.

When you have a hardware that has got 512KB memory, 5 volt battery and you have to ensure that an event occurs every 10milliseconds it is C which beats JS or any other language hands down.

Re: JavaScript right on the hardware

#310

Earlier quoted context omitted.

I completely agree. I'm a front end developer recently out of college and I decided recently that I wanted to expand my knowledge and learn hardware. This seems like a good place to start given my knowledge of JavaScript

If your college education for becoming a developer didn't teach you a lower level language it failed you. Even at my small liberal arts school we use multiple languages (they may all be really, really similar, but they're different languages), and work on low-level things. I'm aghast that a CS education wouldn't include at least Java, especially considering that a large number of schools switched exclusively to Java…

I learned C++, Java, Scala, Python and Ruby. I just prefer and am most familiar with Scala & JavaScript these days because I use Play. While I could go back and refresh my knowledge of C, it's nice having a device that uses the language I already use on a daily base given I have little to no experience in actually working with hardware.

As to your point to zhemao about learning new things, I said in my original post that I wanted to learn new things, in this case, hardware.

Post reply on HN