6 ms·
Code Shame: Sharing your embarrassing code
- bovermyer 7y agoI 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.
- icedchai 7y agoI 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.
- sofaofthedamned 7y agoSame! Best programming I ever did was on the ST and Amiga.
- tclancy 7y agoAny 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.
- icedchai 7y agoYou 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.
- dpcx 7y agoI 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!
- rafaelvasco 7y agoI 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.
- nomel 7y agoWhat would you say the biggest difference is? For me, the amount of magic in my code has been significantly reduced.
- rafaelvasco 7y agoMostly 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;
- bbody 7y agoNothing like the feeling of seeing some terrible old code in a shared repository, looking at git blame and seeing it was written by you.
- lbj 7y agoCertainly 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 :)
- bbody 7y agoAuthor 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.
- thinkingkong 7y agoIf 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.
- bbody 7y agoExactly, agree with you 100%. However I think when we start our careers there is a resistance to put ourselves out there.
- tobr 7y agoThere’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.
- _bxg1 7y agoThere's this: http://unmaintained.tech/ http://unmaintained.tech/
- bbody 7y agoThank you for linking this, definitely going to use it.
- notduncansmith 7y agoThere’s also the Archive Repository feature, which can help: https://help.github.com/en/github/creating-cloning-and-archiving-repositories/archiving-repositories https://help.github.com/en/github/creating-cloning-and-archi...
- plorkyeran 7y agoI 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.
- mdonahoe 7y agoI enjoyed the "impressive feet" typo in the first sentence. (First time I've ever seen that word pairing!)
- bbody 7y agoThanks for pointing out the typo, it has been fixed. I guess it is a phrase I heard more than I read/wrote.
- tamaharbor 7y ago'GOTO 200' may not be elegant, but it always works.
- waterhouse 7y agoThe CRAPL is somewhat related: http://matt.might.net/articles/crapl/ http://matt.might.net/articles/crapl/ , https://news.ycombinator.com/item?id=9670497 https://news.ycombinator.com/item?id=9670497
- james-imitative 7y agoNay, very related!
- l0b0 7y agoI 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.
- bbody 7y agoThank 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.
- HoppedUpMenace 7y agoHere's a pretty embarrassing one ;): int index = 0; while (!element.equals(sortedList.get(index)) && sortedList.size() > ++index); return index < sortedList.size() ? index : -1;
- bbody 7y agoThanks for sharing!
- sprflyprgrmrguy 7y agothat's the slowest subroutine I've ever seen
- robodale 7y agoAsking for the sortedList size with every iteration of that loop. haha, ouch! :)
- santa_boy 7y agoI 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/ https://blog.mypad.in/
- zadkey 7y agoAt 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.
- olliej 7y agoThere 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)