A recent Stack Overflow survey revealed Zig is highly-admired and developers are highly-paid – but why?
The level of pay someone can earn shouldn’t be the primary reason that developers decide on which programming language to learn. Nor is how much they’re admired by your peers. But both are useful factors when deciding where to invest your time.
Which makes the recent Stack Overflow survey and its suggestion that Zig is among the more admired programming languages around, as well as a high-earning skill – all the more interesting.
The average Zig developer can earn $75,332 a year according to the survey – more than those that code in more established languages like C++, JavaScript, and SQL. It also came in as the third-most admired language amongst developers, sitting just behind Rust and Elixir.
Although the language is only used by about 1% of the respondents, it’s trending upwards, fast. “Zig's appeal lies in its simplicity, modern design, and the balance it strikes between low-level control and runtime safety,” says Ali Cheragi, an advocate of the language and a FOSS developer.
Why Zig?
Cheragi picked up Zig as a young programmer after researching which language was most suited to his needs. “I chose Zig as my daily language because of its unique combination of features and goals,” he says. “I was drawn to Zig's safety, while letting me control the lowest level pieces.”
The programmer was also a fan of how the language approached errors, using error unions and defer – which caught his attention as an improvement over more traditional methods. “Additionally, the clear and consistent syntax, along with powerful compile-time capabilities, made Zig an attractive choice for me,” he says.
For Stephen Gutekanst, who is building Mach, a game engine written in Zig, the choice was also clear. “Unlike a lot of other languages, Zig has really seamless interoperability with existing C code,” he says. That’s vital for a number of reasons.
“Zig is basically overhauling a lot of programming infrastructure that nobody dared to touch in like 40 years,” explains Loris Cro, vice president of community at the Zig Software Foundation. “C and C++ are programming languages that are famous for being core programming languages where you get to have full control over the hardware. But at the same time, those languages have horrible tool chains.” Zig allows users to dabble with those core programming languages, but to use better tool chains that are compatible with languages and a richer set of features.
An overhaul in programming
“A lot of other languages are structured in such a way that interacting with the code is extraordinarily painful,” adds Gutekanst. But you don’t need to interact with them through standard means; you can use Zig.
This interoperability is crucial in an industry where legacy code is omnipresent. Zig allows developers to gradually adopt the language without necessitating a complete overhaul of existing systems – giving it a significant advantage for companies looking to modernize their codebases over time.
But Zig’s appeal isn’t just that it plays nicely with old code. It also nullifies a major issue for those in the world of traditional C/C++ development: how difficult it is to compile code for different platforms.
“Let's say you're making a tiny indie game, and you want to give it to a friend that has a Mac. Good luck compiling your game from Windows to Mac,” Cro says. “With Zig, where everything is written in Zig, or in C or C++, or even a mix, you can always cross-compile it for macOS or Linux, and vice versa. And it works.”
Deeper thinking
Gutekanst is also a fan of Zig because of how different it is to a lot of programming languages these days. Zig's design forces developers to think about how their code interacts with the underlying system, leading to more efficient and performant applications.
“There aren’t many other languages that force you to think about and care about how your code is actually interacting with the machine,” he says. “You’re actually caring about performance, and your code kind of ends up being simpler.”
And for that reason, companies big and small are starting to adopt Zig – building it up from that small 0.83% representation in the Stack Overflow community. Cro highlights two startups, Bun and Tiger Beetle, that are betting big on Zig. Bun is developing a competitor to Node.js, while Tiger Beetle is building a distributed financial database where precise control over resources is critical.
Cheragi also highlights Uber, which uses Zig – not as a primary language – but as a build tool chain for its C and C++ code, leveraging Zig's superior compilation capabilities.
That adoption makes sense, says Gutekanst, who believes other companies will soon follow suit. “I think that if you're not looking at [Zig] in your organization, at least for the build tool chain, then you're really missing out.”
In last year’s Stack Overflow survey, Zig burst onto the scene and started to grab more attention. The question many in the industry had was whether it would have staying power. The fact it still ranks high in people’s minds for the 2024 iteration of the survey suggests that it’s no flash in the pan – making Zig a smart bet to learn.