Which AI Writes Code Best? A Developer Ranked Programming Languages by AI Reliability

Ranking languages by AI coding reliability: training data and compiler feedback decide success.
The article presents a YouTube creator's ranking of mainstream programming languages by AI coding reliability: S-tier Java, Elixir, Go, Rust; A-tier TypeScript, Python; B-tier JavaScript; C-tier PHP; D-tier C++. The ranking hinges on two variables—training data volume and whether the language offers strong constraints and clear compiler feedback for AI self-correction. C++ bottoms out because undefined behavior passes compilation, leaving agents without feedback.
It's no longer novel for large models to write code, but an interesting question remains: how big is the gap in AI's ability to write code across different programming languages? A YouTube creator ranked mainstream programming languages by "how reliably AI can write this language." The evaluation dimension isn't whether the language itself is good, but whether AI can generate correct code on the first try, and whether it can detect and fix errors on its own. This perspective is quite practical for anyone using AI-assisted programming in daily work.
Ranking Overview: Which Languages AI Writes Best
Let's get the conclusions out first. S-tier (AI writes most reliably): Java, Elixir, Go, Rust; A-tier: TypeScript, Python; B-tier: JavaScript; C-tier: PHP; D-tier (least reliable): C++.
The underlying logic of this ranking boils down to two things: how much training data there is, and whether the language has strong constraints that help AI self-correct. Meeting either condition earns a decent score; meeting both earns S-tier.
A-Tier: Plenty of Training Data, But Missing a Safety Net

TypeScript was placed in A-tier. The reason is straightforward: AI has been trained extensively on TypeScript, plus the type checker catches many issues. The reason it didn't get S-tier is somewhat darkly humorous—AI particularly loves using the any type, essentially dismantling the type system's defensive line itself.
Python also benefits from massive training data, and models usually write it correctly on the first try. But the creator points out that Python has almost no compile-time checks—AI-fabricated "non-existent types" and various bugs only surface at runtime, lacking an early interception gate, so it stops at A-tier.
JavaScript's situation is summed up in one sentence: "it's just a worse version of TypeScript," thus landing in B-tier.
S-Tier: Either No Choice, or a Compiler as Coach
Elixir is a counterintuitive case. By rights, its open-source code volume isn't large, AI training material is limited, and its performance should be poor. But the creator believes it should actually be in S-tier: this language has almost only one way to do everything, and data is immutable, so AI has no room to "go astray" at all.
Go takes another path—small language, fast compilation, unified conventions. Once AI writes something wrong, the compiler immediately reports an error, and the Agent can self-correct accordingly. The creator admits AI occasionally writes goroutines incorrectly, but that's not enough to bump it out of S-tier.
Rust is seen as the ideal language for AI feedback loops: the compiler provides extremely high-quality error messages, and the Agent can follow the prompts to fix problems. The only complaint is slow compilation speed, but the creator believes that doesn't affect its S-tier status.
Java's evaluation is the shortest and most domineering: "S-tier, no explanation needed."
The Agent-style self-correction loop refers to AI not just "writing code in one go and calling it done," but being placed in a closed loop of "generate → run/compile → read errors → modify code" iterating repeatedly until it passes checks. The efficiency of this loop depends heavily on the quality of feedback signals: the more specific the errors given by the compiler or type checker (for example, Rust directly points out which variable violates borrowing rules on which line and how to fix it), the easier it is for the model to locate the problem; conversely, if errors only manifest as runtime crashes, or even "silently compute wrong" like C++ undefined behavior, the model gets no actionable clues. This also explains why the same phrase "AI can write code" has vastly different experiences across languages—the difference often isn't in the model itself, but in whether the language can clearly tell it "you're wrong."
Elixir's immutable data and "single way of writing" deserve a bit more elaboration. Elixir runs on the Erlang virtual machine, data is immutable by default, and variables can only be rebound rather than modified in place, so there's no common bug source like "multiple places sharing and quietly modifying the same state" found in Java and C++. Combined with functional style and community-conventional writing, the same thing usually has only one mainstream implementation, and even if AI-generated code has unfamiliar style, it's hard to write "logically skewed" structures. This is similar to Go's philosophy—Go uses gofmt to unify formatting, has very few language features, and the community rejects over-abstraction, all essentially narrowing the space of "correct answers" to make it easier for models to hit the mark.
D-Tier and C-Tier: The Plight of C++ and PHP

C++ was thrown into D-tier, and the reasoning deserves a closer look. This language has forty years of accumulated code for training, so material is abundant—the problem lies elsewhere: the same thing has dozens of ways to write it, and undefined behavior and memory bugs can pass right through the compiler.
More critically, the latter half—since these errors have already passed compilation, the AI Agent gets no error feedback whatsoever, losing any handle to fix the problem. Without feedback, even the strongest model can only stare helplessly. This precisely explains why Rust and Go score high thanks to the compiler, while C++ ends up at the bottom.

PHP was rated C-tier. The creator mentions that AI is very good at finding PHP language-level vulnerabilities, but the training corpus is flooded with WordPress plugins and beginner-written code, and material quality drags it down, resulting in overall performance inferior to other languages.
Undefined Behavior (UB) is a key concept in C++: the standard in certain cases (such as out-of-bounds array access, signed integer overflow, dereferencing null pointers, using uninitialized variables) does not specify what the program should do, and the compiler can handle it arbitrarily. The scary part is that it often "looks normal"—compilation passes, the program may produce results, but the results are unpredictable; changing compilers or optimization levels can change behavior. For AI Agents this is the worst case: no errors to read, so it can't tell it wrote something wrong, and may even treat a wrong implementation as correct and continue building on it. In contrast, Rust uses the borrow checker to intercept such problems at compile time, and Go exposes out-of-bounds via runtime panic, both at least giving the Agent a clear failure signal.
What This Ranking Reveals for Everyday Coding

Putting this ranking into practical work, at least three layers of meaning emerge.
First, compilers aren't just for humans—they're for AI too. The clearer the error messages and the faster the compilation, the shorter the Agent's self-correction loop. When choosing a tech stack, if you plan to rely heavily on AI assistance, this point is worth considering.
Second, a language's "constraint" is becoming productivity. Languages like Go and Elixir that allow only one correct way to write things happen to compress the space for AI to freestyle, naturally lowering error rates. Conversely, languages with extremely high freedom of expression are flexible for humans but prone to AI mishaps.
Third, large training data doesn't equal good performance. Both C++ and PHP have plenty of material, but one fails because its writing style is too divergent and errors can't be fed back, while the other fails because material quality isn't high. Beyond data, the language's own verifiability is the key variable determining AI output quality.
It should be noted that this is one developer's personal ranking with subjective judgments—for example, Java's "no explanation needed" S-tier isn't argued in detail. But it provides a valuable observation angle: rather than vaguely discussing "whether AI will replace programmers," it's better to ask specifically about a given language—can AI, in this language, discover its own mistakes?
The answer to this question may predict your coding experience tomorrow better than model parameters.
One-line Summary
Ranking programming languages by AI coding reliability: training data and compiler feedback determine success or failure.
Paragraph Summary
The article introduces a YouTube creator's ranking of mainstream programming languages by "how reliably AI can write this language": S-tier is Java, Elixir, Go, Rust; A-tier is TypeScript, Python; B-tier is JavaScript; C-tier is PHP; D-tier is C++. The ranking isn't based on language merits but on two variables—whether training data is sufficient, and whether the language has strong constraints and can provide clear compiler feedback to help AI self-correct. TypeScript stops at A-tier because AI abuses any and destroys its own type defense; Python also stops at A-tier for lacking compile-time checks. Elixir enters S-tier thanks to "only one way to write" and immutable data; Go and Rust enter S-tier thanks to fast or high-quality compiler errors. C++ has abundant material but divergent styles and undefined behavior that passes through the compiler, leaving the Agent without feedback and at the bottom; PHP is trapped by uneven training corpus quality.
Related articles

Snapchat Opens AI Assistant Lens Building: Supports Claude Code and Cursor
Snapchat lets Lens creators describe AR filters in natural language, with AI assistants like Claude Code and Cursor handling the full build process, greatly lowering the AR creation barrier.

Is the Planck Length the Smallest Distance? Why Physicists Are Skeptical
The Planck length is often called the smallest distance in the universe, but science videos point out this claim has never been experimentally confirmed. This article explains the origins of the Planck length, the obstacles of microscope thought experiments, and what it really tells us—the scale at which quantum gravity becomes unavoidable, not spacetime pixels.

AI Agents Drive Spend Management: Payhawk Raises $280M
Payhawk raises $280M at a $2B valuation. The 2018-founded enterprise finance platform uses AI agents to track and manage expenses and procurement. This article analyzes its product evolution, valuation signals, and impact on the spend management space.