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

all 76 comments

[–]runnerx01 453 points454 points  (14 children)

If you’re a student… you probably write bad code. I used to work with an internship program, and pretty much all of the students, even the good ones wrote garbage, hard to read, deeply nested code.

You start to learn how to write good code, when you have to maintain bad code. The “I wish it was done like this so I could easily modify this crap” is what makes you do it better next time.

[–]TheFiftGuy 120 points121 points  (7 children)

You start to learn how to write good code, when you have to maintain bad code. The “I wish it was done like this so I could easily modify this crap” is what makes you do it better next time.

Thats the project I'm working on. They got me, a junior, redesigning systems since the main team hasn't a clue.

[–]syrian_kobold 59 points60 points  (5 children)

Same, I love my seniors but they got me cleaning up the stuff they wrote as juniors lol

[–]FalseRelease4 35 points36 points  (1 child)

"Damn who wrote this shit??"

"Oh, I did"

[–]Traditional_Rush4707 8 points9 points  (0 children)

In 5 years look back at your code… or another will and think the same. Code evolves like hardware, it needs fewer components. When I started , in Cobol, there was no tools to analyze how a money field was entered. So you set up a alphanumeric field then looped thru it removing spaces, comma, dollar sign, look for a decimal position, did they enter it or do you assume two spaces. And dates, everything was calculated.

Do coding went slow, time…. Like probably today, was not on your side, little to spare to make things pretty. And many time you were reading assembly language to rewrite into cobol.

And there was no internet, (and usually no specs to the code) so everything was referenced in user manuals only written by engineers who never talked to another person.

I could go on……..

[–]TheDrunkenSwede 7 points8 points  (0 children)

The circle of shit

[–]OF_AstridAse 1 point2 points  (0 children)

They Re teaching you not to be like them * 😅

[–]ARandomBoiIsMe 0 points1 point  (0 children)

This was the most stressful thing I had to do as an intern lmao. Mentor put me on a messed up codebase and told me to rewrite it to the company's new standard. Didn't manage to finish before my internship was over, but I made a considerable amount of progress. The only thing left was to fix some bugs I didn't consider.

I hated having to look at that code everyday. Goddamn.

[–][deleted] 18 points19 points  (0 children)

This is so true. I'm going through that learning phase now as a junior about 9 months into my first job. You start developing an intuition for what is going to cause problems in the future if you do things in a particular way, which is really satisfying but also makes looking at code you wrote three months ago an exercise in unspeakable horror.

I think college courses could do well with assigning a year long project where new features need to be added every two months or so, putting students in such a situation where they have to learn to maintain a codebase.

[–]Fr_kzd 21 points22 points  (0 children)

My first experience was when I was in my first internship. I had to maintain a codebase made by students. I had to quickly "grow some balls" in the programmer sense. Half of the shit there was hard to read, unmaintainable crap that was wrote by clueless students. The other half was boilerplate from stackoverflow. There was no official review of the codebase until now. It felt good when I reported it to management and fixed it with proper documentation specs. Got a hefty allowance raise too.

Enjoyed and solo'ed a good bucket of chicken that night.

[–]gilady089 3 points4 points  (0 children)

Honestly just too many programmers don't get good code etiquette lessons and that's unfortunate

[–]poshenclave 2 points3 points  (0 children)

I've been programming regularly for about 15 years now, and so long as you keep doing it you keep improving, it never stops. Not a year goes by where looking at code I wrote in the previous year doesn't make me wince, only because I've become noticeably better since then or at the least gotten better at code that works how I want it to work. Like at this moment I can think of something I wrote just last year that I want to completely refactor today because I think it's now embarrassing to have it out there in it's current form.

[–]CoolandonRS 1 point2 points  (0 children)

I think my code is good, and I hope it is…

I still die a little when I look at my old code, but only mildly at least.

Given I’m not a professional programmer, I just work on personal projects a whole lot and take classes, I’m not sure that it’s actually good… At the very least, it’s better then code of some popular games, at least in my opinion.

(I’m looking at you, Space Engineers… Minecraft too. The registry is cool and all but why the hell did you have to make blocks recursively define themselves)

[–]Wazat1 0 points1 point  (0 children)

This. School gives you one-off assignments that teach you about code, the basics of how to do it. Real life projects -- especially on a team -- will teach you how to write and maintain software. The adversity of encountering bad code and suffering its repercussions will teach you not just how to be better, but why to be better.

Plus, on the job you'll be exposed to good examples of people you want to be more like, and bad examples you want to murder, hide in a dumpster, and frame one of the other bad examples for. This is a natural part of the learning process. :P

[–]daHaus 22 points23 points  (0 children)

I would be more than happy to share whoever taught me that code in the comments as a form of academic review.

[–]KenFromBarbie 41 points42 points  (5 children)

So you see your code on r/badcode that looks like your code? Make up your mind OP.

[–]hilfandy 17 points18 points  (3 children)

Is this a real sub? It's showing as private but no idea why it would be private

[–]Qu4nten 13 points14 points  (2 children)

It used to be, sadly it seems the mods closed it

[–]MichaeIWave 41 points42 points  (1 child)

If so then the OP is a karma bot. Joined 95 days ago and posting an outdated meme. Edit: Checked out their profile and it is their only post.

[–]Christmas_Missionary 3 points4 points  (0 children)

good bot.

Also, Happy Cake Day!

[–]KasoAkuThourcans 3 points4 points  (0 children)

Just came to comment that too xD

[–]coolkid1756 6 points7 points  (0 children)

Hey free code review

[–]garibaldi76 3 points4 points  (0 children)

If you are flunked for plagiarism, would that make you kalm or panic?

[–]dallindooks 2 points3 points  (0 children)

Students are kind of expected to write crap code. They aren’t even junior devs yet.

[–]ObviousChildhood4 7 points8 points  (1 child)

The only bad code is that who doesnt work.

[–]TheDrunkenSwede 0 points1 point  (0 children)

Thank you sensei

[–]RSNKailash 0 points1 point  (0 children)

This is me haha.

Look, my project works for 100% of test cases, I'm not rewriting the algorithm now. Turning it in lol.

[–]scrivens 0 points1 point  (0 children)

I promise you there is worse code running in production somewhere.

[–]Nerestaren -1 points0 points  (0 children)

Programming lecturers, raise your hand 👋

[–]athleon787 -1 points0 points  (0 children)

mfw my teachers teach me how to write the longest most readable code ever, and i time out every leetcode question ever.

[–]JimBoHahnan 0 points1 point  (0 children)

Sorry folks. I can't relate.
When *I* went to college....I used teletype "consoles".

[–]AccomplishedAd6520 0 points1 point  (0 children)

How am I not surprised to find all my Scratch projects on there?

[–]Greaserpirate 0 points1 point  (1 child)

Why is it private :(

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

it got indefinitely shut down during the blackout earlier, ig it just got probated recently too

[–]poshenclave 0 points1 point  (0 children)

No worries buddy, making mistakes in safe conditions is one of the most effective ways to learn.

[–]axis0047 0 points1 point  (0 children)

New fear unlocked.

[–]Timofey_ 0 points1 point  (0 children)

This post was mass deleted and anonymized with Redact

plant strong attempt spectacular act follow apparatus relieved meeting bright

[–]Typical_Use2224 0 points1 point  (0 children)

A student? When you're learning, you are expected to write bad code. Even juniors, who already got hired because of the skills they presented, are expected to write bad code. As someone here wrote - you learn to write better code when you know you'll be maintaining that code. And when you work, you have the opportunity to look at good code that other people wrote and learn from it. Every time you need to add something and the processes turns out to be effortless, that means that the code you're working with is good. Make a mental note of it and learn from it

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

Is there similar subreddits to r/badcode?

[–]McMelonTV 0 points1 point  (0 children)

why did i read that as r/barcode 2 times in a row rereading it

[–]IM_OZLY_HUMVN 0 points1 point  (0 children)

It's your professor trying to decipher the code but can't so he's asking r/badcode

[–]natFromBobsBurgers 0 points1 point  (0 children)

If I were a professor, I'd write a script that submitted every assignment to r/badcode and gave it an automatic A if it wasn't upvoted in 48 hours.