I'm kind of getting sick of lambda functions. It's starting to feel like the "look at how witty my code is!" bs from back in the day. Half the time it looks like folks are shoe horning them in just to brag about using one.
I had to diagnose and fix a regex on a call today, in real time in front of other developers. Fortunately it was a very simple one. Most of the time I've had to do it, it's taken many, many hours of fiddling about in testers.
The early days of the Internet were rife with contests to write the most obfuscated Perl possible. https://perl.plover.com/obfuscated/ it was glorious.
Higher level functions can go to hell. Why I gotta google your gibberish? Just use standard operators like everyone else. It all runs the same in the end. Tertiary operators are fine, I’m talking about your fancy linq one liners. Human readable code is how you work in a group. Being able to scan with eyeballs and catch up with your end goal is how we collaborate, don’t be the guy refactoring all the existing stuff into higher level anonymous functions.
Eh LINQ is just another tool and is readble when you get used to the syntax. If you can read SQL, you can read LINQ. This has "old man yells at cloud" vibes to me.
If the LINQ statement gets too overly complicated, maybe it needs to be encpsulated in a method so the method name makes it very clear what the intention is, or if nothing else, then the varaibles used within the statement (and the one that the result gets assigned to) should be descriptive enough for another programmer to follow.
It’s not that linq is not readable. It’s that someone replaces 15 lines of very readable code with some multi Boolean linq one liner that’s impossible to quickly run through in your head. The compiler converts that linq mess into simple jump if not equal anyway so it’s just not good teamwork to try to be fancy pants in the codebase. I almost think these kids are feeding 15 lines into ChatGPT and asking it to make it a one liner
I know when I was first learning LINQ, I would write the code using my normal set of nested foreach loops and then let VS transform it into LINQ. It could be they are just doing that as well.
I have been programming in Perl for almost 25 years, it’s a beautiful language. Unfortunately it was the php of its day; lots of idiots who didn’t know crap wrote incomprehensible garbage in it. Good luck maintaining garbage.
Yeah, well, I'm one such idiot and I disagree with the "there's more than one way to do it" moto of Perl. It means several programmers writing the same code will do it in completely different ways, and they won't understand each other. I'll stick to C where there's only one way to do it.
I always write my code as if an idiot who has no idea what the code does will have to maintain it a few months later. That is often the case, too. The idiot is myself.
welcome to the club. i have written z80 and 68000 assambler code in the 90 and you cannot believe how much days or even weeks i have wasted to find bugs, because i had to understand my own code.
I don't even understand the regex I write. I love regex for what it can do but damn... coming back a year later and seeing an 80 character regex string I wrote fills me with a certain unique dread.
Most regex implementations support comments. If it's not clear break it out to multiple lines and add comments. Though, if it's long enough it isn't clear at a glance then you should reconsider the problem and write some extra code and/or break down the data differently instead of a complicated regex. Also including pattern examples of what does/doesn't match makes it easy to understand the intention of the regex, but again if you need that you should consider alternatives and why not those.
Great programmers write code who programmers can understand who read it years later, alone and who then can deduce from the little they read how the rest will be setup. And then there is Chat GPT.. it writes okay looking code, and has no idea what its doing, just likelihoods. Its a potemkin village that compiles..
I asked chatgpt to write me a simple python script to sift through files on q drive. Nothing fancy. It did. And the thing was slow. I tweaked the code best i could. But got sick of the slowness. Loaded the python back to chatgpt and asked if there was any way to optimize it. It said "sure! First, this os.walk func is slow. You should try using scandir. Wanna try it?" Mfer, you wrote this code! The scandir rewrite ran in seconds vs hours. Ugh
I spent my 35 years as a programmer trying to convince my colleagues to write maintainable code - you can't get promoted out of a position if you have made yourself irreplaceable.
I've recently been taking the approach that if they don't make their code maintainable, then the code gets replaced. It's not like they're writing new code as their jobs are a cottage industry of maintenance.
Too many cos today are still running very old programs. They put off replacements for years due to cost$...which wb SKY HIGH NOW!!!! Million$ & Million$!! And cause major far-reaching upheaval. It's not a good situation..... It's right up there w failed grids & massive power outages but will take years, not days, for recovery.
35 years? How are you avoiding the burnout? I've spent a decade less than you and I feel like retiring, especially with the whole GenAI craze these days. As a user, I've been bummed out by general enshittification of software, but as a programmer I know it's going to be a million times worse when the majority of code is written and maintained by LLMs. And that's not an "if", it's a "when", because every fucking CTO out there is drooling at the prospect of not having to pay programmers.
I burnt out. The last bit of code I wrote was written in 4 months - budgeted for 2 years. 18-hour days when your in your 50s are not advisable. The code was fucking incredible - the use of Meta Data etc. Having trained the DBA myself, 20 years earlier, gave me an advantage.
Why? - It was 10 years ago. I look back on my career with pride...to do all that, raise a well balanced Daughter with Down Syndrome; a Son, currently doing his Masters in Neuroscience, and living in a foreign, humourless country. One hell of a ride. :)
I wish I could be that optimistic, but the core principle behind the constant enshittification is that it doesn't matter if it's worse, as long as you can get away with it. So what I predict will happen is that they'll keep trying until "fucking up ever so worse" becomes "still fucking up but getting away with it". We love to think that the industry has matured and we're making solid decisions. For anyone who still believes that, I recommend reading "The Leprechauns of Software Engineering".
What I meant, in turn, is that they have caused catastrophic damage, so at the moment they are not quite getting away with it. A few instances have even made headlines.
This seems to me like it's a very common and recurring pattern atleast with consultants. The amount of hyper abstracted overengineered unmaintainable fucking piece of shit code I've seen over the years sometimes makes me want to gouge my eyes out
Oh you definitely can. They'll limp on using the same solution for as long as possible, then pay 3x as much to get new software made, or to license someone else's.
I've read plenty of stories about a company destroying itself or costing itself a ton of money because of cost cutting the person that maintained their code.
I once had to learn FORTRAN to decipher a PhD's old fatigue calculations. That was certainly an experience, deciphering someone else's uncommented code in a new language and getting it to compile.
It was pretty easy, honestly. Once you understand how to structure code generally, most languages are just syntax (generally, obviously higher order coding can get complicated). And if you can program in Assembly, anything else is cake (or at least won't make you cry as much).
sadurdaynight
I'm kind of getting sick of lambda functions. It's starting to feel like the "look at how witty my code is!" bs from back in the day. Half the time it looks like folks are shoe horning them in just to brag about using one.
tirpider
I did a code once. I fully respect folks that can stick to a coding standard and still finish projects without becoming a criminal.
subtletomato
cousteau
Hey, what's wrong with write-only code?
cousteau
Fun fact: that regex matches both "Hey, what's wrong with write-only code" and "Hey, what's wrong with write-only cod".
dashers
I had to diagnose and fix a regex on a call today, in real time in front of other developers. Fortunately it was a very simple one. Most of the time I've had to do it, it's taken many, many hours of fiddling about in testers.
cousteau
Fixing a regex is easy. Step 1: delete it and rewrite it from scratch…
Frenchgeek
I manage to write code neither me, or my computer, understand.
PballQhead
Mel Kaye would disagree, and he was the Realest Programmer ever.
http://www.catb.org/jargon/html/story-of-mel.html
turbodog
77 MY-COMMENT PIC X(80) VALUE "GRACE HOPPER WAS RIGHT".
pt2016
RPG II entering the chat. Tried to dechipher a small program about 100 lines of code. I still have nightmares about it.
florpglorp
My poems are for computers
bearstrap
OK, you know what? This is beautiful and I want to hate it but I can't.
ChickenChickenBurningBright
The early days of the Internet were rife with contests to write the most obfuscated Perl possible. https://perl.plover.com/obfuscated/ it was glorious.
adrianenspired
...and great programmers write code that computers and humans understand _to mean the same thing_.
LoftheDesert
I wrote code that I myself didn't understand, and that's why it didn't work either, and that's why I dropped out of my c# course.
RatsLiveOnNoEvilStar
Past me is an idiot programmer and future me doesn't understand my genius.
Ankylosaur
McTaco
Higher level functions can go to hell. Why I gotta google your gibberish? Just use standard operators like everyone else. It all runs the same in the end. Tertiary operators are fine, I’m talking about your fancy linq one liners.
Human readable code is how you work in a group. Being able to scan with eyeballs and catch up with your end goal is how we collaborate, don’t be the guy refactoring all the existing stuff into higher level anonymous functions.
RatsLiveOnNoEvilStar
Eh LINQ is just another tool and is readble when you get used to the syntax. If you can read SQL, you can read LINQ. This has "old man yells at cloud" vibes to me.
If the LINQ statement gets too overly complicated, maybe it needs to be encpsulated in a method so the method name makes it very clear what the intention is, or if nothing else, then the varaibles used within the statement (and the one that the result gets assigned to) should be descriptive enough for another programmer to follow.
McTaco
It’s not that linq is not readable. It’s that someone replaces 15 lines of very readable code with some multi Boolean linq one liner that’s impossible to quickly run through in your head. The compiler converts that linq mess into simple jump if not equal anyway so it’s just not good teamwork to try to be fancy pants in the codebase.
I almost think these kids are feeding 15 lines into ChatGPT and asking it to make it a one liner
RatsLiveOnNoEvilStar
I know when I was first learning LINQ, I would write the code using my normal set of nested foreach loops and then let VS transform it into LINQ. It could be they are just doing that as well.
dashers
Agreed. I've written some pretty slick one liners and after swimming in dopamine, taken them apart to make them readable.
cousteau
I like it when regular expressions have . also match newlines. /s
versusentropy
Perl enters the chat
cousteau
Perl uses, like, a lot of regexes. They're an important part of the language. They're besties.
jesuisgur
I programmed in Perl for a year. After 2 weeks I couldn't understand my code, even fully documented. Decided to give up after a year.
malakit
I have been programming in Perl for almost 25 years, it’s a beautiful language. Unfortunately it was the php of its day; lots of idiots who didn’t know crap wrote incomprehensible garbage in it. Good luck maintaining garbage.
jesuisgur
Yeah, well, I'm one such idiot and I disagree with the "there's more than one way to do it" moto of Perl. It means several programmers writing the same code will do it in completely different ways, and they won't understand each other. I'll stick to C where there's only one way to do it.
donorkort
Perl isn't so bad. Now, Lisp on the other hand...
UncleMeaty
So many fucking brackets.
SMarkt
always write your code as if the guy who has to maintain it is a psycho, who knows where you live.
cousteau
I always write my code as if an idiot who has no idea what the code does will have to maintain it a few months later. That is often the case, too. The idiot is myself.
SMarkt
welcome to the club. i have written z80 and 68000 assambler code in the 90 and you cannot believe how much days or even weeks i have wasted to find bugs, because i had to understand my own code.
WhatDarkLactomancyIsThis
I don't even understand the regex I write. I love regex for what it can do but damn... coming back a year later and seeing an 80 character regex string I wrote fills me with a certain unique dread.
kirby422
Pff, while writing any complex regex, I have no clue if it catches too much input, just that it catches one positive and negative test case
GiantFlyingLabia
I love regex. It’s so much fun.
No I’m not kidding.
hwatL4bloopy
The puzzle is fun
RevengeIsIceCream
Sometimes when one has a problem one decides to use regex to solve it. Now one has two problems.
HzZbVYAx77aoiuN9Zy
yea and some languages are slightly different with it. The regex websites that break it all down are very helpful
WellAckchually
I have never written regex without using regex101.com
jamsajam
Most regex implementations support comments. If it's not clear break it out to multiple lines and add comments. Though, if it's long enough it isn't clear at a glance then you should reconsider the problem and write some extra code and/or break down the data differently instead of a complicated regex. Also including pattern examples of what does/doesn't match makes it easy to understand the intention of the regex, but again if you need that you should consider alternatives and why not those.
WhatDarkLactomancyIsThis
Good point, I'll try comments and line breaks!
xlr82xs
As an added feature, pcre comments look like groups and confuse juniors no end.
PicassoCT
Great programmers write code who programmers can understand who read it years later, alone and who then can deduce from the little they read how the rest will be setup. And then there is Chat GPT.. it writes okay looking code, and has no idea what its doing, just likelihoods. Its a potemkin village that compiles..
sadurdaynight
I asked chatgpt to write me a simple python script to sift through files on q drive. Nothing fancy. It did. And the thing was slow. I tweaked the code best i could. But got sick of the slowness. Loaded the python back to chatgpt and asked if there was any way to optimize it. It said "sure! First, this os.walk func is slow. You should try using scandir. Wanna try it?" Mfer, you wrote this code! The scandir rewrite ran in seconds vs hours. Ugh
Vicaggeaki
Brilliant programmers create programs that enable computers to comprehend people.
SwissScars
I spent my 35 years as a programmer trying to convince my colleagues to write maintainable code - you can't get promoted out of a position if you have made yourself irreplaceable.
dashers
I've recently been taking the approach that if they don't make their code maintainable, then the code gets replaced. It's not like they're writing new code as their jobs are a cottage industry of maintenance.
phssthpok
Bet?
Safflower777
Too many cos today are still running very old programs. They put off replacements for years due to cost$...which wb SKY HIGH NOW!!!! Million$ & Million$!! And cause major far-reaching upheaval. It's not a good situation..... It's right up there w failed grids & massive power outages but will take years, not days, for recovery.
WoeToHice
35 years? How are you avoiding the burnout? I've spent a decade less than you and I feel like retiring, especially with the whole GenAI craze these days. As a user, I've been bummed out by general enshittification of software, but as a programmer I know it's going to be a million times worse when the majority of code is written and maintained by LLMs. And that's not an "if", it's a "when", because every fucking CTO out there is drooling at the prospect of not having to pay programmers.
SwissScars
I burnt out. The last bit of code I wrote was written in 4 months - budgeted for 2 years. 18-hour days when your in your 50s are not advisable. The code was fucking incredible - the use of Meta Data etc. Having trained the DBA myself, 20 years earlier, gave me an advantage.
WoeToHice
Sorry to hear that :(
SwissScars
Why? - It was 10 years ago. I look back on my career with pride...to do all that, raise a well balanced Daughter with Down Syndrome; a Son, currently doing his Masters in Neuroscience, and living in a foreign, humourless country. One hell of a ride. :)
WoeToHice
I misunderstood. I didn't realize you meant you burnt out and the recovered later. That's great to hear :)
RaspK
Don't be so sure: people keep trying to make it work, but they have been fucking up ever so worse, it seems.
WoeToHice
I wish I could be that optimistic, but the core principle behind the constant enshittification is that it doesn't matter if it's worse, as long as you can get away with it. So what I predict will happen is that they'll keep trying until "fucking up ever so worse" becomes "still fucking up but getting away with it". We love to think that the industry has matured and we're making solid decisions. For anyone who still believes that, I recommend reading "The Leprechauns of Software Engineering".
RaspK
What I meant, in turn, is that they have caused catastrophic damage, so at the moment they are not quite getting away with it. A few instances have even made headlines.
RaspK
https://www.jpmorgan.com/technology/technology-blog/open-letter-to-our-suppliers
idonthaveauser
You can't get fired either.
ThrowAwayAcct0000
You most certainly can!
jamsajam
Business' are extremely irrational from a reasonable human perspective. Never count on them do to the "sane" thing.
usingYourMomAsAHat
This seems to me like it's a very common and recurring pattern atleast with consultants. The amount of hyper abstracted overengineered unmaintainable fucking piece of shit code I've seen over the years sometimes makes me want to gouge my eyes out
Rivalyn
Oh you definitely can. They'll limp on using the same solution for as long as possible, then pay 3x as much to get new software made, or to license someone else's.
Jarjarthejedi
sauvrel
"Hold my beer"
fiveforty
Tell that to DOGE 🤣
BlueDsc
I've read plenty of stories about a company destroying itself or costing itself a ton of money because of cost cutting the person that maintained their code.
cosinewave
Have you ever seen Perl?
igglebotato
line noise that (maybe) does something
pm1001
Hah, kids stuff APL enters the chat
RatsLiveOnNoEvilStar
What about Brainfuck?
pm1001
Apl is a real language used in production......
WoeToHice
Where do we draw the line? Because Brainfuck is crossing over into "esoteric toy language" territory, like Malbolge.
RatsLiveOnNoEvilStar
Agreed, no one has seriously tried using BF in production code.
idonthaveauser
Perl has the most readable code, very close to plain English and also the option to be the most unreadable, if you want.
idonthaveauser
Also regex is a native part of perl, unlike languages where you have to specify to treat the next part as regex.
YouAreCorrect
This is why I always nag developers to add comments for every regex they write
cousteau
/x
RatsLiveOnNoEvilStar
I agree, but hopefully the reg ex pattern is saved to a well named variable at least.
GiantFlyingLabia
regex101.com
YouAreCorrect
yes!!!!!!
Manse84
I once had to learn FORTRAN to decipher a PhD's old fatigue calculations. That was certainly an experience, deciphering someone else's uncommented code in a new language and getting it to compile.
Micro2112
First interview out of college.. "almost forgot, how are you with Fortran?". " You mean like from the 70s? Not great .. " " we'll teach you"
xizar
fun fact, there's a FORTRAN 90, 95, 2000.
Micro2112
I did use some F90!
xizar
When I was doing my MS in math back around the turn of the millennium, my prof made us use f77, even though f90 was out.
Manse84
It was pretty easy, honestly. Once you understand how to structure code generally, most languages are just syntax (generally, obviously higher order coding can get complicated). And if you can program in Assembly, anything else is cake (or at least won't make you cry as much).
Micro2112
Exactly. Knowing HOW to code is important. Learning a new language to code is generally easier
RevengeIsIceCream
Mostly the trick is to learn all the standard libs (both built in and de facto standard) and learn to avoid specific pit falls/use specific patterns.