Products > Programming

Node JS programming for masochists

(1/4) > >>

nigelwright7557:
Recently got into Node JS website programming.
A very steep learning curve but managed to get a local host working on my PC.
You add functions from a library as you go along like pop up alerts etc.
I found a lot of what I needed to know online and youtube etc
Once I got it working  I tried to get the website online.
Not a chance !
Amazon Web services too k10 minutes to upload it successfully only for it not to run.
So tried Azure which was much faster.
That didnt run either.
I started splitting down my software to find what didnt run.
I found  popup alerts dont work online.
A getmac stopped it working too.

I then found a few bugs in my code as things didnt seem to be happening in the right order.
I found out that a lot of Node JS is asynchronous like database accesses.
So had to get into "promises" that do functions when processor is idle.
It them started getting complicated with promises inside promises.
Then  I had to work out what should be done inside or outside the promises.

The biggest pain is the Javascript debugging.
Visual Studio only does a syntax check without an error list.
You have to look through your code a green squigly line under the error which could be anywhere.
So it pays to make small changes so yo ucan quickly find any syntax errors.

The other major problem is debugging screen comes up then disappears quickly if you have a bug.
Not very helpful as you send debugging messages to the console !

So if you really hate yourself get into Node JS !

SiliconWizard:
I for one would never touch that with a stick.

Oh, and I don't feel bad. The world is not missing out. There are some many people out there willing to do Node JS. I can do something else. ;D

szszoke:
Look into async/await to avoid dealing with promises inside promises a.k.a. callback hell.

nigelwright7557:

--- Quote from: szszoke on April 26, 2021, 07:21:28 pm ---Look into async/await to avoid dealing with promises inside promises a.k.a. callback hell.

--- End quote ---
I tried async/await and the software just crashes on them.
Node JS does its best to stop any blocking.

Syntax Error:
@nigelwright7557 A 'promise' is just another fancy term for XHR callbacks, which is just another fancy term for http request replies. As with any async callback pattern, care should be taken with the expected response and any error handling. Plus keeping every code block inside the JSON-like program structure. [ Suddenly a missing comma means something! ]

Personally, I have many reasons to hate Javascript as I've been fighting it for over 20 years! In my opinion, any language that is not typesafe is not a language. For example, is a variable a string, a float number, a signed integer number or, all of them throughout runtime? You cannot be 100% certain. This lazyness is starting to creep into other languages < why let the programmer decide if a number is a uint32 if they never learned what an unsigned integer was at university?

The inconvenient truth about Javascript is this, JS was conceived as a means to manipulate the Document Object Model (DOM) of an HTML web page; read node attributes by ID, alter CSS styling, enhance the user experience, that sort of shtuff. It was never intended as a language to replace server-side PHP. Sadly, with the advent of 'frameworks' and other code bloated Google code solutions, Javascript is now the on goto language for the IT industry.

Tip: if you want a stupid salary at a time when there is a shortage of skilled programmers, carry on stessing with your Node.js

Navigation

[0] Message Index

[#] Next page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod