Do you find yourself in any of those thoughts when creating applications with NodeJS?

  • “I for sure need to pick the right npm module to solve this problem, but which one fits best and is getting supported well?”
  • “Uh, my app is growing so big, I have no idea what the difference between user and customer is anymore and which properties they have.”
  • “TypeScript will definitely solve my problems!”
  • “Hm, I don’t know if this is an error with TypeScript or in the transpiled JavaScript? Or did I just disable the wrong ESLint option?”
  • “Is this all what I will do for the rest of my career?”

Creating JavaScript applications is easy at first but it’s getting harder and harder once the application grows. You can wait and hope that any of the big tech companies will solve your problems through TypeScript and other tools. A few years go by and you ask yourself: Is this all? Do I create CRUD application for the next 20 years?

It is sometimes harder to keep up with the latest hype train then actually learning fundamentals.

NodeJS became a victim of its own success. The market is flooded with developers, every company is using Node in some part of their tech stack. You can say that companies don 't pick it because of it’s underlying technology but because they can get cheap labor and feel safe because all the other companies are also using Node, so it must be a good choice.

Meet Rust

You probably know the saying that you should learn Lisp, even if you won’t use it, just because the learned mindset will make you a better developer? Instead of learning Lisp to become a better developer, you can learn a language which is actually in use and will improve you as good as Lisp does. Meet Rust. Rust is not the latest hype, but has fundamentals which offer you a wide range of opportunities, even in the long run.

Rust is a systems language, but it’s ergonomic syntax empowers the developer after the first struggles.

From a NodeJS perspective, Rust can be used to create web server applications and services. You can write Lambda functions or full fledged applications. Instead of using TypeScript, Rust has a strong build-in Type system. Instead of using ESLint, it ships with the pickiest compiler out there.

The pain you feel in the beginning is different. I call it good pain. Good pain lets you grow as a person (and developer), bad pain just hurts. I would categorize many of the TypeScript and NodeJS pains as bad pain. Not because the tools are bad, but a language which was created in 10 days just gets you so far.

At some point you need to make a personal decision of how your life should look like. Your day to day has a huge impact on your happiness and the well-being of your surroundings. Rust can help you rediscover the joy of programming again.

After you learned Rust, you may think you just replaced tool X with tool Y and end up in the same place. But, there is a difference. Once learned, you can use Rust to create:

  • Games
  • CLI tools
  • Operating Systems
  • Web Services
  • Browser Applications
  • Applications on Embedded Devices

One would say you can cover the whole stack. Rust creates a self feeding system:

  • Developers from C, C++, Java, Kotlin, Python, Ruby and JavaScript flock to the language
  • Rust and its features are getting discussed not only in a web context but in a wide range of scenarios
  • Different areas, perspectives and use cases are getting fed back into the language in an open way

Lets picture a perfect world 5 years from now

You are writing your web service in Rust. Instead of installing five different npm modules which help you cover your mistakes, you are using build-in tools to harden your code base. After the compiler gives you a green light you are 98% sure your application will run safe and fast in the years to come.

But, hold on, you are still sometimes frustrated by the repetitive work environment. But now you mastered a language which you can use to build your own Operating System on the side, you can implement the TCP protocol, you can create Games and join a local game community. You can even create applications for the Browser which are compiled to WASM. If this is not enough, you can get yourself a piece of hardware and run Rust on it.

Node is not gone

NodeJS won’t be completely gone, and your skills neither. However you found a great addition and you might just focus on Rust more in the future. Remember, no language survived forever. NodeJS could end up with the same faith as PHP and others. Picking a systems language like Rust gives you strength and opportunities for many years to come.

Should you learn Rust?

From a developers perspective: Yes, definitely. Rust has many unique features which will be copied also to other programming languages (like Ownership in Swift). Learning Rust sharpens your thinking and will make you more considered in your day-to-day language of choice.

From a safety and correctness perspective: You should aim to replace part of your web service with Rust. Start small and see where it leads you. Other companies like NPMDropbox and Yelp are doing it and had big success.

Rust for the web is not completely there, but once fully landed, it can not only convert your web services into safe bets. Once mastered, Rust lets you jump up and down the stack, explore Computer Science concepts first hand and build tools in your free time other then the next CRUD application.

So, take the chance and make 2019 the year you learn Rust. Have something in production by Christmas and try to replace part of your services at work in Rust and see if it’s successful. Rust will not only let you sleep calmer at weekends, knowing that a rock solid binary is running in production, but the skills you gained let you explore a vast universe of possibilities around technology.

Originally published by Bastian Gruber at https://dev.to/gruberb/how-to-combat-javascript-fatigue-with-rust-2o5l*

Follow great articles on Twitter

Learn More

☞ The Complete Node.js Developer Course (2nd Edition)

☞ Learn and Understand NodeJS

☞ Node JS: Advanced Concepts

☞ GraphQL: Learning GraphQL with Node.Js

☞ Angular (Angular 2+) & NodeJS - The MEAN Stack Guide

☞ Beginner Full Stack Web Development: HTML, CSS, React & Node

☞ Node with React: Fullstack Web Development

☞ MERN Stack Front To Back: Full Stack React, Redux & Node.js

☞ Building MongoDB Dashboard using Node.js

☞ Run your Node.js application on a headless Raspberry Pi

#javascript #node-js

How to combat JavaScript fatigue with Rust
17.55 GEEK