r/shittyprogramming • u/calsosta • Nov 30 '18
Friday Code Confessions
If you have been living with technical debt and want absolution here is your opportunity.
Confess your sins and receive your penance.
155
Upvotes
222
u/calsosta Nov 30 '18
I will go first...
Forgive me shittprogramming for I have sinned. This week I flew into a blind rage after a co-worker called me out for having only one explanatory comment in a file.
I yelled at him for not understanding it, but I myself did not understand it.
2
u/MarceauKa Dec 01 '18
I'm a perfectionnist programmer and it blows my mind when I see shitty code by an other dev in my code. (French here, some colleagues code in frenglish and it is disgusting)
196
u/pixel_sharmana Nov 30 '18
Sometimes I just comment functions out and leave them for months before finally deleting them
194
u/homesarstar Nov 30 '18 edited Mar 02 '19
My only coworker is gone for 3 weeks, so I've just been committing straight to master.
EDIT: Explain to me how you fuckers only comment on prod release days, even months later.
80
u/xtravar Nov 30 '18
I named a helper function “qg”, which I can only speculate what it stands for at this point.
When called out on it, I added 8 lines of comments instead of renaming it. The function is 11 lines.
112
u/[deleted] Nov 30 '18
I *might* have thought I had invented the bubble sort for an embarassingly long time
54
u/benabus Nov 30 '18
We were short handed, so we let one guy write the backend of one of our apps in R. Then we re-wrote the whole thing in python while he was on vacation a few weeks later.
Not sure which part I feel worse about... Letting it happen in the first place or scrapping his code while he was out of town :(
81
u/munirc Nov 30 '18
I'm doing a release on a Friday.
133
u/cheese_bread_boye Nov 30 '18
I program in PHP.
31
u/[deleted] Nov 30 '18
I added JavaScript to our existing C codebase.
55
u/Botteknotten Nov 30 '18
Average response time is now 12 seconds because I did not implement batch processing
49
u/HeckinHyena Nov 30 '18
I over use if and switch statement
45
u/number529 Nov 30 '18
I’ve been working on a project for a while now and I haven’t done a commit for 2 weeks. If I need to revert something I’m fucked.
20
u/[deleted] Nov 30 '18
Forgive me shittyprogramming for I have sinned.
My current place of work saves changes locally instead of using source control. It's a huge disaster waiting to happen
50
u/[deleted] Nov 30 '18
Either I have impostor syndrome or I've never written anything I'm proud of. I seem to always go for whatever works.
17
u/[deleted] Nov 30 '18
I refactored a method in a legacy codebase with the following comment that
git blames to the year 2000:Despite completely rewriting the function, I couldn't bring myself to delete that comment and left it for posterity with the original
blamemetadata intact.34
u/TuffRivers Nov 30 '18
I wrote a massive procedural php script thats impossible to debug and automates a friends ecomm shipping.
Im afraid to touch it. May it stand the test of time.
Ive been working and making changes on the production environment and committing back to master. What could go wrong?
59
u/[deleted] Nov 30 '18
I unironically enjoy coding in C even though it is an absolute pain
31
u/designerandgeek Nov 30 '18
In code from a year ago, which I have now forked into a new, similar project, I found this:
… not once, but twice.
They are still there, in both the old project and the new one.
15
u/mordack550 Nov 30 '18
I always criticize one of my colleague because he often writes code very poorly, that basically only gets the job done but it is hard (or just ugly) to read.
But yesterday I wrote a simple UPDATE that should just set a field to 1 for some records... I changed the wrong field, on a production environment. A unit test failed because of that, but I just removed part of the test because i though it was a false positive.
14
u/Kikiyoshima Nov 30 '18
2 years ago i used classes instead of enums for C# school project...
14
u/bradfordmaster Nov 30 '18
So so many things lately, but the one I'll post now is that we have an issue with time sync. Rather than actually finding out when an NTP time sync happens, I have a bit of code that runs every 5 seconds (based on steady clock), and compares the value of system_clock to a saved value, and if it differs by more than 10 seconds, I assume an NTP sync must have happened.....
39
u/all3f0r1 Nov 30 '18
I keep using in-line CSS because the crap I'm working on has loads of floats I have to hack, and class names and ids are already like "header3"... About to leave satisfied and rotten to the core.
22
u/mistermashu Nov 30 '18
forgive me shittyprogramming for i have sinned.
lately i have preferred simpler yet if-ridden classes to more complex setups.
21
u/[deleted] Nov 30 '18
Today I merged two features to our RC at the same time before deploying it on our QA server. It ran flawlessly, but it felt so dirty 😏
10
u/mrheosuper Nov 30 '18
i dont use header file, only 1 file, 2000+ lines long
10
u/cryosis7 Nov 30 '18
(JS) I've got into a habit of using 'x- -y' to add two variables because parseInt is longer to write. One day I'll come back to it and think wtf.
10
u/[deleted] Dec 01 '18
I've never really finished any hobby projects.
But I'm great at starting new ones!
8
u/SasquatchOnVenus Nov 30 '18
I used to do this
Class RandomClass
{
}
8
u/Joejoe930117 Nov 30 '18
Most of my current work is in Powershell, so more scripting than programming but I've got a few things....
I can already feel future me's pain...
8
u/DontEatTheFish Dec 01 '18
When designing web forms I enjoy prefixing button controls with "butt"
buttOpen buttSubmit buttClose
14
u/[deleted] Nov 30 '18
count=count+1Instead ofcount+=17
u/manolo_manolo Nov 30 '18
After 2 years of C programing, yesterday I've started using JavaScript
7
u/Absorbing Nov 30 '18
I'm a lead PHP dev, do I need to say more?
Forgive me.
7
u/ApacheFlame Nov 30 '18
Forgive me shitty programming for I have sinned. I underestimated the impact of a simple method in a webapi. It caused a 2s delay in all requests for all of our servers in asia because our session management also terrible.
6
u/fedupwithpeople Nov 30 '18
i didn't do this, but...
despite git:
index.php index.php.save index.php.old index.php.testbugfix index.pgp.testbugfix2 index2.php index2.php.bak ~index.php index.hp index.ph index.bak index2.bak index.bak2 index.bak3 index.johnbak index.20180692.bak
ad nauseum.
1
u/sac_boy Dec 01 '18
I’ve fixed bugs in open source projects by patching them locally/forking them instead of bothering to argue back and forth with maintainers.
If the overhead of maintaining a patch/fork is less than the pain of improving it for everyone, I’ll just do that.
3
u/tomassci Nov 30 '18
sin (0)3
u/RAKane93 Dec 01 '18
I wrote several automation scripts with zero commenting. To this day only I work on them. I forced myself to learn and practice better commenting over the years since then, which has certainly made my coworkers more willing to work with me lol.
3
u/phernandoe Dec 01 '18
Everything is an arraylist
3
u/PityUpvote Dec 01 '18
I use try/except as program flow when an if statement would work fine.
2
u/compdog Dec 01 '18
I have a project that is caredully divided into a number of modules with a single "core" module that contains the data model and some common code. Well, one data structure in the core has an extra method that is only used by one single subproject and only returns valid data in one specific application context. Bonus points, it's undocumented.
I should have implemented it by subclassing parts of the core, but that would have been tons of work and I was lazy. So now here we are...
2
u/BoltKey Dec 01 '18
Yesterday I adjusted my Wordpress page using
style="margin-top: 10px".2
u/walking_bass Dec 01 '18
I'm the only one capable of maintaining one of our systems that runs on 2 different platforms. I haven't been able to reconcile the two configurations yet so I commit my changes straight to master to build on platform 1 then branch and reconfigure for platform 2. Over and over again. Somebody help me.
2
u/theemptyqueue Dec 10 '18 edited Dec 10 '18
Forgive me r/shittyprogramming for I have sinned.
I program in every language like it were C or C++. I use classes in Java or python like structs.
For my first assignment in my compilers course, I created pointer variables in Java.
I create useless functions that I think I will need as a project progresses, but never use those functions.
I find a way to get around most exceptions in Java by not using Java.
I set my Apple II E into an infinite loop many times by typing:
I have an original Apple II that I've been meaning to fix, but I put it off every time I get a chance.
I have a working Commodore 64 and floppy drive, but no video out cable.
I know how to write Gcode for CNC mills and 3D printers, but don't because I'm lazy.
I created a functions in C++ to write my LISP homework assignments.
I have a nice Micron PS2 keyboard with rubber-dome key switches, but don't use it for code-writing as often as I should.
I created a C++ application that does nothing except write a 1 GB text file.
I write all of my Java code in C++ first and then translate that over to save time and effort.
I know enough Java to start any program off strong, but not enough to actually finish it.
I have an old copy of Word Perfect for PC in my garage, but haven't gotten around to installing it.
I create 3 branches for every git repository:
updates
working
master
I have four 25 gallon bins full of 5.25 inch floppy disks, but no way of reading them because I don't have the right drives.
1
u/Goku1920 Nov 30 '18
Forgive me for I have procrastinated on Reddit instead of working.
1
u/nathodood Dec 01 '18
I use JavaScript instead of PHP. Furthermore I don't tend to add comments on any code I write.
1
u/NotExplosive Dec 01 '18
I like lua.
1
u/[deleted] Dec 01 '18
I fork forks until I get something that works nicely, then I throw it into master and hope nobody asks why everything is different.
1
u/ipullstuffapart Dec 01 '18
In a team of a mere handful of developers in a small company, we had our main .NET developer resign to go on an around-the-country trip - who has just been replaced with someone who's getting up to speed, one resign to move to another company, and hired on another junior. Our current project is far behind schedule and keeps getting derailed by a boss who keeps arguing about how the internals of the system should conceptually operate whilst not listening to the client or doing any of the development himself - and has no plans on replacing the intermediate guy who resigned, so our already stretched-thin development team (now pretty much just myself being a long-time employee) has one less person on staff to spread across everything. And with this, our primary SAAS that we provide is being planned to have a complete ground-up overhaul which we do not have the staff to get it done in any decent time. Times are tough, and I'm honestly prepping the CV in case it gets any worse.
1
u/dmitriy_shmilo Dec 01 '18
In 2018 we're still using perforce.
1
u/rundfunk90 Dec 02 '18
I've made a program to translate and send data between 2 subsystems. However, when the emergency stop was pressed I couldn't get communication set up properly anymore. We needed a quick fix for an important test and because there was no state to be saved, I just restarted the software using some dirty hack involving Windows Services automatically rebooting services and just hard exiting the program.
You know what they say about quick fixes...
0
u/[deleted] Nov 30 '18
[deleted] — view deleted comment
0
u/[deleted] Nov 30 '18
[deleted] — view deleted comment
0
u/[deleted] Nov 30 '18
[deleted] — view deleted comment
0
u/[deleted] Dec 01 '18
[deleted] — view deleted comment