📜 ⬆️ ⬇️

I hated javascript. And now I like him

My career began with writing software for mobile devices. I studied C and Objective-C to work with iOS devices. I had a clear control over the software, I was learning how to work with memory correctly, and spent long hours debugging bugs that were caused by my negligence (this was before ARC ). I developed with a bias towards iOS, and also began to learn Java (and recently started Kotlin) to switch to Android.

In the development of Android with memory, it was somewhat easier due to the humane garbage collector. However, I still had control over the application’s work cycle, and I had to master the difference between the two main mobile platforms, their interfaces and differences in performance.

All this time I have remained 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 it when my variables and constants have the exact type. Years of direct work with memory caught me in a mental trap.

If you have a car, then there is a high probability that you do not like cyclists. This is a well-known psychological problem, and it took me quite a long time to understand that it was because of her that I dislike Javascript so much. I spent years of training, effort, and pain trying to learn how to work correctly with the memory and life stages of the application. And secretly I thought, “What the hell are these guys with Javascript called developers, while not understanding the memory management? "
')


But I was growing 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 it.

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

What I needed:


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

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

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



However, when I figured out a few simple practitioners, such as using polyfills, transpilers, standard dependencies, and generally getting into the general ecosystem, it became somewhat easier and more comfortable for me. Now I could create MVP anything in a few days. It was amazing, and NodeJS was the sole merit.

Once I had MVP, I could move on and invest time somewhere else. I needed to think about my projects, and Node.JS did not turn out to be a silver bullet. He has very cool areas of application, like any other language, but you shouldn’t write everything on it just because you can.

Regarding the language itself, Javascript has always disgusted me. Probably because once I wrote in ActionScript 3.0. JS and AS3 seem to be ECMAScript - so what the hell is AS3 so much better than javascript? The answer came to me not immediately. Compatibility. For a very long time I did not understand that browser compatibility is very important for JS. But when Babel appeared, Javascript began to change with great speed. It was cool. I began to enjoy writing to Javascript, while being confident that it would be transparently transported for compatibility with anything.

This post I write mainly for people who scoff at Javascript. I still do not 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 at my VSCode and condemn them. I also like the already quite popular idea of ​​productive hybrid applications where only kernel components are written in a low-level language.

If you see a developer who hates Javascript, then most likely he simply perceives you as a cyclist who has taken his road.



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

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

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

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

Use each development language appropriate, and everything will be fine.

Source: https://habr.com/ru/post/347802/


All Articles