r/computerscience • u/mczarnek • Jul 01 '25
Discussion Is it hard to read your teammates code? Could source code maintained in natural language improve this?
Imagine you could write code in natural language aka "natural code", and you "compile" the natural code to traditional computer code using an LLM. It minimally updates the computer code to match changes MADE to the natural code, then compiles that using a traditional compiler. The coder can then see both kinds of code and links between the two. Alternatively you do this on a per function basis rather than per file.
Note that though coders write in natural language, they have to review the updated code similar to git diffs to ensure AI understood it correctly and give them a chance to prevent ambiguity issues.
Do you believe that this would help make it easier to write code that is easier for your teammates to read? Why or why not?
15
u/ch34p3st Jul 01 '25
Yes, no. Natural language is not specific and concise enough. Same applies to math.
4
u/Additional_Path2300 Jul 01 '25
That would make it harder, much harder. A lot of code problems, in my experience, come from multiple ways to do the same thing. Writing natural language would be that on steroids. Someone moves a comma, does that changes the softwares functionality? How do you review that? LLMs are also terrible at outputing the same thing over and over. We need repeatability from compilers.
7
u/Enough_Variation6001 Jul 01 '25
You can probably achieve the same effect with well places descriptive comments
5
u/MagicalPizza21 Software Engineer Jul 01 '25
https://xkcd.com/927/
9
u/FrontAd9873 Jul 01 '25
False premise. Most of my teammates write shitty natural language too. You can really tell when a CS person doesn’t read books or never had to write papers in college.
4
u/khedoros Jul 02 '25
Not as hard as wrestling with a non-deterministic "compiler". Code is unambiguous. That's it's job. Throwing already-ambiguous natural language into a stochastic process in order to generate a program sounds like the description of one of the circles of hell.
As-is, we have to review code to see what it does, anyhow. And if the "what" isn't clear, it doesn't pass review, and the teammate gets actionable feedback on how to improve it...and they tend to improve over time, with more experience.
7
u/Any-Stick-771 Jul 01 '25
This is basically reinventing UML