I hated Javascript. And now I like him

Original author: Joey Clover
  • Transfer
My career began with writing programs for mobile devices. I studied C and Objective-C to work with iOS devices. I had clear control over the software, I learned how to work with memory correctly, and spent long hours debugging bugs that arose due to my negligence (this was before ARC ). I developed with a bias towards iOS, and also began to study Java (and most recently started Kotlin) to switch to Android.

Developing for Android with memory was a bit easier due to the humane garbage collector. However, I still had control over the cycle of the application, and I had to learn the difference between the two main mobile platforms, their interfaces and differences in operation.

All this time I stayed in my pleasant pink world, mocking JavaScript developers and mocking the terrible performance of web applications. I refused to even touch Javascript, and if I still had to, I chose the more familiar TypeScript. Of course, this is the same Javascript, but at least with typing. I like when my variables and constants have an exact type. Years of direct memory work caught me in a mental trap.

If you have a car, then it is highly likely that you do not like cyclists. This is a well-known psychological problem, and it took me quite a while to understand that it is because of it that I dislike Javascript so much. I spent years of training, effort and pain learning how to work correctly with the memory and life stages of the application. And secretly, I thought, “What the hell are these Javascript guys called developers, while not understanding memory management? ”



But I grew up, I was interested in completely different things, I wanted to implement new ideas - and somehow I needed to make a web application for several simple tasks, including access control and authorization. It required only a few entry points and resources. Then I thought about Node.JS, and decided - why not? Everything looked simple enough and it would be easy to maintain.

In one evening I wrote the application I needed. In one evening.

What I needed:

  • NodeJS
  • mLab (Mongo DB)
  • PugJS (markup language)
  • Write npm install --save xxx several times

After a few hours, I had a fully working application with authorization and access control. At that moment, Redis, Docker, K8s and other good things didn't bother me. My MVP was ready. I could test it.

I had a test base without backups and an unglazed product on Digital Ocean. But I already tested my application on live users, and I realized that it is not as magical as it seemed to me. Well, okay, nothing is lost - I just learned a little.

Further I began to further understand Javascript and its unfamiliar ecosystem. When you write for iOS and Android, you will have only a few dependencies like Alamofire and Retrofit. I expected to see something similar. How wrong I was. I realized what the World Wide Web really is. It was a huge web of addictions. It scared me seriously.



However, when I figured out a few simple practices like using polyfills, transpilers, standard dependencies, and generally delved into the general ecosystem, I felt a little easier and more comfortable. Now I could create MVP in just a few days. It was amazing, and NodeJS was the sole merit.

Once I got the MVP, I could move on and invest time somewhere else. I needed to think about my projects, and Node.JS was not a silver bullet. It has very cool applications, like any other language, but you should not write everything in it just because you can.

Regarding the language itself, Javascript has always disgusted me. Probably because I once wrote in ActionScript 3.0. It seems that both JS and AS3 are ECMAScript - so what the hell is AS3 so much better than JavaScript? The answer did not come to me right away. Compatibility. For a very long time I did not realize that browser compatibility is very important for JS. But when Babel appeared, Javascript began to change at a tremendous speed. It was cool. I began to enjoy writing Javascript, being sure that it would be transparently transpiled for compatibility with anything.

This post I write mainly for people who mock Javascript. I still don’t like the idea of ​​“native” JS applications. However, I understand how much flexibility this gives to mobile and desktop applications, and it would be hypocritical of me to sit on my VSCode and condemn them. I also like the already quite popular idea of ​​productive hybrid applications, where only the kernel components are written in a low-level language.

If you see a developer who hates Javascript, then most likely he just perceives you as a cyclist who has occupied his roadbed.



From the comments on the original article (Tim):
I started writing C code for embedded platforms. Then I spent 10 years developing desktop applications in C #, while periodically immersing myself in C / C ++.

All this time I watched as small companies try to make cross-platform applications. Someone ported C # applications to Mac and Linux, and it looked awful and didn't work well. Someone was trying to create exactly the same native application ... And he could not finish it, being unable to support the development of three different applications on three platforms at once.

When I discovered Electron, my supervisor laughed at the idea of ​​building web-based technology applications. I quit my job, learned TypeScript / JavaScript, several frameworks, and wrote a data visualization application that works with USB hardware. In the end, I made good money by selling this application to my previous employer.

“But Javascript is much slower than X,” you will definitely say. Of course. But you can always write any complex calculations in C ++ and use it from Javascript, getting the best of both worlds.

Use each development language appropriately and everything will be fine.

Also popular now: