Coding with copilot is definitely more mentally draining: every reading of generated code is mental effort.
Nudging it toward the intended outcome is so high effort that it's often faster to "explain in code". At that point, the only value is correct syntax in the few cases where it happens to guess correctly, and I'm not sure if that balances the mental cost and time spent.
Maybe worth it when not familiar with the language?
Eh, if you know like 3 different languages you can spot most logic mistakes in any other language as well. Maybe not syntax mistakes, or when a bit of syntax hides a lot of complexity. But in most cases you will understand.
The problem is when the LLM generates non idiomatic code, or when it uses obsolete libraries (all the time!) or generally adds unnecessary comments etc etc
There’s a lot of junior coding mistakes it makes. Apparently people say you can nudge it by iterating on your prompts, but then it just seems like you’re using a fuzzy programming language and you’re at risk of LLM changes.
Totally agreed, I do find that LLMs are mostly helpful in dealing with libraries with a complex API like matplotlib, or unknown programming languages/libraries/frameworks.
Reading code is still harder than writing it, so it has to be worth reading it.
Although I can usually make rhyme and reason from code in an unfamiliar language at a bird's eye level (this information needs to go there), I can't tell whether code is idiomatic, performant, or maintainable in an unfamiliar language.
Famous example, in-place algorithms that LLMs write as out-of-place, making them more memory intensive than anticipated - in some (functional) languages this might be desired and idiomatic (and compiles to in-place JVM code) but in most (imperative ones) it is not.
This makes LLM output low-quality "make it work no matter what" code at the level you expect to get from a junior contractor hired off the street who doesn't care to look further than the next billable hour. When the rubber meets the road and you need better quality, experience tells me that you still need an expert.
I've given it a try to write some bitwise operations for a compression algorithm I've been working on. It set me back multiple days, not only because the code it generated was flat out wrong, but because it offered up so many bad rationalizations for what it was trying to do that it literally polluted my brain with bad assumptions. Fixing one bug only revealed that some other code that previously appeared to be working okay was also FUBAR, and so on and so forth until I finally rewrote the whole entire thing from top to bottom myself. It would have been much easier just to write it from scratch.
When you're debugging code written by a human, you tend to assume that most of the assumptions they made were correct, and that one or two silly mistakes were all that was keeping it from working. So you go through it one by one, only to realize that it just never fucking ends with the LLM.
From an OLD programmer, in the old days, could write a program and put comments in COBOL. You could read the code or read the comments. It made program maintenance so much easier.
Any language can be written badly through terrible structures, variables, params, etc. But some are way better, or worse than others.
I would argue that Ada is one of the better languages for reading. This is a seriously huge contributing factor to maintenance and safety. The problem is the culture surrounding it.
Rust is one of the safest languages, but it is very very hard to read, even if written clearly.
C and C++ have cultural problems where pedants like to make their code as unreadable as is possible. When it comes to some people's use of templates, I literally say most ASM is more readable.
Python's huge win is that it is fairly hard to write accidentally obfuscated code.
Other languages like javascript have the problem of very clearly written code doing something other than what was seemingly clearly written.
Then you get the OCD enterprise java crowd who over-organize their code to the point where it is no longer comprehensible.
let map = std::collections::HashMap::from([
("a".to_string(), 1),
("b".to_string(), 2),
]);
Here is the super verbose Ada:
with Ada.Containers.Hashed_Maps;
with Ada.Strings.Unbounded; use Ada.Strings.Unbounded;
with Ada.Strings.Hash;
procedure Example is
package String_Maps is new Ada.Containers.Hashed_Maps
(Key_Type => Unbounded_String,
Element_Type => Integer,
Hash => Hash,
Equivalent_Keys => "=");
use String_Maps;
Map : Map_Type;
X : Integer := 0;
Key : constant Unbounded_String := To_Unbounded_String("a");
begin
Map.Insert(To_Unbounded_String("a"), 1);
Map.Insert(To_Unbounded_String("b"), 2);
if Map.Contains(Key) then
X := Map.Element(Key);
else
X := 0;
end if;
end Example;
Which I can mentally compile very easily; even though it is novella sized. And this Ada is more obtuse than usual.
let x = map.get("a").cloned().unwrap_or(0);
Python:
x = {"a": 1, "b": 2}.get("a", 0)
C++:
int x = map.contains("a") ? map["a"] : 0;
I'm not condemning rust, as it is my preferred language, but I find my mental compiler is working overtime to read others, or my own old code. There tend to be lots of clones, unwraps, and weird other bits which pile up. It isn't even the verbosity.
I would argue that if Ada had the same attributes as rust when it comes to MIT, and more permissive tools, that the wider commercial and hobbyist audience would adopt it.
I've heard numbers like 15k per seat to properly get started with Ada commercially.
I don't write any rust, and as I understand it has a lot of great features, but it's syntax looks pretty ugly to me. Then again most programming syntax looks ugly to me other than like quroum and Lua.
If you can, write down the context in the commit messages. The best thing to write down is the answer to the most common question when reading code. This question is always "why?"
The Ada programming language was specifically designed to be more readable than writable because code is read more than it's written.
Then developers reject Ada because it's too verbose! Many developers are only interested in today's problem of wetting the code, readability and maintainability are tomorrow's problem!
Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it.
Now we're entering a wondrous time where developers are producing code that they, themselves, are incapable of understanding (and somehow people think this is fine)... which of course raises the question --- what hope do they have of debugging it?
Pretty soon there won’t be a single part of a business that is able to fully operate without software engineering support. The opposite of what we are constantly being told
It seems that I’ll have job security for the rest of my career, but I don’t want the last years of that career to be spent focused on fixing slop (whether computer generated or otherwise).
Actually, I did this for a bug in JavaScript so I wouldn't have to read the long function. 'Why does this function return undefined' and it hit it right
Is that an argument from authority? Just because the old man is famous doesn't mean that I should take as the word of god every utterance he ever made that's been taken out of context and laundered into an adage by some wiseguy handing out advice by the watercooler.
You dismiss an argument based on ad hominem ("hacks repeat this, so it's invalid"), then call the rejection of your premise an argument from authority? Lol, not helping your case bud
Yea I'm with you. What should be said is that "code is read many times and written only once". That part is true and the reason why readability is more important. "Harder to read than write" is just not true.
I think there is more to it than that. Also witticisms are often memorable because of their apparent contradictions. If you just read things at a surface level, you're missing the point.
"Reading code is harder than writing code" can be taken as "writing code that not only works but is comprehensible to the reader is difficult and important" and "reading code so you understand it well enough to modify it in an efficient and safe manner is harder than rewriting or clumsily extending it with limited understanding, but yields better results"
This is why I prefer somewhat verbose languages like Pascal, Modula-2, Oberon, Ada, etc. C and C++ are too terse to read easily. I say somewhat because COBOL and Java are too verbose.
These are 2 very different cases. With C the syntax is relatively simple and any difficulty (if any) is connected to a style and name convenient.
While C++ is a totally different story. With operator overloading and such one can never be sure what will be the outcome of an innocent expression like a = b;
I think I agreed with this more in my formative years, but reading a new codebase is a skill, a skill that you can improve on.
I can certainly get up to speed on a 100k+ codebase faster than I could write one, so I’m not sure what specific definition this idiom is supposed to be true in
God I hate people like this. Had coworkers who always relied with "no shit" or "yea isn't that obvious?" or some similar nonsense whenever you talked to them about interesting stuff. What's the point of your comment? You already know everything, we get it.
Nonono, some Nepo baby is letting AI write code that we have to debug after they've sold their spaghetti code startup for millions to like, softbank or some other idiot.
Was just thinking about this a day before
Training myself on complex pointer (*) structures, I could visualize myself writing it fast, but then outside visualization I found it difficult to read it
CrayonUpMyNose@reddit
Coding with copilot is definitely more mentally draining: every reading of generated code is mental effort.
Nudging it toward the intended outcome is so high effort that it's often faster to "explain in code". At that point, the only value is correct syntax in the few cases where it happens to guess correctly, and I'm not sure if that balances the mental cost and time spent.
Maybe worth it when not familiar with the language?
EternityForest@reddit
The lack of trivial bugs like off by one errors or just randomly typing x+y when you meant x+z is a major time saver.
Plus, it knows about new library functions and best practices before I do.
The_Northern_Light@reddit
If you don’t know the language what hope do you have of identifying problems in the code you couldn’t write?
Proper-Ape@reddit
Eh, if you know like 3 different languages you can spot most logic mistakes in any other language as well. Maybe not syntax mistakes, or when a bit of syntax hides a lot of complexity. But in most cases you will understand.
codemuncher@reddit
The problem is when the LLM generates non idiomatic code, or when it uses obsolete libraries (all the time!) or generally adds unnecessary comments etc etc
There’s a lot of junior coding mistakes it makes. Apparently people say you can nudge it by iterating on your prompts, but then it just seems like you’re using a fuzzy programming language and you’re at risk of LLM changes.
Proper-Ape@reddit
Totally agreed, I do find that LLMs are mostly helpful in dealing with libraries with a complex API like matplotlib, or unknown programming languages/libraries/frameworks.
Reading code is still harder than writing it, so it has to be worth reading it.
CrayonUpMyNose@reddit
We are in agreement.
Although I can usually make rhyme and reason from code in an unfamiliar language at a bird's eye level (this information needs to go there), I can't tell whether code is idiomatic, performant, or maintainable in an unfamiliar language.
Famous example, in-place algorithms that LLMs write as out-of-place, making them more memory intensive than anticipated - in some (functional) languages this might be desired and idiomatic (and compiles to in-place JVM code) but in most (imperative ones) it is not.
This makes LLM output low-quality "make it work no matter what" code at the level you expect to get from a junior contractor hired off the street who doesn't care to look further than the next billable hour. When the rubber meets the road and you need better quality, experience tells me that you still need an expert.
CherryLongjump1989@reddit
I've given it a try to write some bitwise operations for a compression algorithm I've been working on. It set me back multiple days, not only because the code it generated was flat out wrong, but because it offered up so many bad rationalizations for what it was trying to do that it literally polluted my brain with bad assumptions. Fixing one bug only revealed that some other code that previously appeared to be working okay was also FUBAR, and so on and so forth until I finally rewrote the whole entire thing from top to bottom myself. It would have been much easier just to write it from scratch.
When you're debugging code written by a human, you tend to assume that most of the assumptions they made were correct, and that one or two silly mistakes were all that was keeping it from working. So you go through it one by one, only to realize that it just never fucking ends with the LLM.
zerpa@reddit
Collary; it's harder to write code than it is to read it.
rbel53@reddit
From an OLD programmer, in the old days, could write a program and put comments in COBOL. You could read the code or read the comments. It made program maintenance so much easier.
hayt88@reddit
Code is read more than written. You basically learn early on to write code that is easy to read even if writing it is more of a hassle.
If "reading is harder than writing" then maybe you are doing something wrong?
Also if you let a LLM generate hundreds of lines of code for you you know have to go through and understand, you might also be doing something wrong.
LessonStudio@reddit
Any language can be written badly through terrible structures, variables, params, etc. But some are way better, or worse than others.
I would argue that Ada is one of the better languages for reading. This is a seriously huge contributing factor to maintenance and safety. The problem is the culture surrounding it.
Rust is one of the safest languages, but it is very very hard to read, even if written clearly.
C and C++ have cultural problems where pedants like to make their code as unreadable as is possible. When it comes to some people's use of templates, I literally say most ASM is more readable.
Python's huge win is that it is fairly hard to write accidentally obfuscated code.
Other languages like javascript have the problem of very clearly written code doing something other than what was seemingly clearly written.
Then you get the OCD enterprise java crowd who over-organize their code to the point where it is no longer comprehensible.
Slow-Rip-4732@reddit
Rust is incredibly easy to read. Like actually one of the easiest.
LessonStudio@reddit
Here is the super verbose Ada:
Which I can mentally compile very easily; even though it is novella sized. And this Ada is more obtuse than usual.
Python:
C++:
I'm not condemning rust, as it is my preferred language, but I find my mental compiler is working overtime to read others, or my own old code. There tend to be lots of clones, unwraps, and weird other bits which pile up. It isn't even the verbosity.
CharacterMaster8957@reddit
It's too bad Adam has these cultural problems, it's really a great language. Easy to pick up.
LessonStudio@reddit
Is Adam to blame? I didn't know \s
I would argue that if Ada had the same attributes as rust when it comes to MIT, and more permissive tools, that the wider commercial and hobbyist audience would adopt it.
I've heard numbers like 15k per seat to properly get started with Ada commercially.
CharacterMaster8957@reddit
Ahhh I see. That makes sense. I'm going to have to eventually learn Rust. I'm mostly c++, and am new to ada.
And yes blame Adam for everything 😂
kinda_guilty@reddit
I love Rust, but this is a lie. Add a couple of lifetime annotations and my head starts spinning.
MadCervantes@reddit
I don't write any rust, and as I understand it has a lot of great features, but it's syntax looks pretty ugly to me. Then again most programming syntax looks ugly to me other than like quroum and Lua.
Slow-Rip-4732@reddit
That tracks
phil_gal@reddit
Go peeps be like: if err != nil go brrrr
Gm24513@reddit
I can damn sure read more code than I can write.
CharacterMaster8957@reddit
Not in ada, it's the opposite
steve-7890@reddit
Famous:
l8s9@reddit
Specially when so many ways of architecture or no architecture!
Comprehensive-Pea812@reddit
because you have all the context when you write it but not when you read it.
andrybak@reddit
If you can, write down the context in the commit messages. The best thing to write down is the answer to the most common question when reading code. This question is always "why?"
dcbst@reddit
The Ada programming language was specifically designed to be more readable than writable because code is read more than it's written.
Then developers reject Ada because it's too verbose! Many developers are only interested in today's problem of wetting the code, readability and maintainability are tomorrow's problem!
apnorton@reddit
Don't forget good ol' Kernighan's Law:
Now we're entering a wondrous time where developers are producing code that they, themselves, are incapable of understanding (and somehow people think this is fine)... which of course raises the question --- what hope do they have of debugging it?
ketosoy@reddit
Let’s just hope that an AI that is 2x as smart comes along to debug it
Mortomes@reddit
Keep the faith, brother.
hamilkwarg@reddit
Don’t worry, every year AI will get better at refactoring their own vibe code. It will be some new law.
i-Blondie@reddit
Hey man, stop killing the vibe code /s
It’s gonna be fun, and by fun I mean torture.
ChodeCookies@reddit
Pretty soon there won’t be a single part of a business that is able to fully operate without software engineering support. The opposite of what we are constantly being told
guesting@reddit
if you look at freelance sites, there's a ton of open projects to 'finish' vibe coded apps that were one shot failures on replit, lovable etc.
elperroborrachotoo@reddit
You just drop the code into an AI or three and ask them what it does. Just get with the vibe!
trippypantsforlife@reddit
at least its fun for the torturers!
spacechimp@reddit
It seems that I’ll have job security for the rest of my career, but I don’t want the last years of that career to be spent focused on fixing slop (whether computer generated or otherwise).
ecafyelims@reddit
If this were true, then it would be half as much effort to write new replacement code rather than debug the existing code.
Which extends further to those who produce code they can't write nor debug -- they can just continue to produce code without ever debugging.
According to Kernighan's Law, it's half as difficult that way.
Guvante@reddit
We have always had a hard time tracking tech debt, we just decided to rapidly increase it.
Coherent_Paradox@reddit
Just let the LLM debug it
/S
gc3@reddit
Actually, I did this for a bug in JavaScript so I wouldn't have to read the long function. 'Why does this function return undefined' and it hit it right
The_Northern_Light@reddit
Great, now you only have all the other bugs you don’t know about left!
gc3@reddit
Yeah well that was in someone else's six year old code.....
EliSka93@reddit
Unironically, that's their plan.
Crafty_Independence@reddit
A lot of managers don't think debugging is needed because they assume all code should be bug-free
CherryLongjump1989@reddit
This "law" is just an anti-intellectual quip for talentless hacks.
apnorton@reddit
ngl bud, calling Brian Kernighan a talentless hack is more reflective of you than of him or the quote.
CherryLongjump1989@reddit
Is that an argument from authority? Just because the old man is famous doesn't mean that I should take as the word of god every utterance he ever made that's been taken out of context and laundered into an adage by some wiseguy handing out advice by the watercooler.
ub3rh4x0rz@reddit
You dismiss an argument based on ad hominem ("hacks repeat this, so it's invalid"), then call the rejection of your premise an argument from authority? Lol, not helping your case bud
CherryLongjump1989@reddit
An ad-hominem is not an argument. It can be dismissed out of hand.
apnorton@reddit
Soooo you're saying we can dismiss your original comment out-of-hand because it was an ad hominem? Cool.
Soooo a genetic fallacy (the generalization of an argument by authority)? Cool.
CherryLongjump1989@reddit
I never made an argument. I made a statement. Defending that statement would be what requires an argument.
gc3@reddit
No, Cursor can debug it! /s
newhunter18@reddit
This is idiotic.
Which programming exam is harder, a multiple choice or a free response?
RiverRoll@reddit
I really think the people who say that don't write very good code. Creating good abstractions is very hard to do.
liquidpele@reddit
lmao this is the stuff people say who have never tried to read their own code 3 years later. “Who wrote this crap?? ….oh”
RiverRoll@reddit
I feel this speaks more in favour of my point that against it.
papertowelroll17@reddit
Yea I'm with you. What should be said is that "code is read many times and written only once". That part is true and the reason why readability is more important. "Harder to read than write" is just not true.
ub3rh4x0rz@reddit
I think there is more to it than that. Also witticisms are often memorable because of their apparent contradictions. If you just read things at a surface level, you're missing the point.
"Reading code is harder than writing code" can be taken as "writing code that not only works but is comprehensible to the reader is difficult and important" and "reading code so you understand it well enough to modify it in an efficient and safe manner is harder than rewriting or clumsily extending it with limited understanding, but yields better results"
imscaredalot@reddit
Pretty much rust
strawboard@reddit
Yea maybe before AI, in 2000 when this was written, but now it is far far easier/faster/better to tell AI what to do and read the results.
Timbit42@reddit
This is why I prefer somewhat verbose languages like Pascal, Modula-2, Oberon, Ada, etc. C and C++ are too terse to read easily. I say somewhat because COBOL and Java are too verbose.
OlivierTwist@reddit
These are 2 very different cases. With C the syntax is relatively simple and any difficulty (if any) is connected to a style and name convenient.
While C++ is a totally different story. With operator overloading and such one can never be sure what will be the outcome of an innocent expression like a = b;
The_Northern_Light@reddit
C++’s operating overloading is clearly bad,
Python’s dunder methods are clearly good,
And who can tell with JavaScript’s prototypes?
Timbit42@reddit
While C syntax is very simple, it's chock full of symbols and not easy to read relative to the Wirthian languages.
reddituser567853@reddit
I think I agreed with this more in my formative years, but reading a new codebase is a skill, a skill that you can improve on.
I can certainly get up to speed on a 100k+ codebase faster than I could write one, so I’m not sure what specific definition this idiom is supposed to be true in
riksterinto@reddit
Write the code without AI then tell us what you think is harder.
ummaycoc@reddit
It’s a form of communication, and we have awards for good writing. Globally recognized awards.
The award for reading well is advancing to the next grade. That’s it.
DakuShinobi@reddit
No... Shit?
dreasgrech@reddit
God I hate people like this. Had coworkers who always relied with "no shit" or "yea isn't that obvious?" or some similar nonsense whenever you talked to them about interesting stuff. What's the point of your comment? You already know everything, we get it.
DakuShinobi@reddit
I don't know shit, but it takes less than a day learning code to realize this so I was being funny. Two words got you this worked up?
dreasgrech@reddit
I don't see how being snarky is of benefit to anyone.
DakuShinobi@reddit
I don't see how your comment was a benefit to anyone either. Make hella assumptions about a person, good way to operate.
dreasgrech@reddit
Understood, you're right. Many apologies.
mfi12@reddit
And we are letting AI write code that we need to debug in the future.
EliSka93@reddit
Nonono, some Nepo baby is letting AI write code that we have to debug after they've sold their spaghetti code startup for millions to like, softbank or some other idiot.
elperroborrachotoo@reddit
Maaaan, long time not seen that face!
bratislava@reddit
And I was good with that…
Full-Spectral@reddit
And of course it's hard to write code that's easy to read than to either read or write it.
stevevdvkpe@reddit
“I’m one of the few people you’ll meet who’ve written more books than I’ve read.” –Garth Marenghi
Dry-Anteater-8083@reddit
Was just thinking about this a day before Training myself on complex pointer (*) structures, I could visualize myself writing it fast, but then outside visualization I found it difficult to read it
DarthCaine@reddit
https://imgflip.com/i/9z0h5p