Why Rust Might Attract More Developers Than Java and JavaScript

Rust is un­de­ni­ably a greatly ap­pre­ci­ated lan­guage, af­ter all, it has placed as #1 Most Loved Programming Language” on the StackOverflow Developer Survey for 6th year run­ning.

Reading this, you are prob­a­bly very aware of why so many peo­ple like it, but I will be go­ing over those rea­sons any­way, at least be­fore I re­veal its se­cret weapon.

It’s fast, very fast. While it may not be a great bench­mark, The Computer Language Benchmarks Game, mea­sures that it falls just a hair be­hind the fastest lan­guage, C.

That makes sense, given that Rust was meant to re­place C/C++. Even bet­ter than the bench­mark, it has been shown that in many sit­u­a­tions, the Rust com­piler is able to op­ti­mize code sig­nif­i­cantly bet­ter than C or C++, just be­cause it has more in­for­ma­tion about the de­vel­op­ers in­tent.

It’s con­sis­tent. For more than pretty much any other lan­guage, Rust de­vel­op­ers can ex­pect that, if their code com­piles, it works. When it does­n’t com­pile, the com­piler gives bet­ter feed­back and ad­vice than any other lan­guage. It can even check if your arith­metic is wrong.

It’s com­pli­cated, but only where it needs to be. The lan­guage it­self, as well as its stan­dard li­brary are built very con­sciously, by its users. Most places where you might find you have to write te­dious boil­er­plate, Rust makes it easy. It also gives you the free­dom to write code that does ex­actly what you want, ex­actly how you want. We will get back to this later.

The Problem

When start­ing a new pro­ject what is the first thing you are go­ing to do? It de­pends on what stack you are us­ing.

If you want to use NodeJS, it might look some­thing like:

mkdir new_project
touch index.js
npm install

That is just the bare min­i­mum. If you want to add any de­pen­den­cies, you have to go through an un­rea­son­able num­ber of hoops, and the stan­dard pack­age repos­i­tory, npm, is known for be­ing quite in­se­cure, not to men­tion it be­ing con­trolled by a pri­vate cor­po­ra­tion.

If you want to use Java, you have to use some kind of tem­plate, oth­er­wise it’s im­pos­si­ble to cre­ate a pro­ject from scratch. Even then, you have to de­cide be­tween two or three pack­age man­agers, and deal with it when li­braries don’t sup­port your choice.

If you want to use C or C++ for­get it. As a be­gin­ner, you are go­ing to be stuck fig­ur­ing out how to use the lo­cal linker and com­piler to get any li­brary to work.

The Rusty Solution

Cargo is one of the sim­plest, eas­i­est to use build tools out there. It does every­thing you might need, and it may be why Rust may soon be­come a ma­jor player. 99% of the time, you can just copy and paste a given li­brary’s string di­rectly from crates.io, which is a repos­i­tory owned and op­er­ated by the Rust Foundation, and you are off to the races.

Testing is easy too, just run cargo test, and you’re done. It cov­ers both unit tests, and in­te­gra­tion tests if you need it.

`cargo doc`` pro­vides a con­sis­tent, and easy way to doc­u­ment code. It’s also great for users, al­low­ing de­vel­op­ers ac­cess to a straight­for­ward rep­re­sen­ta­tion of what a li­brary looks like.

It’s ex­ten­si­ble, some of the great­est bi­nary crates out there ex­ist to ex­tend the func­tion­al­ity. So, in the few ar­eas where cargo on its own does­n’t cut it, there are ad­di­tional crates to fill the gaps.

Closing

At least for the mo­ment, of all the great rea­sons to use Rust, cargo will be the most sig­nif­i­cant rea­son it will in­crease in pop­u­lar­ity.

Most loved programming languages, according to the 2021 StackOverflow Developer Survey

Rust can be tough to learn, es­pe­cially for peo­ple who are used to dy­namic lan­guages like JavaScript. But what Rust has beat for most lan­guages is the build sys­tem. cargo alone makes Rust more ap­proach­able than C/C++, Java and many oth­ers.

More and more new de­vel­op­ers will be go­ing to Rust in­stead of those other lan­guages, be­cause it is eas­ier to start with, eas­ier to learn, and has a great com­mu­nity to re­quest help from.