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 at Converge 360.

comments powered by Disqus

Featured

  • Compare New GitHub Copilot Free Plan for Visual Studio/VS Code to Paid Plans

    The free plan restricts the number of completions, chat requests and access to AI models, being suitable for occasional users and small projects.

  • Diving Deep into .NET MAUI

    Ever since someone figured out that fiddling bits results in source code, developers have sought one codebase for all types of apps on all platforms, with Microsoft's latest attempt to further that effort being .NET MAUI.

  • Copilot AI Boosts Abound in New VS Code v1.96

    Microsoft improved on its new "Copilot Edit" functionality in the latest release of Visual Studio Code, v1.96, its open-source based code editor that has become the most popular in the world according to many surveys.

  • AdaBoost Regression Using C#

    Dr. James McCaffrey from Microsoft Research presents a complete end-to-end demonstration of the AdaBoost.R2 algorithm for regression problems (where the goal is to predict a single numeric value). The implementation follows the original source research paper closely, so you can use it as a guide for customization for specific scenarios.

  • Versioning and Documenting ASP.NET Core Services

    Building an API with ASP.NET Core is only half the job. If your API is going to live more than one release cycle, you're going to need to version it. If you have other people building clients for it, you're going to need to document it.

Subscribe on YouTube