Have You Forgotten To Take Out The Garbage? No Need With Rust!

Python brings lots of libraries but is slow and its version control is not great. JavaScript and Node.js are great back-end coding…

Photo by NeONBRAND on Unsplash

Have You Forgotten To Take Out The Garbage? No Need With Rust!

Python brings lots of libraries but is slow and its version control is not great. JavaScript and Node.js are great back-end coding languages, but they struggle with their version control and in their relative slowness. Golang has great GitHub integration and does fairly well with its version control. It is also as fast as C, but it, again, can be attacked with malicious library integration. It’s syntax, too, can be cumbersome. So which language is fast, secure, and scalable? It’s (perhaps) — the programming language that doesn’t need a garbage collector — Rust.

Borrow checking

Unlike Python, Java and Node.js, Rust compiles to a binary code and does not need a run time environment like .NET/C# and Java. For this, it has a “borrow checking” method and where a developer goes not have to release used-up memory — the compiler does it. It thus avoids the C programming nightmare of memory overruns and underruns (and is memory safe) — no memory leakage. Along with this, it supports concurrent operations. Overall, Rust runs as fast as C, and faster in many applications. At the core of this, is the ability for the Rust compiler to code directly to native machine code, and thus optimize the operations. This leads to not having to worry about garbage collection, as we do with many other programming languages.

So what about its usage in the industry? Well, you’ll find that many of the major software infrastructures, such as AWS, Microsoft, Dropbox and Mozilla have adopted the language, in order to create a secure and scalable coding environment.

Cargo

This speed and security come at a cost … as the compiler is doing so many additional checks, there is a steep learning curve in learning the language. But, once you are there, there’s an amazing toolchain to support the integration of virtually every library you can think of, and there’s even a package manager: Cargo. You basically create a project with “cargo new projectname”, and then add your Rust code (with an rs extension) to the src subfolder. Add a TOML file to define the crates you want to use, and then issue “cargo build”, and it builds it for you. Then to run, it’s just “cargo run”, or find the EXE, and you are off and running.

And Environment?

So what about coding? Well, if you like light-weight environments, there’s the wonderful Microsoft Visual Studio Code, or the mighty Microsoft Visual Studio. There’s lots of add-ins, and highlighters to help you with you code:

The CLI to build a CLI

Rust is — perhaps — the language that you build core tools, as it is so trustworthy. So building operating systems, compilers, and developing frameworks are all perfect for a language that checks things at the gate and makes sure there’s no updated version of libraries that can slip in additional code. As with .NET/C# it is perfect for creating CLI (Command Line Interface) programs, which are so loved by developers.

And Rust, of course, is built for the Web, and supports the integration of HTML, CSS and JavaScript. For this, it supports WebAssembly so that Web integration is well supported, and in a secure manner.

But, a key focus is to make developers think of about what they actually need to d. They can’t just be sloppy in passing any old variable into methods; they have to be very clear from the start how this is done, as there is much more enforcement of these things by the compiler. This overcomes many of the problems in other languages, especially in the usage of pointers in C, and in the casting of anything to anything else.

And for a career option? It’s often seen as the top-paid programming language, and if you have skills in cybersecurity (Sec) and network operations (Ops), you are looking at a nice career going forward. As as industry, we are moving to the concept of having SecDevOps — a developer who knows security, development and operations. Rust will keep all of those areas well covered.

So what about adoption? Well, Amazon is now building with it, and there’s the Rust foundation, so it’s not going to go away any time soon.

If you are into cybersecurity — and everyone should be — then here are few Rust examples:

https://asecuritysite.com/rust/

Remember … as Neil Young says … Rust Never Sleeps:

A small tip … if you are a Cybersecurity student and have mastered Python, and now looking to move forward? Consider Rust as your second language. It will truly differentiate you from others who just have Python skills and show that you want to build and test things that are secure by design.