Do you know what was bugging me the most in Node.js when I started with backend JavaScript?
The asynchronous coding style it promotes.
As a PHP Dev, the synchronous code execution was deeply ingrained in my mind, so at first, I was confused to a level of mild anxiety because of the asynchronous execution.
I just couldn’t get it.
How was I supposed to write code when parts of it are wrapped in callbacks called at some point in the future?
Pure madness!
The async/await syntax sugar was a little bit clearer to me, but still – the asynchronicity was driving me crazy.
What I did next is what I always do when I face a challenge…
I researched how Node.js works. Then I started working on my study project.
And just like that, after several lines…
It clicked in my mind.
Now I feel confident coding in this style, and I appreciate it. It seems beautiful. Definitely different from how I use to think and write in PHP, but equally awesome in its own way.
Every coding style has its qualities and drawbacks, of course.
But to be capable of choosing between them so you can pick up the best one for your new project, that’s the real benefit of keeping your mind open and busy.