Hacker News new | past | comments | ask | show | jobs | submit login
Code Shame: Sharing your embarrassing code (brendonbody.com)
40 points by bbody on Feb 5, 2020 | hide | past | favorite | 33 comments

If you're constantly getting better at what you do then you'll always look back at your old work with a unique perspective. To some, that might take the form of embarrassment, humiliation, etc. But put in a more positive light, you can look at your work and know how far you've come.

I think we should all behave more like the later; appreciate your growth mindset, and remember 5 years from know whatever you're doing now might be unrecognizable.

Exactly, agree with you 100%. However I think when we start our careers there is a resistance to put ourselves out there.

There’s an unfortunate productization that happens when you put some code publicly on GitHub. There seems to be a culture that you should make the repo look attractive even if it’s just some off the cuff experiment no-one ever tried to run in production.

I’m certainly not against doing your work in public if that works for you, but I wish GitHub were better at encouraging people to label their half finished experiments as half finished experiments.

I would guess that the substantial majority of repositories on github have had zero effort put into making them look presentable. The thing is that you don't normally see any of them because you don't spend your time on github looking for half-finished experiments that no one uses. Open a prolific user's profile and scroll down to the bottom of their repository list and you'll often see a bunch of completely unpolished things, though.

There’s also the Archive Repository feature, which can help: https://help.github.com/en/github/creating-cloning-and-archi...

Thank you for linking this, definitely going to use it.

I really, really wish that I had the source code I wrote back before Github was a thing. Most of that, though, was never in version control, and I have long since lost the floppies it was stored on.

This post is inspiring me to go clean up my old repos on Github, and perhaps wax nostalgic about my previous works, even the awful ones.

I found code the other day while cleaning a disused drawer. Not on a floppy... on paper. Apparently, I had printed some Perl code from around 2003 that moved a bunch of files around on a Windows share for my employer at the time. It's surprisingly good code considering its age!

I have stuff I wrote in the mid 90's. Mostly C code. It's horrible to look at.

I wish I kept the earlier stuff from my Amiga days.

Same! Best programming I ever did was on the ST and Amiga.

Any reason why? I tried to do a bit on our C64 as a kid but . . . well, it's amazing I wound up as a developer after that experience.

You had to be very careful programming the Amiga. There was multitasking, but no memory protection. If you wrote to a bad address (like a null pointer), you were staring at a "Guru Meditation" screen followed by a reboot.

At my very first coding job, I was hired to update the design of a .net webforms website. My academic background was in java. There was no on the job training. It was just me, 2 C# books, and stackoverflow.

I remember writing monolith methods/functions with 1000+ lines of code.

I remember manually generating SQL as a string for ado.net. I also remember being unaware of stringbuilder and doing tons on += on strings and wondering why the application was slow.

Looking back now at my first time, it seems funny more than embarrassing. I remember it fondly.

Here's a pretty embarrassing one ;):

int index = 0; while (!element.equals(sortedList.get(index)) && sortedList.size() > ++index); return index < sortedList.size() ? index : -1;

Asking for the sortedList size with every iteration of that loop. haha, ouch! :)

that's the slowest subroutine I've ever seen

Thanks for sharing!

I thought this was just going to be another humblebrag like all that cringeworthy impostor syndrome stuff last year, but this has some good advice. If it did something useful, then certainly someone else can learn from it and you can be proud of it, no matter how far it is from what you do nowadays.

Thank you for the feedback, I am glad you interpreted what I wrote that way. I was trying to essentially take my conversation with my friend, take the advice I gave to him and add some self-reflection.

I enjoyed the "impressive feet" typo in the first sentence.

(First time I've ever seen that word pairing!)

Thanks for pointing out the typo, it has been fixed. I guess it is a phrase I heard more than I read/wrote.

No worries!

I also enjoy the opposite: when people pronounce words incorrectly because they've never heard them aloud, only in writing.

I've embarrassed myself several times in this regard.

I always thought "force of habit" was "forcive habit".

I just put everything on Github, good or bad. I always try to keep code smell at a minimum, but I can't even recognize my earlier code anymore, like ten years ago. Doesn't look like I coded it at all.

Nothing like the feeling of seeing some terrible old code in a shared repository, looking at git blame and seeing it was written by you.

What would you say the biggest difference is?

For me, the amount of magic in my code has been significantly reduced.

Mostly two big changes that I got with experience: Code architecture and organization in general. You make more modular code, minimize code coupling etc. And another big change is in optimization. You learn to better optimize your code, avoid too much allocations, performance tricks, etc. That depends on the language to an extent, but several things are global to all programming languages; I mostly code in C# and Javascript these days. Game development and game tools;

Certainly I would want upcoming developers to share as much as possible, to get as much help and as many pointers as possible. But personally, I want to see your best. In the authors case, he's seemingly improved a lot since writing the early code, so I see no harm in taking it down/replacing it.

But in general, share what you can. Don be embarrassed, even a stern code review will help you improve, but I very rarely see 'stern reviews' outside of Linux Kernel development :)

Author here, with regard to "taking it down/replacing it", I found a middle ground. I moved all those repositories to another organization (that I control), so my profile is clean and if I need/want to see that code I can go there.

There were some old assignments I wrote at university that I really wish I could find (my favorite “real” one being a catastrophically insecure implementation of RSA)

I kinda fear this as I am working on my startup. I am sure that the code needs a lot of refinement but I am often pleased that it does the job that I set out to achieve.

I am not quite sure how this is going to work out as I am self-taught coder .... https://blog.mypad.in/

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact