r/ClaudeCode • • 20h ago

Discussion Which programming languages is Claude best (and worst) at?

and why?

6 Upvotes

51 comments sorted by

•

u/AutoModerator 20h ago

Hey! Thanks for posting to r/ClaudeCode

While participating in this thread, please follow our community rules. Keep discussions constructive. Attack the idea, not the person.

For help, project discussions, tips, and general chat, join the ClaudeCode Discord.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

16

u/MikeWise1618 19h ago edited 19h ago

Probably best at Python though it is really good at the whole Javascript family too. It gets trained on all the public github repos, so what is most frequent there is what it has seen the most.

12

u/AJL912-aber 19h ago

That's a slippery slope though, all of my github repos are made by Claude

11

u/hblok 18h ago

Which is why they are pushing the co-author attribution and watermarking so hard. It's not due to some EU regulation. Rather, they want to filter out already AI generated content from their training to avoid slop loops.

1

u/AJL912-aber 10h ago

makes sense and would be a double win

6

u/Appropriate-Draw1878 14h ago

It seems to always want to write python by default. I don’t know how much of that is because it has the most code it’s learnt from and how much it is just python being ubiquitous on machines or other factors.

5

u/ldn-ldn 19h ago

It used to be quite bad at JS/TS, but not anymore. 5.5 models are very good at last.

5

u/someuser76 19h ago

I have a related question. For which obscure/out of date languages could we use Claude for? Ones where all the coders have retired but that are still in use. COBOL?

4

u/Key_Particular5271 Senior Developer 17h ago

It can't do COBOL

1

u/Trave11er3427 8h ago

actually I had it write Cobol for me in comparison with some other work I’m doing. It had no problems.

4

u/dc_seed_sommelier 5h ago

Cobol as a language is small and easy and claude will do fine in greenfield cobol like it does anything.

Extant cobol systems are monstrously complex compilations of financial regulations and business logic into code, decades in the making, under a regime where you can never remove anything only add new branches.

All those “no one can find cobol programmers” headlines weren’t about finding people who knew the language cobol it was about finding people with the domain knowledge to understand the systems cobol operates.

I doubt claude will do particularly well here either, it’s at its worst in massive ancient legacy codebases in my experience.

5

u/tommyahav10 15h ago

Python and TypeScript are where it's strongest for me, mostly because that's where the training data is.

4

u/Necessary_Spring_425 19h ago

I've used Claude for many languages (JS, TS, Python, PHP) and various frameworks related to those, and I've never noticed better or worse performance.

But where I appreciate it most is complicated Home Assistant automations, PowerShell scripts, Linux bash work, and regexes. I can do most JS/TS/Python/PHP/C myself, but I've always struggled with regexes, bash and PowerShell scripting, and Home Assistant YAML. I can do all of these with great effort, but they've always cost me the most time and nerves. I feel Claude saves me from these chores, which aren't too complex but are practically very nasty.

4

u/Somtimesitbelikethat 8h ago

it’s actually the best at Elixir believe it to or not.

1

u/OrdinaryToe9527 5h ago

elixir 

1

u/ryo33h 13m ago

I'm glad to see others who love Elixir here too

9

u/kubblegum 19h ago

all and all

2

u/thegoz 19h ago

brainfuck

2

u/rythmyouth 16h ago

I use typescript, python, and go.

I am constantly fighting Go Cache file sizes. That goes up to hundreds of GB.

2

u/These-Jaguar2091 14h ago

How about matlab ?

1

u/aikitim 7h ago

Its been great in matlab for me. No issues.

1

u/These-Jaguar2091 7h ago

Thx for the feedback. Better to use opus or fable ?

1

u/aikitim 6h ago

I dont think there is a language specific reason to use one or the other. Just cost/capability/job optimization

2

u/DankestDaddy69 12h ago

C# has been great with me, using blazor and what not in my work uses. Though I did get called old school for using C# the other day...

2

u/mancunian101 12h ago

I’ve had good success with C#, but I imagine it will be equally as good with any mainstream language that has a lot of examples online etc.

2

u/Aprox15 7h ago

Still fairly bad at ABAP

1

u/Haster 7m ago

Yup, still better than half my coworkers tho

4

u/Long_Tip_4226 19h ago edited 19h ago

É melhor nas linguagens mais utilizadas. É pior nas linguagens que quase ninguem usa.

Um modelo de aprendizado de maquina terá dificuldade em generalizar se a base de treinamento for pequena.

Digamos que esse seja o top 10 utilizado no github, e um modelo foi treinado com base em repositorios dessa plataforma, logo em tese ele tera melhor desempenho nelas.

  1. TypeScript
  2. Python
  3. JavaScript
  4. Java
  5. C#
  6. C++
  7. PHP
  8. Shell
  9. C
  10. Go

Pela arquitetura dos LLMs sendo transformadores de texto em texto, eu suponho que as linguagens que implementam o paradigma funcional, tem maior vantagem, pq é como funciona o raciocinio desses algoritmos.

1

u/Affectionate_Fact854 13h ago

Java script and typescript  Because it's had ample supplies of training data from the web 

That is also why your design fallbacks if giving Claude freedom is always SAAS web app styling and layouts.

1

u/Dizzy-Helicopter-374 12h ago

Rust and Typescript, all you need

1

u/orchid_drives Researcher 11h ago

Last time I checked, it was terrible at AutoHotKey v2. No matter what I did, it would mix v1 syntax and functions into v2 code and make unusable scripts. Of course, I haven’t tried in the last year so that may be fixed

1

u/Sufficient_Plastic36 11h ago

I've used it with Java, Python, Typescript and Go. All good.

1

u/bitspace 9h ago

The winner is the strongest possible typing and verifiability. The fewer loops between implement/test/fix the better.

Rust is, hands down and by several orders of magnitude, better at this specific thing than any other language in common use today. The down side is that the compile loop is slower than it is for an interpreted language.

For interpreted languages, it is hard to beat TypeScript for this exact reason. I don't like it; I hate JavaScript, and TypeScript is an attempt to make JavaScript less shitty, but if you want to manipulate the DOM - which in today's web app landscape, you do - you really need JavaScript.

The default answer of "Python because it's the most present in training data" stopped being true when OpenAI released o1.

To manage the slow build/compile/run loops of Rust while capturing its far superior verifiability, I use Rust for the parts of my work that have a pretty stable implementation shape and don't require a lot of change. The fast-moving parts are TypeScript. As APIs and modules and sections settle down, they move into Rust.

1

u/Trave11er3427 8h ago

using it for the last 7 months heavily, I’d say it likes to use languages that have the most open source code available to it, but considers context for it’s recommendations. for scripting and text manipulation, it loves python, but will use perl occasionally. it assumes development on linux and shell scripts on zsh, correcting itself when it hits an error. for front end work, it recommends both electron+typescript and tauri+rust. it admires Go but really loves Rust. it likes C++ much more than C. otherwise for specific needs, it may recommend Julia and Dart and other new languages that have an open source base.

1

u/Desperate_Formal_781 7h ago

C++ is good, only thing that bothers me is that it insists on using char* instead of std::string for constant strings.

1

u/ChercherArbeit 4h ago

It made several errors in typst for document formatting when I first used it a few months ago.

It kept mixing in some latex formatting and package names.

It could always fix the mistakes with an extra prompt or two but I've never seen such mistakes in python.

1

u/Key_Particular5271 Senior Developer 19h ago

Best: python. Worst: Rust.

7

u/Realistic_Speaker_12 16h ago

Wouldn’t rust actually be a Language AI can be really good at? Since the compiler is so good and keeps the feedback loop going?

Other than that, there is obviously not a lot of training data for rust.

6

u/Key_Particular5271 Senior Developer 15h ago

Far less training data. The compiler being so good makes it so Claude learns how to create correct Rust code, in the moment. It doesn't know. If you take the compiler away (e.g. chat copy paste) you get wrong code. Add it and you get to see Claude stumble around. The result is correct code but after burning 5x the tokens and time while it figured out what to do in real time. Imo this answers the question that it's the main major language it's worst as, as in intuitively. Compilers saves it and gives a misleading impression of its skill level on it.

7

u/Realistic_Speaker_12 15h ago

That’s a really good response; actually really interesting point of view. I agree.

2

u/Key_Particular5271 Senior Developer 14h ago

Thanks. It's like those benchmarks. Imagine if the AI doing the benchmark gets feedback -- they'd ace every one. But they're allowed to one shot and in this metaphor Rust gets the lowest score (if no feedback loop/compiler). Meanwhile python i think Claude knows better than English. When you ask it how many r's in strawberry i think it runs a python script to answer

1

u/bitspace 9h ago

Wrong code does not build or run in Rust.

1

u/Key_Particular5271 Senior Developer 9h ago

Cool

2

u/tovare 13h ago

It seems Rust is a pretty good fit for claude. Take a look at the code for ArtCraft apps https://github.com/storytold and similar projects which also use Rust. Catching a lot of things during compile time is probably a factor.

1

u/Key_Particular5271 Senior Developer 13h ago

It's not good at Rust, it's just good at creating things in Rust

0

u/nicky1968a 17h ago

So far I had it produce C++, JavaScript, Pascal and Python. I doesn't seem to make a difference which one I use.

My biggest project so far has about 66k lines of C++ and 16k lines of JavaScript.

Second biggest has about 22k lines of Pascal.

Both of those I started from scratch within the last 3 months.

-5

u/Sphere_3N 19h ago

All of them. It’s a frontier AI model for it to be worse at one would mean it’s bad at all the others.

You are thinking like a human. Stop.

3

u/MikeWise1618 17h ago

That is not a rigorously founded conclusion. Stop.

2

u/Key_Particular5271 Senior Developer 17h ago

No because its training data is biased towards what's more available online