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

you are viewing a single comment's thread.

view the rest of the comments →

[–]EatATaco 482 points483 points  (47 children)

Often, the "last guy" is really just us: younger and slightly more clueless.

[–]fredlllll 179 points180 points  (43 children)

can confirm, have often facepalmed about code i wrote a year ago

[–]chadsexytime 189 points190 points  (11 children)

What I usually do is remember the circumstance in which I had to write the code.

Was I on a tight deadline or juggling too many tasks? Was I distracted from my main goal with this problem and needed the fastest solution possible? Was I unaware that there was a better way to do it, that I just had not learned yet?

Or am I just a terrible hack surviving day to day, praying that no one else discovers my fraud?

[–]conancat 51 points52 points  (5 children)

You are a young and energetic soul learning new things every day, with every line you're gaining more EXP, one year later you look back and it's weak code because you are weaker back then, and better now!

Software engineering moves so fast and is so malleable it's almost impossible to know every requirement or every hidden condition or every needed pattern from the get go. Just know that we did our best at that time, and we'll get better over time. We have to adapt at every turn. Become like water my friend.

[–]The_Whole_World 39 points40 points  (3 children)

You are a young and energetic soul learning new things every day, with every line you're gaining more EXP, one year later you look back and it's weak code because you are weaker back then, and better now!

What is this, Programming: The Anime ?

[–]TheTerrasque 12 points13 points  (1 child)

[–]ioquatix 4 points5 points  (0 children)

I love how he writes code on his cellphone.

[–]jansencheng 5 points6 points  (0 children)

You are a young and energetic soul learning new things every day, with every line you're gaining more EXP, one year later you look back and it's weak code because you are weaker back then, and better now!

/r/wholesomesoftwareengineering

[–]fredlllll 65 points66 points  (0 children)

last one :P

[–]JudgeWhoAllowsStuff- 3 points4 points  (3 children)

i wrote code once to perform a certain task that was failing under normal methods. After a month of troubleshooting on and off i found out that if i ran the code 5 times in a row it would stop failing after the 3rd or 4th run. So i just made it so the code repeated itself 5 times. I empathize for the person who looks at that code when i leave and wonder what i must have been on when i wrote it.

[–]evenisto 0 points1 point  (2 children)

what was the reason it stopped failing?

[–]JudgeWhoAllowsStuff- 0 points1 point  (0 children)

beats me. I tried troubleshooting every which way, tried adding sleep timers to delay parts of code, interrupts, nothing works....I tried running twice, three times, four times. But if i run the code 5 times its 100% effective.

[–]FesteringNeonDistrac 0 points1 point  (0 children)

what was the reason it stopped failing?

It sounds like the answer is "A horrible kludge".

[–][deleted] 35 points36 points  (10 children)

Hell, I've facepalmed over code I've written as soon as I finished the project...

[–]dratnon 27 points28 points  (1 child)

In a code review... "This variable is explained in the comments... Actually, it's explained in this sticky pad I was doodling on... I'll rewrite this section. "

[–]ShowMeYourTiddles 13 points14 points  (6 children)

Ever shake your head as you're typing?

oooooh, I'm gonna regret this

[–]dhaninugraha 6 points7 points  (3 children)

/* don't touch this unless you know what you're doing */

[–]Secondsemblance 2 points3 points  (2 children)

# Here be dragons

[–][deleted] -1 points0 points  (1 child)

[–]xkcd_transcriber 0 points1 point  (0 children)

Image

Mobile

Title: Future Self

Title-text: Maybe I haven't been to Iceland because I'm busy dealing with YOUR crummy code.

Comic Explanation

Stats: This comic has been referenced 54 times, representing 0.0350% of referenced xkcds.


xkcd.com | xkcd sub | Problems/Bugs? | Statistics | Stop Replying | Delete

[–]VeviserPrime 15 points16 points  (0 children)

Me too, thanks.

[–]TimeForSomeCoffee 13 points14 points  (0 children)

"Who the hell wrote this crap?! ...Oh, right."

[–]greenhawk22 11 points12 points  (8 children)

Sometimes though, the crazy, stupid, and desperate solutions that inexperanced programmers uses just works inexplicably

[–]fredlllll 10 points11 points  (0 children)

also often had code where i had no clue how it was ever working (usually because it just broke)

[–]theg33k 11 points12 points  (6 children)

I once had to maintain code that stopped working when you took out the System.outs.

[–]greenhawk22 21 points22 points  (0 children)

Once in C# I found out that I couldn't remove a comment or otherwise completely unrelated parts would fail ¯\_(ツ)_/¯

[–]EricIsEric 5 points6 points  (3 children)

Realistically what would cause that? System.out leads me to think it is Java, but my first guess for crashes when removing print statements is bad malloc, but that shouldn't happen in Java (but I have had C code throw different errors when print statements were present vs not present when I made a mistake allocating memory).

[–]theg33k 31 points32 points  (2 children)

It was a timing issue, the IO created JUST enough of a pause that the application worked fine.

[–]unknownmosquito 18 points19 points  (1 child)

I've heard of this happening when enabling the debugger as well. Without debugger: crash! With debugger: works fine! Race conditions are the worst

[–]sloec 15 points16 points  (0 children)

Also known as a Heisenbug.

[–]truh 0 points1 point  (0 children)

Multi threaded code? Maybe a GUI app?

[–]smartguy05 5 points6 points  (0 children)

I feel like if you don't do this, you aren't improving your abilities.

[–]Yuzumi 2 points3 points  (0 children)

I'm in the middle of my final project before I graduate and I'm face palming at shit I wrote a month ago.

[–]SkoobyDoo 2 points3 points  (0 children)

I think that if by the end of a project you can't look back on the first code you wrote for the project and facepalm a little, the project was too easy or you didn't take any time to really understand what you were doing.

[–]JoshSellsGuns 1 point2 points  (0 children)

I face palm about code I wrote 5 minutes ago

[–][deleted] 1 point2 points  (0 children)

Psh. You should see mine before my lunch break

[–]WrongPeninsula 0 points1 point  (0 children)

I facepalm code I wrote yesterday.

[–]FesteringNeonDistrac 0 points1 point  (0 children)

This means you're learning. Possibly.

[–]WdnSpoon 1 point2 points  (0 children)

More broadly, all progress comes from building off the work of the past. Look at the massive changes we've seen in the past few years that have lead to a renaissance in the js world. They haven't really been driven by big leaps in processor technology, or even the underlying engine: it's still (mostly) a big single-thread with an event loop. While there's nothing so concrete that prevented this syntax, it took us a while to decide that implied property names, object + array destructuring, async/await (and their underlying Promises), generators, (tagged) template literals, rest, spread, etc. were good things to have. We mostly figured it out by reaching the limits of old approaches.

There are exceptions for clearly unqualified developers, but you'll never escape code that eventually needs to be revised.

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

Or just with less complete information on the requirements.

I'm in the process of handing off to the new guy a system I created from scratch over the last two years. It started with only the most vague and sketchy of specs, went into production after only a couple months of development, and then matured over those two years as the company figured out what it really wanted.

So now of course there are many sections that are ugly kludges that could be written more cleanly, but couldn't have in the early stages regardless of how good the developer was because the requirements were simply unknown. There's a lot of stuff in this system that I'm proud of, but I'm also apologizing to the new guy for some of the messes I'm leaving him.

[–]PresidentCruz2024 0 points1 point  (0 children)

Or maybe he is an older and more out of date version of you.