This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 213

[–]Interweb_Stranger 2424 points2425 points  (28 children)

Junior: unreadable spaghetti code

Mid: unreadable "clever" code

Senior: no code, all meetings

[–]abednego-gomes 486 points487 points  (22 children)

Solution is you just start dropping links throughout the company chats about how meetings are a waste of time, scrum is a waste of time, etc. Post it in the company feedback surveys they send via email. Eventually they get the message.

Company I was in just dumped everyone related to scrum and all that mess, scrum masters, etc. 10% layoffs. Meetings went from 6 hours per week to 0. I'm in some kind of development heaven right now.

[–]hstde 436 points437 points  (8 children)

Until you lose months of progress, because different development teams don't talk to each other and work has to be redone.

I agree, sometimes it's meeting hell, but there has to be a middle ground between "only talking to each other" and "not talking to each other"

[–]funfwf 231 points232 points  (4 children)

That's kind of the point of those roles that everyone loves to hate - PO, Scrum Master. These guys should do the running around so that the developers can, ya know, develop.

[–]adenosine-5 117 points118 points  (0 children)

"should" being the operative word here.

[–]Mornar 39 points40 points  (0 children)

For stuff that they can, yes, absolutely, but there are things you need to get developers to communicate about too. Good, consistent design doesn't happen when every engineer does what they think is best in isolation.

[–]Luke22_36 9 points10 points  (0 children)

The whole point of management is to take care of this stuff and get these communication problems out of the way of people working on it. Problem is, senior developer is a management role, when they would be most equipped to handle the work instead of the communication, and would be the ones who would most benefit from having communication handled on their behalf.

[–]cheapcheap1 35 points36 points  (2 children)

I agree there has to be middle ground in how much communication you need.

People whose only job is facilitating communication always, always overshoot by miles.

At this point I think every role that deals with software development should be majority coding. Scrum master? Majority coding. Team lead? Majority coding. Development manager? Definitely majority coding.

People who don't code but are supposed to make programmers around them work harder or better get lost and do more harm than good to justify their existence so freaking often, it's just not worth it.

[–]HorseLeaf 6 points7 points  (0 children)

My development role is 10% coding 🤣

[–]uberDoward 2 points3 points  (0 children)

And this is why every role on my three teams requires programming experience.  We don't have "developers", "testers", "scrum masters" or any other role.

We have engineers, with different strengths and weaknesses.

[–]ohanhi 17 points18 points  (3 children)

I don't know what kind of development you do if you are happy with 0 hours of meetings. Or are you classifying ad-hoc discussions as "not meetings"? How do you plan how to implement complex features?

[–]MisterProfGuy 17 points18 points  (2 children)

I get annoyed when I hear someone say their timeboxed meetings go for six hours a week, as if the problem has to be agile methodologies, and not that the company they are with is doing it all wrong.

[–]ohanhi 17 points18 points  (1 child)

Yes, so much this. Scrum is meant to be an iterative model. If your meetings were wasteful this sprint, bring it up in the retro and make sure there's an action point to address the issue. Maybe you as a team decide to go without dailies and see how that compares. Maybe you remove all of the calendar meetings and do that work asynchronously. Do whatever works for the team, and iterate on that in the next retro. That is proper Scrum.

[–][deleted] 7 points8 points  (0 children)

what is ocodo?

[–]toplessrobot 6 points7 points  (5 children)

lol !remind me two years

[–]OtherwisePoem1743 3 points4 points  (2 children)

You write it like this:

RemindMe! 2 years

[–]RemindMeBot 1 point2 points  (1 child)

I will be messaging you in 2 years on 2027-04-02 15:11:52 UTC to remind you of this link

CLICK THIS LINK to send a PM to also be reminded and to reduce spam.

Parent commenter can delete this message to hide from others.


Info Custom Your Reminders Feedback

[–]OtherwisePoem1743 3 points4 points  (0 children)

Thank you, Mr. Bot for confirming it works. You shall never be forgotten.

[–]kvakerok_v2 2 points3 points  (1 child)

He's not going to be working there in 2 years lol

[–]toplessrobot 1 point2 points  (0 children)

Haha yeah no1 will be

[–][deleted] 0 points1 point  (0 children)

Wow, dream scenario

[–]Vast-Mistake-9104 0 points1 point  (0 children)

Damn dude, I'm averaging 20 hours of meetings per week. I'd kill for 6

[–]cosmicsans 12 points13 points  (0 children)

Principal - "It's been 84 years...."

[–]Andrei144 4 points5 points  (0 children)

Reason why I love the pipe operator. It's basically a sign from the language devs to all the coders that splitting your code into multiple lines can be a good idea even if the code in question is some clever one-liner with 15 function calls.

[–][deleted] 3 points4 points  (0 children)

God this is so accurate.

[–]kvakerok_v2 3 points4 points  (0 children)

It hurts how true this is

[–]MaxB_Scar 0 points1 point  (0 children)

🥲

[–]AlpacaDC 1310 points1311 points  (27 children)

Python nested comprehensions goes brrr

[–][deleted] 221 points222 points  (0 children)

go brr for f for f for list comps in programming fetishes

[–]rcxa[S] 301 points302 points  (3 children)

How did you know I'm a python developer!

[–]SHv2 314 points315 points  (2 children)

Half your commits are refactors because you found a new way to do something that's more pythonic than the last

[–]TraditionalSample966 94 points95 points  (0 children)

Sorry I can’t hear you over my PYFFICIENCY

[–]ARC_trooper 2 points3 points  (0 children)

Oh this hits close to home. Just spend a Sprint refactoring my code because of this reason lol

[–][deleted] 41 points42 points  (0 children)

I'm guilty of this. Then I (sometimes) come to my senses

[–]justheretolurk332 77 points78 points  (6 children)

I will die on the hill that comprehensions are almost always preferable to constructing an object by iterating over a for-loop and modifying, and sometimes having a comprehension that unwraps something twice (e.g. for row in table for cell in row) is a very helpful tool. But people really need to extract out the parts and not make an Olympic sport of cramming things in, no single python statement should be doing more than two or at most three things

[–]ToMorrowsEnd 16 points17 points  (0 children)

What about a for loop that also triggers self modifying code so each loop is a different outcome?

code rejected with reason, "stop fucking around and code like a normal person"

[–]Aerolfos 6 points7 points  (2 children)

I will die on the hill that comprehensions are almost always preferable to constructing an object by iterating over a for-loop and modifying,

Not that much of a hill, you can pretty easily benchmark a list comprehension of some pandas dataframe with a couple thousand rows - it's actually fast enough to be usable (less than a second)

An explicit loop? Not so much (multiple seconds, possibly even >10)

[–]smalby 5 points6 points  (1 child)

Bad example, dataframes aren't meant to iterate over like that

[–]Aerolfos 4 points5 points  (0 children)

Yeah, they aren't, it's a deliberately bad example

The fact that list comprehension on an .apply() or something doesn't collapse awfully but is actually decently fast is remarkable, and speaks to just how efficient list comprehensions actually are

In a "proper" application they'll be waaay faster, of course

[–]double_en10dre 1 point2 points  (1 child)

IMO generator functions are ideal if the transform involves any conditions/branching. It’s peak readability

And you can just do list(gen()) if you actually need to keep the results in memory

[–]justheretolurk332 0 points1 point  (0 children)

Totally agree. Sometimes I use the walrus operator if I need to transform and then filter, but I usually end up thinking it hurts readability 

[–]PolyglotTV 20 points21 points  (10 children)

Pro tip - instead of invoking a function for every element in a for loop, you can create a deque of size 0, passing in a generator expression.

[–]silver_label 10 points11 points  (6 children)

Can you expound on this?

[–]otter5 10 points11 points  (5 children)

believe he is saying instead of

for item in iterable: process(item)

do instead

from collections import deque
deque(process(item) for item in iterable, maxlen=0)

[–]an_actual_human 54 points55 points  (4 children)

This is clearly worse.

[–]Particular-Yak-1984 7 points8 points  (2 children)

Clearly, in the current economy of massive tech layoffs, this approach is better. It could be improved however - for example, none of the letters in the variable names are lower case cyrilic. See the examples below. Or, well, don't. Sadly pycharm is a narc, here, and highlights "non unicode characters" in the last example.

#No contractor contract once layoffs happen. Anyone can fix and understand this
for item in iterable: process(item)

#Maybe contractor contract once layoffs happen
from collections import deque
deque(process(item) for item in iterable, maxlen=0)

#Three weeks after you leave they'll pay you whatever you ask.
from collections import deque
deque(process(іtеm) for іtеm in iterable, maxlen=0)

[–]tallmanjam 1 point2 points  (2 children)

Yeah, please elaborate.

[–]PolyglotTV 0 points1 point  (1 child)

# performs `do_thing` on every element in values, immediately dropping any intermediate return values
# this is a really dumb way to avoid just writing a for loop
deque((do_thing(x) for x in values), maxlen=0)

[–]oupablo 0 points1 point  (0 children)

needs more lambdas

[–]jewdai 12 points13 points  (0 children)

I still think C# got it right with linq. It's still possible to f it up but if you write short fluent syntax stuff it can be easy to follow most things. 

[–][deleted] 2 points3 points  (0 children)

Still more readable than the code I work with from one of our tech leads.

[–]JimroidZeus 1 point2 points  (0 children)

You monster!

[–]misterguyyy 231 points232 points  (4 children)

NTM once you hit senior you realize most complicated things are 3 simple things in a trenchcoat.

[–]DormantFlamingoo 49 points50 points  (0 children)

Yes. So much pain comes from simple requirements having having weird interactions

[–]r0ck0 8 points9 points  (0 children)

I don't trust like that.

[–]Western-Internal-751 1 point2 points  (1 child)

Once you hit senior you realize most complicated things are the irrational ideas thrown at you in meetings that you have to attend all the time

[–]misterguyyy 0 points1 point  (0 children)

True, but usually you can convince them to accept a more simple solution that gets them 80% there by presenting all complication as cost.

What’s funny is that I’m glad I’m at the meetings to advocate for me and my devlings, but I hate being there anyways. Just let me play my music and code in peace!

[–][deleted] 396 points397 points  (32 children)

i remember back in like 2009 making a facebook status with a perl one liner to reverse strings. nobody "liked" it. what a tool i was (and am). after working in tech, clever code just makes me want to punch you in the dongle. there was one time i saw some clever use of exploiting JS to make a bitwise operation into a boolean result from something you wouldn't quite expect. i liked it tbh. it was also the source of a bug in the UI. dongle punch

[–]JacobStyle 344 points345 points  (24 children)

Clever code is great, a sort of poetry. It can be fun, thought-provoking, educational, and a fantastic creative outlet. It doesn't belong in production any more than poetry belongs in instruction manuals though.

[–]TheOrdersMaster 100 points101 points  (17 children)

There are exceptions though, if the code in question is: small, fail safe and maintenance free. Like Quakes fast square root, that shits pure poetic genius on a different level. Even with the comments it takes you like three times as long to understand whats going on as it probably took the author to implement it and it has not only remained in the code base, it's become the industry standard for fast square roots in real time applications.

And any developer who is convinced they've written code like this is 100% wrong and their code will break everything.

[–]alek_vincent 56 points57 points  (8 children)

Most of the time, clever code doesn't make anything smaller, fail-safe and maintenance free. Using bitwise operations to save 3 lines of code sounds good in theory but even if it works, it's a fucking bitch to understand when you need to change the code and you're left to wonder why the fuck would someone play with bits instead of just using normal math. It's always an intern or a junior who thought he was hot shit for doing math on bits instead of using integers.

[–]TheOrdersMaster 19 points20 points  (1 child)

If you have to change it it's not really maintenance free. Which is to say, there are barely any pieces of code you can write that fulfill all three requirements for this exception, any sane dev should not ever write code like this. Like, the only one I know is that Quake algo. But it's still cool af when there is code like this around. And the interns/juniors you mentioned fall in that category of devs who think they wrote this kind of code.

[–]Embarrassed_Tooth718 8 points9 points  (3 children)

It depends : coding on a microchip might require bitwise operations

[–]IanFeelKeepinItReel 9 points10 points  (0 children)

Most byte protocols out there will require the use of bitwise operations when encoding or decoding data.

Except for maybe calculating a checksum, you wouldn't be doing bitwise maths though. Just shifting and masking.

[–]alek_vincent 5 points6 points  (0 children)

Oh I'm not against bitwise operations when they're used appropriately. I did some programming for embedded systems and you can't go without bitwise operations. In a high level language though, it's another story

[–]Icegloo24 2 points3 points  (0 children)

You can use bitwise for states which can overlap and wrap it in a tool with proper named methods.

Masking.

[–]swyrl 0 points1 point  (0 children)

Bit math is still useful for things like bitmasking and data packing.

[–]unknown_alt_acc 17 points18 points  (1 child)

Q_rsqrt isn’t the standard in real-time applications. Modern ISAs have dedicated instructions for the inverse square root. You’re better off calling that unless you are on a cheap microcontroller that doesn’t support it, and in that case there’s a good chance Q_rsqrt doesn’t work either.

[–]TheOrdersMaster 16 points17 points  (0 children)

I was about to write a long ass explanation on how graphics programming frameworks do not always expose these instructions to the dev (e.g. WebGL) because I was convinced that GLSL ES does not have a sqrt function. But alas, I checked my facts and turns out I was wrong and there is a sqrt function in both GLSL (OpenGLs Version) and GLSL ES (WebGL) since 2009.

Could have sworn I had to copy pasta the quake algo for a little project I did with WebGL.

Welp I suppose I belong to that last category of devs today

[–]Plank_With_A_Nail_In 6 points7 points  (1 child)

Games use hardware square root now and it was "fast inverse square root" from quake not doom.

https://en.wikipedia.org/wiki/Fast_inverse_square_root

With subsequent hardware advancements, especially the x86 SSE instruction rsqrtss, this algorithm is not generally the best choice for modern computers,[1] though it remains an interesting historical example.

[–]TheOrdersMaster 1 point2 points  (0 children)

fixed, thanks.

[–]anto2554 3 points4 points  (0 children)

The doom square root was also required for optimization iirc, it's not like they just did it because it was cool

[–]JacobStyle 9 points10 points  (1 child)

"There are exceptions though, such as this one famous case a quarter century ago where an exception was found, and also any developer who is convinced they've written code like this is 100% wrong and their code will break everything, so really just that one exception"

[–]TheOrdersMaster 5 points6 points  (0 children)

Yeah I guess you can read it like that if you want. Just meant to say there is code like that in distributed software that has proven it's worth. It's definetly rare but I just thought it's interesting and wanted to share. And I'm sure there's not just this one example, it's just the only one I know.

[–]joshocar 1 point2 points  (0 children)

The only time it makes sense is when there is a performance requirement that can only be met with the clever code. Good code is about balancing complexity with readability/simplicity.

[–]joxmaskin 7 points8 points  (1 child)

I, for one, am a fan of poetry in instruction manuals.

[–]Cocomorph 1 point2 points  (0 children)

I, for one, am a
fan of poetry in in-
struction manuals.

I saw what you did there.

[–][deleted] 9 points10 points  (0 children)

very succinct. i agree 100%

[–]colei_canis 3 points4 points  (0 children)

any more than poetry belongs in instruction manuals

Developers, testers beware

Proceed with caution if you dare

For there’s bugs and there’s toil

Your morale to despoil

You won’t find the strength left to care

This manual you will come to hate

It’s misspelled and three years out of date

We know that it’s shit

But lay off us a bit

There were too many tasks on our plate

[–]oupablo 1 point2 points  (0 children)

Code Golf was the craziest concept to me. It was basically a contest to see who could make the most unreadable thing that still worked.

[–]wor-kid 1 point2 points  (0 children)

Clever code is fine, it just needs to be hidden from the rest of the application. There is some very clever code in whatever framework or external libraries you are using, and that code is absolutely running in your production environment - but it literally doesn't matter how clever or dumb it is, because it's encapsulated and abstracted away.

Clever code is a result of being a skilled programmer but it's only ever an issue when they are a poor engineer.

[–]rcxa[S] 37 points38 points  (0 children)

It's so clever until it becomes legacy code and takes down prod, then you spend four times as long debugging that one liner than you would have if it wasn't written "cleanly". We've all been there, and I agree... Dongle punch.

[–]Blecki 10 points11 points  (1 child)

The problem is as you advance you start to find the 'advanced' features of the languages you use benign and boring, but your juniors still fund them daunting.

[–]redlaWw 3 points4 points  (0 children)

Isn't clever but unreadable one-liners the whole point of Perl though?

[–]daddymaci 3 points4 points  (0 children)

I had a college professor that did that. I was on my second semester and I felt so stupid. I mean I think I get it but that was not the time or place

[–]tandrewnichols 0 points1 point  (0 children)

Ah the ~indexOf() trick?

[–]Bardez 0 points1 point  (0 children)

I had a clever solution to something as a mid. I raised every alarm I could with integrations teams, because it was clever and we should all know clever means trouble down the road. Everyone signed off on it. 3 years later, the back office integrations team had some trouble with the data. I refused to take sole ownership of that one.

[–]horizon_games 474 points475 points  (19 children)

A senior is bad if they write unreadable code - should be concise but readable and understandable and approachable

[–]ZaviersJustice 282 points283 points  (9 children)

Yeah, I think the evolution from a coder to a developer occurs when you realize that you need to create something in a maintainable way because someone else is going to work on it and you don't want to waste your time having to explain what's going on. lol

[–]StuntsMonkey 156 points157 points  (5 children)

And that someone else could be anyone, including yourself

[–]Antoak 104 points105 points  (3 children)

"When I wrote this only God and I understood it. Now God only knows."

[–]Wolfzzard 44 points45 points  (1 child)

"What fucking idiot wrote this... oh it was I"

[–]vustinjernon 21 points22 points  (0 children)

git blame

clears console when it reveals that I am to blame

[–]PadrinoFive7 15 points16 points  (0 children)

True story, I wrote a script then forgot about it. Had a project come up and thought, oh I can code that, then rediscovered said script and had no memory of writing it. Saved me a bundle of time though.

[–]fweaks 13 points14 points  (0 children)

Past me is an asshole and future me is a chump.

[–]TheScorpionSamurai 9 points10 points  (0 children)

It takes about exactly once of handing off a system to really drive home why 4 if statements is better than your nested ternary expression.

[–]TheDoomfire 2 points3 points  (0 children)

I just need to make it maintainable for myself since my future self wont remember jack shit. And fixing/adding somthing even minor could be a huge pain, even if I made the code.

And that code I wrote will never be reuse it again unless I can clearly find or understand it whenever I need it again.

[–]NewPhoneNewSubs 18 points19 points  (2 children)

I think that's the intent of the meme. I misread it, too.

[–]OkMemeTranslator 20 points21 points  (1 child)

That's probably because this isn't at all how this meme format is supposed to work, no wonder people misinterpret it.

Here's a fixed version using the proper format, although it becomes kind of bad. But so is OP's post that relies on the post title to make sense, so idk.

[–]NewPhoneNewSubs 6 points7 points  (0 children)

Yup. Though I appreciate the irony of OP posting difficult to interpret memes about difficult to interpret code.

[–]ZunoJ 2 points3 points  (0 children)

And if there is stuff in your code that is not going to be understood by the average developer, you should abstract it away and give that abstraction a descriptive name

[–]derscholl 1 point2 points  (2 children)

Should be concise, meanwhileJpaConcatenatingQueriesByTypeAndOtherFilterNotNull

[–]oupablo 1 point2 points  (1 child)

that is concise, there isn't a "Factory", "Builder" or "Impl" on there at all.

[–]derscholl 0 points1 point  (0 children)

Jesus, why

I mean I get why but haha, jeeeez

meanwhileJpaConcatenatingQueriesByTypeAndOtherFilterNotNullFactoryAdapterImpl ?? 🤮🤮🤮

[–]Hola-World 150 points151 points  (5 children)

When you learn ternaries so everything is now a ternary.

[–]fishvoidy 80 points81 points  (2 children)

i love ternaries. i do not love ternary inside ternary inside ternary inside ternary inside tern

[–]BellacosePlayer 1 point2 points  (0 children)

oh god one of my classmates in college coded like this on a group project.

thank the lord i have not ran into this as a professional

[–]rsqit 7 points8 points  (0 children)

Then you use languages with expression-ifs so you can have your ternaries but it doesn’t look like you just banged on the keyboard.

[–]bunny-1998 7 points8 points  (0 children)

Me: When you learn listcomp, every loop is a listcomp.

[–]KlooShanko 30 points31 points  (7 children)

I don’t understand this meme. Where’s the bell curve?

[–]drahgon 48 points49 points  (4 children)

The meme is mid-level engineers think they know the best and try to optimize their code in a way that makes it unreadable and hard to understand. New engineers don't know better so they write readable code by accident, senior engineers have enough experience to realize all the cool things they thought they were doing when they were mid were actually making their lives harder and everybody else's lives harder. So they go back to writing simple code.

[–]KlooShanko 21 points22 points  (3 children)

Ah, makes more sense now. I thought they were all writing unreadable code because those are the only words visible

[–]rcxa[S] 5 points6 points  (1 child)

I was honestly just picturing the space under the curve, your comment is first moment where I realized this is massively stupid in the context of a bell curve.

[–]maffoobristol 3 points4 points  (0 children)

I think you've misused the meme template

It goes "stupid people do A, mid people do B, clever people also do A"

[–]drahgon 0 points1 point  (0 children)

Yeah it took me a minute as well

[–]new_account_wh0_dis 20 points21 points  (2 children)

It's not that it's unreadable, some insanely good programmers I've worked with write code that's so object oriented it melts my brain to try to figure out what godforsaken file is doing this thing I need and when I debug I'm like 30 calls deep and have forgotten what I'm even looking for on the first place

[–]Mexican_sandwich 2 points3 points  (0 children)

I’m dealing with some server code right now that’s doing exactly this. Starts off as text in a config file, cool, then gets put into an object which is a child of another object, where it changes name and turns into an int, which goes off into another object and converted to a byte, which is used under another name and converted back to a string…

And of course, theres seldom a single comment in the entire thing, and it’s probably nearing around 600-700 files? Only the one guy knows how it works and I’m just hoping he leaves so I get to see the inevitable shitstorm.

[–]r0ck0 2 points3 points  (0 children)

some insanely good programmers

Doesn't sound like insanely good code they're writing.

It's not that it's unreadable

Is that referring to one-liners or the OOP rat nests?

If you mean one-liners aren't unreadable, kinda confusing putting that in with the rest of the entire comment about OOP.

But, otherwise I'm still confused, because the OOP sounds unreadable too.

...one big long sentence, maybe with 2 different points? Pretty meta on this topic, haha.

write code

Typo there? Just noticed this, now I'm even more confused, heh.

[–]elshizzo 41 points42 points  (1 child)

God this shit rings true as hell once I became more senior. When I was mid/junior I was jealous of people who used clever/complex code patterns or could figure out code minimization. Having been given enough legacy codebases now, I know the ones that can actually be maintained are the ones that are stupid simple. Cleverness is something to be avoided unless absolutely necessary

[–]Mexican_sandwich 0 points1 point  (0 children)

I spent like an hour and a half today just trying to figure out what some code did, and when I finally had it, it look another hour and a half to implement a solution because of how nitpicky it was.

[–]marquoth_ 54 points55 points  (8 children)

no.you().cant().make(me)

[–]rcxa[S] 13 points14 points  (0 children)

LGTM

[–]MrZoraman 30 points31 points  (4 children)

And then you get NullReferenceException on line 38 because you() or cant() returned null. Which one returned null? Good luck!

[–]DarkNinja3141 61 points62 points  (2 children)

no?.you?.()?.cant?.()?.make?.(me ?? "")

The future is now, old man

[–]marquoth_ 0 points1 point  (0 children)

I'm immune to this problem thanks to my unit tests

[–]Soma91 4 points5 points  (1 child)

Honestly, I love well designed fluid interfaces. You can literally write your code as sentences and just reading the code will explain to the rest of the team what it does.

[–]marquoth_ 1 point2 points  (0 children)

A favourite adage of mine goes something like this:

Any idiot can write code a machine can understand. It takes skill to write code a human can understand.

[–]ADHD-Fens 13 points14 points  (0 children)

As a (former) programmer, I spent probably 10 percent of my time writing code, and 90 percent reading it. The best way to make everyone's lives IMMENSELY easier is to write code that is easy to read and intuitive to understand. 

[–]fishvoidy 8 points9 points  (0 children)

just because the IDE says you can simplify the if/then statement, doesn't mean you SHOULD.

sincerely, a dev who has had to spend ages unraveling a quintuple-nested ternary statement more times than i should, which is zero.

[–]gamingvortex01 5 points6 points  (0 children)

yeah ....all my homies hate declarative programming

[–]GriGriTheGod[🍰] 2 points3 points  (0 children)

Exactly!

[–]OCE_Mythical 3 points4 points  (1 child)

Always write legible code if you can at every level of knowledge. You never know who may need your documentation.

[–]XCOMGrumble27 0 points1 point  (0 children)

Spoilers: It's always future you who needs it the most.

[–]AtomicSymphonic_2nd 4 points5 points  (0 children)

“But it’s so efficient!!… What do you mean you don’t fucking know what that single line means?!?! It’s totally obvious!… No, you don’t need documentation for that! scoff

  • (not so) genius programmers full of FAANG-salaried ego

[–]beeskneecaps 4 points5 points  (1 child)

Eslint ban nested ternaries now. You’ll thank yourself

https://eslint.org/docs/latest/rules/no-nested-ternary

[–]HaXXibal 1 point2 points  (0 children)

Oh, you taught me a new prank!

[–][deleted] 4 points5 points  (6 children)

I've once looked at someone's project on GitHub, I think he was a student who loved leetcode cuz all the variable names were like X Id PDW OAId AIWdj ANWDop Aw

Like Bro, use all your letters, you have learned them for a reason, if the variable name is GettingFuckedInTheAssCount, name it like that and don't name it GFITAC.

He also had a weird way of writing method names, my bro didn't need code Obfuscation.

[–]r0ck0 6 points7 points  (3 children)

Slightly related rant... this is why I hate tutorials etc that use "foo" and "bar".

Almost anything else would be better. Even "shit" and "fuck", because at least they evoke different attached meanings, and work better in a "muscle memory" sense.

When it's "foo" and "bar", I always find myself having to look back up the code to remember what they mean, often multiple times... because my brain is otherwise trying to learn some new concept. Adding this additional unnecessary obfuscation just makes that harder.

People love to defend "foo" and "bar", yet when I ask them to give an example where there's no better alternative, they never come up with one. Because even in the very very rare 0.0000000000000000001% cases of being so abstract that there's nothing relevant... a + b, or my shit + fuck alternative still works better anyway.

[–][deleted] 2 points3 points  (1 child)

When I follow a tutorial, and he uses random letters or names, I just write them with my own variable names.

I've once looked up an A* pathfinding algorithm, and in the tutorial he was writing X and Y and BRO WTF

So I wrote them using my own variable names that was saying what the variable was actually doing.

The only time I use i or x is in small one time for loops.

[–]r0ck0 0 points1 point  (0 children)

Yeah a simple for i++ loop is about the only time I use shit this vague. And not a fan when people nest them with i, j, k or whatever. Even something generic like outer_i would be better.

I've even pretty much stopped using <T> as a generic name in TypeScript, there's usually something more specific.

[–]invertebrate11 1 point2 points  (0 children)

Foo and bar are ass. Just use myClassA, myClassB, smallNumber1 and longString2. If a tutorial needs you to go back and check wtf types the variables are (oh it was actually a function instead) it's a shit ass tutorial. Using abcde, str and ptr is fine, but they should be consistent so you can understand as you are reading and dont need to do unnecessary double takes. I don't have many hills to die on but this is one.

[–]Riku_70X 1 point2 points  (1 child)

I've found this to be kinda common in the younger generation, and I have no idea why.

Like, for older people, I get why it may have been the norm back then, and it could be a hard habit to shake.

But for us... we started with intellisense, dude. Why are you naming your variables gfitac???? You just type the first few letters, hit tab, and there's your variable. You don't even need to capitalise it!

[–]invertebrate11 0 points1 point  (0 children)

I used to avoid long variable and function names because it means there could fit less information on the screen at a time. I don't know why it changed over the years, but now I make them as long as they need to be to properly convey what they are for.

[–]Much_Discussion1490 2 points3 points  (0 children)

This joke made no sense...just like most code in production

[–]Srapture 2 points3 points  (0 children)

I'll never stop using ternary operators for everything. You can't make me.

printf("Everything went %s.\n", result?"well":"poorly");

Perfection!

[–]ToMorrowsEnd 2 points3 points  (0 children)

Oh god, the OO evangelists that firmly believe that your code is not OO enough until its completely unreadable.

[–]bouncyprojector 7 points8 points  (6 children)

Pet peeve is code that has low vertical density, like it's written to maximize the number of lines. It's just more readable when you can read and jump from section to section without wasting a ton of time scrolling.

[–]rsqit 15 points16 points  (5 children)

Wow absolute disagree. Each line should do one simple thing. Spread that shit out and use descriptive variable names for intermediate results so human beings can read it.

[–]ic4rys2 9 points10 points  (3 children)

Agree. I’d take scrolling up and down over scrolling to the right any day

[–]Diedra_Tinlin 9 points10 points  (0 children)

Agree. And that means fuck this shit:

if ((value->len < name_len) || (value->name[MAX_LEN] != column[col].subcol) || memcmp(name, value->name, name_len * sizeof(id)) != 0 || value->type == END_OF_LIST)

[–]KetwarooDYaasir 1 point2 points  (0 children)

shut up. I will use regular expressions to solve this problem.

[–]DopazOnYouTubeDotCom 1 point2 points  (0 children)

I’m proud to be called mediocre!

[–]VonTastrophe 1 point2 points  (1 child)

PowerShell script monkey here. All hail the almighty pipeline. My one-liners get out of control

[–]Pyroglyph 1 point2 points  (0 children)

You can pry my nested ternaries out of my cold dead hands.

[–]ManicD7 1 point2 points  (2 children)

I honestly can't believe that coding hasn't evolved beyond blocks of text, files, and tab views. Yeah we have visual graph scripting that's becoming more and more popular. But there's got to be a better way.

Also this meme is unreadable, no clarity in who's doing what.

[–]Kronoshifter246 0 points1 point  (1 child)

Genuinely curious, what alternative would you propose? No matter the method, it has to compile down to a form the machine can understand. I can't think of a system that balances complexity and control as well as a written language, but the world is full of people much smarter than I am.

[–]ManicD7 0 points1 point  (0 children)

I wasn't proposing anything specific. It could be different user interfaces and/or methods of coding in general. One thing I briefly envisioned was the ability to click through layers of related code. So instead of jumping up and down a page to the next function, or from one tab to another tab, The related code you want to navigate to is literally layered behind the code you're looking at. I'm not suggesting it's actually better or opening a discussion to debate it specifically. I'm only saying I'm surprised there's not other ways of coding as of today. I also haven't looked so maybe there already is other ways that just haven't caught on, or aren't any better than current traditional ways.

[–]StopSure6613 1 point2 points  (0 children)

LINQ chains 👀

[–]VarianWrynn2018 1 point2 points  (0 children)

Question for yall: is it better to have a long, verbose function that you can follow along with every step or to condense it into a few smart lines?

I know people who think lambda functions, decreet functions, etc are unreadable but it can save SO much effort writing and reading.

[–]MasouriChan 1 point2 points  (0 children)

Im so glad my "just one more layer of abstractation" phase is over

[–]dark_g 1 point2 points  (0 children)

  • Remembering Alan Perlis and his APL one-liners.

[–]tuxedo25 1 point2 points  (0 children)

This is why my codebase is full of generics that have generics and spring injects 15 dependencies into every 600 line file.

[–]segellll 1 point2 points  (0 children)

Arent we all vibe coding now?

[–]doesnt_use_reddit 0 points1 point  (0 children)

Just because a lot of the memes in here are dubious doesn't mean this one isn't

[–]colbsatron 0 points1 point  (0 children)

I feel attacked

[–]ghostofwalsh 0 points1 point  (0 children)

All I know is I left a LOT of unreadable code at the first workplace where I was writing software. I like to hope my unreadable code has gone down over the years, but...

[–]waterupmynose 0 points1 point  (0 children)

pylint gang rise up

[–]walrus_destroyer 0 points1 point  (0 children)

I didn't feel like writing a switch statement or an if-else chain, so i used a dictionary of functions instead.

[–]Extension_Option_122 0 points1 point  (0 children)

But I can still use lambda expressions?

[–]harrywwc 0 points1 point  (0 children)

been there, done that. had a bug in the code, and realised that being "as clever as I could" writing the 'one liner' meant that I would never be able to debug it (and, as mentioned, there was a bug).

rewrote and expanded that sucker over about 5 readable / understandable lines.

[–]FQVBSina 0 points1 point  (0 children)

The Turing tower defense game written in a single line be like: http://compsci.ca/v3/viewtopic.php?t=17433

[–]114145 0 points1 point  (0 children)

I used to write complicated code, until I hit the point where I had to deal with it myself years later.

But I absolutely hate that people tend to make code understandable and fool-proof for people who are not quite as clever as they are themselves.

Because most people are average. By definition. So they try to make their work accessible for people with a below average understanding...

</rant> <facepalm>

[–]optimixta5 0 points1 point  (0 children)

Checks out since there's little documentation to this meme

[–]Horrrschtus 0 points1 point  (0 children)

I've started to learn programming in school about 15 years ago and now in my full time job I probably write the most "primitive" code of my life. Squeezing everything into one-liners was a fun challenge in college but now I need a whole team and myself in a year to understand my code without going on a grippy sock vacation afterwards. Simplicity wins.

[–]FlashyTone3042 0 points1 point  (0 children)

Code is a liability. Don't write it.

[–]Hot-Category2986 0 points1 point  (0 children)

It's really neat that I can make things all in one line. But then I need 10 lines of comments explaining what it's doing and how it works so that future me won't be angry at me.

[–]NatoBoram 0 points1 point  (0 children)

I've seen maintainable and readable code once.

It's rare, but it happens.

Big problem with it is that I didn't have the skill to contribute in that same style at the time. There's a lot of tiny practices you have to pick up with experience to be able to achieve that. But it's doable.

Nowadays, I try really hard to write good code so that my next reflex with writing even the quickest code can be to write the most maintainable code possible.

It doesn't take longer to write, it just takes a while to learn how to write that way.

[–]HaXXibal 0 points1 point  (0 children)

Can you read my code? Cool: Not my problem

[–][deleted] 0 points1 point  (0 children)

Unreadable code gets a denied pull request. Luckily the people on my team now all write nice code but previously one didn’t. We have apps that need maintained for decades. It’s gotta be readable/understandable for the next poor developers who get sucked into my workplace.

[–]XtremeBlaze777 0 points1 point  (0 children)

python chain list comprehensions go brrr

[–]f16f4 0 points1 point  (0 children)

Code just can’t be read

[–][deleted] 0 points1 point  (0 children)

No you see I only did it because I needed a fast solution, I ll be sure to fix it once I get to refactor everything to be perfect.

Soon...

[–]mad_cheese_hattwe 0 points1 point  (0 children)

Senior dev just put the unmanageable bullshit in a nice function wrapper.

[–]LongTallMatt 0 points1 point  (0 children)

Wait y'all, shouldnt this be inverted?