What are your hobbies?

gekko

Regular Member
Joined
Jul 10, 2017
Messages
518
Likes
2,688
But but Docker and Go :)

Just curious - why is Node suited for hardware projects?
Convenience, more than anything else. If you use NodeJS for your automation, you can get direct access to the hardware GPIO pins, at the same time you can make an application to control it from your computer or phone. This latter part becomes easier when everything is in JS.


NodeJS is event driven so it makes hardware control seamless through a common language understood by all three : the hardware, the intermediate server and the remote control/ mobile phone/ computer you are using to control the whole contraption.

Otherwise you are faced with the problem of controlling a hardware (low level assembly language) with an application written in a high level OS environment, or install an assembly emulator to access GPIO via a high level OS.
 
Last edited:

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
It's written in a language that required somebody to write a book called "The Good Parts of Javascript" Yuck. JS.
I have no idea how such a horrendous language has been allowed to perpetuate in server development. It makes no fucking sense. Now that node code-bases are getting older and all the rockstar programmers are finally facing maintainability issues finally the trend is receding.
 

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
Yes.

The niggas at Gopher Academy are creating a tool similar to what Dharma was saying.

View attachment 18552

View attachment 18551

Node does well in certain kind of projects. Small serverlets where one doesn't want to set up an entire server environment, or hardware/automation projects where you want to avoid using assembly language, it's a boon. Not suitable for data intensive applications.
Node for hardware? What μC has the memory to execute node runtime?
 

Project Dharma

meh
Senior Member
Joined
Oct 4, 2016
Messages
4,836
Likes
10,862
Country flag
Convenience, more than anything else. If you use NodeJS for your automation, you can get direct access to the hardware GPIO pins, at the same time you can make an application to control it from your computer or phone. This latter part becomes easier when everything is in JS.


NodeJS is event driven so it makes hardware control seamless through a common language understood by all three : the hardware, the intermediate server and the remote control/ mobile phone/ computer you are using to control the whole contraption.

Otherwise you are faced with the problem of controlling a hardware (low level assembly language) with an application written in a high level OS environment, or install an assembly emulator to access GPIO via a high level OS.
I would still rather use Python with a library like Twisted. But it works if you are an expert in Javascript and don't want to use another language I guess.

I've had no luck diving into a big javascript code base and making sense of the structure and the code flow. It's like walking on a bed of nails. :sad:
 

gekko

Regular Member
Joined
Jul 10, 2017
Messages
518
Likes
2,688
Node for hardware? What μC has the memory to execute node runtime?
Yes.

You can connect all the 'smart devices' using APIs.

https://www.24hr.se/controlling-the-world-with-nodejs/


RE : I have no idea how such a horrendous language has been allowed to perpetuate in server development.

With NodeJS, the front end guys got their very own Swiss knife to mess with the back end guys. Data visualization? ohh, use Node and Jquery, Big Data? Node and MongoDB, hardware automation? use even driven GPIO, web application? use Node Server.
 

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
Yes.

You can connect all the 'smart devices' using APIs.

https://www.24hr.se/controlling-the-world-with-nodejs/

Got it. I thought by hardware development you meant Embedded applications. For small projects node would be appropriate I guess.

With NodeJS, the front end guys got their very own Swiss knife to mess with the back end guys. Data visualization? ohh, use Node and Jquery, Big Data? Node and MondoDB, hardware automation? use even driven GPIO, web application? use Node Server.
This could be true. But for automation in an industrial environment or even consumer products at scale node would not be an appropriate language at all. When it comes to such low level work it is microcontrollers, FPGAs and ASICs all the way.

Do we have a hardware/robotics thread?
 

gekko

Regular Member
Joined
Jul 10, 2017
Messages
518
Likes
2,688
Got it. I thought by hardware development you meant Embedded applications. For small projects node would be appropriate I guess.



This could be true. But for automation in an industrial environment or even consumer products at scale node would not be an appropriate language at all. When it comes to such low level work it is microcontrollers, FPGAs and ASICs all the way.

Do we have a hardware/robotics thread?
NodeJS is being used for embedded microcontrollers as well.

http://embeddednodejs.com/chapters.html

https://events.linuxfoundation.org/sites/events/files/slides/nodejs-presentation_0.pdf

There's also :

 

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
In all cases, node is executing on a runtime and on top of an OS, what it does in all these cases is merely collect sensor data and is suitable because of its reactive nature which means it can switch between idle times while doing I/O. But the software itself is running on a full fledged computer.
For industrial or a commercial applications this is unacceptable. You need languages which can execute bare metal code. Several levels lower than node or any high-level language. Imagine the size of the PCB with a computer onboard running node applications. Why not use a microcontroller that is 100x cheaper, 50x smaller and several times faster?
While event-driven servers are understandable for writing servers dealing with IoT applications, there are far better platforms available. In most cases, companies go with C and libuv (which is what node runtime is built on top of).
 

Ancient Indian

p = np :)
Senior Member
Joined
Aug 23, 2014
Messages
3,403
Likes
4,199
My hobbies are,

Reading manga and books, watching anime, travelling, solving puzzles, writing stuff, again reading interesting stuff, listening to radios on google music(recent hobby),adding ppas and installing all applications under the sun and other fun stuff.
 

Project Dharma

meh
Senior Member
Joined
Oct 4, 2016
Messages
4,836
Likes
10,862
Country flag
@Dovah

I was writing code in D recently. Really fast compiler, modern features like generics and code blocks and can also call C code directly. I'm a fan.
 

Project Dharma

meh
Senior Member
Joined
Oct 4, 2016
Messages
4,836
Likes
10,862
Country flag
Is it object oriented? Compiles to machine code?
Yep it has classes and it compiles to machine code. In addition, it uses gcc for linking so all code is compatible with modules compiled using gcc.
 

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
Yep it has classes and it compiles to machine code. In addition, it uses gcc for linking so all code is compatible with modules compiled using gcc.
Might have to try it out. I never really got into C++ after C. Is there a garbage collector?
 

Project Dharma

meh
Senior Member
Joined
Oct 4, 2016
Messages
4,836
Likes
10,862
Country flag
Might have to try it out. I never really got into C++ after C. Is there a garbage collector?
It does but it has a few problems. It is a "stop the world" collector and is somewhat ineffecient. However it is possible to disable and it has a very smart guy working on it funded by Facebook. BTW Facebook uses D pretty heavily for their high performance tooling.
 

Dovah

Untermensch
Senior Member
Joined
May 23, 2011
Messages
5,614
Likes
6,793
Country flag
It does but it has a few problems. It is a "stop the world" collector and is somewhat ineffecient. However it is possible to disable and it has a very smart guy working on it funded by Facebook. BTW Facebook uses D pretty heavily for their high performance tooling.
You have convinced me. I might try it out tonight. :sad:
 

Global Defence

New threads

Articles

Top