News

So What's Up with Microsoft's (and Everyone Else's) Love of Rust?

Microsoft already stewards several popular programming languages -- C#, TypeScript, F# -- so what's up with its love of Rust, along with the rest of the world?

Last year, for example, C++ memory corruption bugs prompted Microsoft to eye Rust as an alternative for low-level systems programming.

And just last week, pre-eminent coder Q&A site Stack Overflow released the latest edition of its huge developer survey, which found Rust landing No. 1 on the "most loved" programming language for the fifth year in a row. That's a measurement of the percentage of respondents who are developing with a language and have expressed interest in continuing to develop with it.

"If you liked C++ you're gonna love Rust!" commented one developer on the SO announcement post.

Most Loved Programming Languages
[Click on image for larger view.] Most Loved Programming Languages (source: Stack Overflow).

Surprisingly, though, SO said "the majority of developers who took the survey aren't familiar with the language." On the popularity scale, Rust was way down the SO list, in 19th place. So, even though it's hands-down the "most loved" language among the SO crowd, not that many people know much about it or use it. A conundrum.

Meanwhile just today, Rust cracked the top 20 of the TIOBE Index, which measures programming language popularity. It jumped an astonishing 18 spots -- it's unusual to see more than one or two -- from 38th to 20th.

TIOBE Index for Rust
[Click on image for larger view.] TIOBE Index for Rust (source: TIOBE Index).

Here's what TIOBE had to say about some of the above developments:

The main reason for this is that Rust is a system programming language that is done right. All the verbose programming and sharp edges of other languages are solved by Rust while being statically strongly typed. Its type system prevents run-time null pointer exceptions and memory management is calculated compile-time. So no garbage collection that suddenly kicks in. We have D, Lua and Julia trying to beat C and C++ but Rust seems to be the first one to come really close. Let's see whether it can keep this top 20 position in the years to come.

What about SO's take? Well, when it was the No. 1 "most loved" language for only the fourth year in a row before the current survey was released, SO took a deep dive into this phenomenon, in a post appropriately titled "What is Rust and why is it so popular?"

Here's SO's own TL;DR on that:

Rust promises performance, control, memory safety, and fearless concurrency -- an enticing combination, especially for systems programming. It has also brought some interesting features -- like affine types and hygienic macros -- into the mainstream discourse. Coupled with an open development process, it makes sense that many programmers (even those that don't use it) hold Rust in high esteem.

For Microsoft, meanwhile, it's all about bug safety and avoiding those pesky CVEs (Common Vulnerabilities and Exposures). The Microsoft Security Response Center team found: "The majority of vulnerabilities fixed and with a CVE assigned are caused by developers inadvertently inserting memory corruption bugs into their C and C++ code."

That prompted the team to look at alternatives to C++, which is used to write systems software and for several Microsoft products like various Windows versions, Visual Studio, Office, Internet Explorer and so on.

"We think the Rust programming language is currently the best choice for the industry to adopt whenever possible due to its ability to write systems-level programs in a memory-safe way," said Microsoft's MSRC team in a July 2019 post.

In a subsequent blog post titled "Why Rust for safe systems programming" as part of the Rust-Is-Better-than-C++ series, the MSRC team said "What separates Rust from C and C++ is its strong safety guarantees."

Why Rust?
[Click on image for larger view.] Why Rust? (source: rust-lang.org).

But along with performance and safety, the MSRC team found other Microsoft teams using Rust for other reasons, including:

  • According to an internal survey, the top reason for adoption was “correctness" -- an extension of Rust's safety guarantees that work towards making true the adage “if it compiles, then it works."
  • Rust statically enforces many properties of a program beyond memory safety, including null pointer safety and data race safety (i.e., no unsynchronized access of a piece of memory from two or more threads).
  • Many teams at Microsoft have found that Rust's rich type system makes writing expressive programs possible. Concepts like enums with associated data and a powerful trait system further enforce Rust's goal of making programs as bug-free as possible.
  • Rust's existing community is a huge benefit to the language. Much of the power of a language comes from outside of its core through libraries, tooling, and learning materials. While Rust is still a young language, it boasts a healthy ecosystem with an active and open compiler and language development process, and it shows the ability to both promote a strong open source community and to support production users. This gives us more reason to believe the language has a bright future ahead of it.

"We believe Rust changes the game when it comes to writing safe systems software," the MSRC team said. "Rust provides the performance and control needed to write low-level systems, while empowering software developers to write robust, secure programs."

While Microsoft hasn't officially substituted Rust for its C++ code, the MSRC team has subsequently been all over Rust, penning various blog posts including:

So don't be surprised, you .NET-centric developers, if you find more "help wanted" posts for Rust programmers coming from Microsoft.

About the Author

David Ramel is an editor and writer for Converge360.

comments powered by Disqus

Featured

  • AI for GitHub Collaboration? Maybe Not So Much

    No doubt GitHub Copilot has been a boon for developers, but AI might not be the best tool for collaboration, according to developers weighing in on a recent social media post from the GitHub team.

  • Visual Studio 2022 Getting VS Code 'Command Palette' Equivalent

    As any Visual Studio Code user knows, the editor's command palette is a powerful tool for getting things done quickly, without having to navigate through menus and dialogs. Now, we learn how an equivalent is coming for Microsoft's flagship Visual Studio IDE, invoked by the same familiar Ctrl+Shift+P keyboard shortcut.

  • .NET 9 Preview 3: 'I've Been Waiting 9 Years for This API!'

    Microsoft's third preview of .NET 9 sees a lot of minor tweaks and fixes with no earth-shaking new functionality, but little things can be important to individual developers.

  • Data Anomaly Detection Using a Neural Autoencoder with C#

    Dr. James McCaffrey of Microsoft Research tackles the process of examining a set of source data to find data items that are different in some way from the majority of the source items.

  • What's New for Python, Java in Visual Studio Code

    Microsoft announced March 2024 updates to its Python and Java extensions for Visual Studio Code, the open source-based, cross-platform code editor that has repeatedly been named the No. 1 tool in major development surveys.

Subscribe on YouTube