In 2008 I participated in a graphing calculator challenge where the goal was to convert a numeric input into word form (e.g. 1002 to "one thousand two"). I didn't understand algorithms at the time, so the code was a mass of if statements determining what each part of the screen should print, rather than concatenating a string.
The screen wasn't big enough to handle output that way, so the "and" was... creatively placed.
(I still won though because my program was the fastest... turns out calculators executed loops very slowly, so my not using them gave me an edge!)
At the beginning of my career, I was fond of one-liners and compactness, with all the disregard of white spaces, meaningful variable names and readability all around.
I don't really know if the code was either crappy, genius or average, because I had no idea of what that meant: it was completely obscure to myself in a couple of months.
Lol I remember early on as a programmer being proud of traits in my code which were objectively awful. Like, seeing complexity as a win because of all the cool things one single algorithm could accomplish.
I'm a selftaught (web) developer. On sunny days, you can find me hiking through the Teutoburg Forest, on rainy days coding or with a good fiction novel in hand.
Any time I've had to work on really bad legacy code where I can't confidently change any existing code, but I can pile some crap on the top somewhere if there's a problem. It just keeps getting worse and worse and worse and eventually you leave the project and somebody else takes the routine.
Did things ever fail after 5 days and you need to start over? I mean β sometimes I'm running a script that requires me to keep my laptop open and I forget that. π
So it started Like executing for
2 days : Didn't execute, abort
3 days :Didnt work, abort
5 days: Didnt work, abort
finally it was long weekend and i executed it in my cloud virtual machine.
7 days : Finally Done.
Three-time entrepreneur. Co-founder of Algoritma, a data science academy; https://supertype.ai, a full-cycle data science agency; GrowthBot (chatbot on Slack). Building: Learnblockchain.academy
Location
Indonesia / Singapore
Work
Co-founder, https://Supertype.ai and https://Algorit.ma
Three-time entrepreneur. Co-founder of Algoritma, a data science academy; https://supertype.ai, a full-cycle data science agency; GrowthBot (chatbot on Slack). Building: Learnblockchain.academy
Location
Indonesia / Singapore
Work
Co-founder, https://Supertype.ai and https://Algorit.ma
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
30+ years experiance. Focused on C# since 2001. My day job is C#, Web/Win, and MS Dynamics. I also work on a few side projects with AI/ML, mostly around compilers and coding tools.
Probably the funniest and scarest thing I ever did was write a 1 line C app in my freshmen C class. We were learning how to submit keyboard events. So I thought it would be funny to write an app that captured ctrl-alt-delete and call it from autoexe and see how long it would take someone to figure it out... and hit ctrl-c to stop it. Well, they freaked out and thought it was a virus and the prof formatted every computer in the lab and reinstalled everything from scratch. Then the univerisity put up notices in every computer lab and they created some new article in the student handbook about putting viruses on univerisity computers. Needless to say... I never mentioned it again.
Early in my webdev life I really didn't grasp the concept of GET vs POST. I wrote some really bad/insecure code which attempted to submit huge amounts of data via URL params.
I once wrote a primitive ES3 lexical parser in PHP meant to filter out comments and bundle JS files (a few years before node.js was released).
It resulted in errors because it had concatenated jQuery, which used an IEFE, with another IEFE without a semicolon in between, an edge case that I had overseen during development. It took me almost 1Β½ days to find and fix that error.
30+ years experiance. Focused on C# since 2001. My day job is C#, Web/Win, and MS Dynamics. I also work on a few side projects with AI/ML, mostly around compilers and coding tools.
I remember do something similar in UNIX scripting where you delete all the files on a system. The way you figure out who did it was that the only remaining account left on the system was theirs, as you cannot delete your own account. That was always fun. Even more fun when one of the backups failed.
Well I was a trainee (German system) and it was my first month or so. My trainer just wanted to show me some cool stuff on a dummy database. Sadly though the DB software was still connected to the main db. So yeah I deleted main. Of course our admins had backups but still ... Yikes
I was a college student in my first year and I used phyton in basic programming class. It was an exam day and one of the task given was to make a triangle with "*". I didn't even know how to use a loop concept, so I used print() and spacebar a few times to make a triangle. I could say that the task was succesfully failed.
Tech Lead/Team Lead. Senior WebDev.
Intermediate Grade on Computer Systems-
High Grade on Web Application Development-
MBA (+Marketing+HHRR).
Studied a bit of law, economics and design
Location
Spain
Education
Higher Level Education Certificate on Web Application Development
In the very early days of my program on GitHub (I was still a beginner to Visual Basic at the time), there are countless horrible code blocks that still embarrasses me to this day. The most remarkable one is this (from Kernel Simulator v0.0.2):
Sub ShowTimeQuiet()
If (Quiet = True) Then
'Do nothing
Else
ShowTime()
End If
End Sub
When it should have been this:
Sub ShowTimeQuiet()
If Not Quiet Then
ShowTime()
End If
End Sub
That "wrapper" function has been removed ever since. I'm embarrassed as to how I did manage to write such code in an abrasive manner.
Other interesting bits:
The variables were used to list users and passwords:
'TODO: Re-write login system, removing unnecessary variables
'Variables
Public usernamelist As New List(Of String) 'Temporary
Public passwordlist As New List(Of String) 'Temporary
Public userword As New Dictionary(Of String, String)() 'List of usernames and passwords
My.Settings.Usernames = New System.Collections.Specialized.StringCollection 'Temporary
My.Settings.Passwords = New System.Collections.Specialized.StringCollection 'Temporary
Three completely identical variables related to usernames and passwords in different places to INITIALIZE a SINGLE user! Try to figure out their roles in Login.vb.
Since then, the source code got much better throughout the four years to the point that it even complies with OOP!
Three-time entrepreneur. Co-founder of Algoritma, a data science academy; https://supertype.ai, a full-cycle data science agency; GrowthBot (chatbot on Slack). Building: Learnblockchain.academy
Location
Indonesia / Singapore
Work
Co-founder, https://Supertype.ai and https://Algorit.ma
Computer scientist with background in chemistry and physics, now working as a java developer. Often knowing about "that thing" and having forgotten the word.
I don't remember why I exactly did this and it was years ago, but I had a bunch of similar named variables and/or methods and was to lazy to even copy and paste the code and do some alternations so I used some loops, concat and exec to generate and execute everything. Even though this was before I started to actually study computer science, I had the clear feeling this was wrong, but all that typing seemed unbearable.
I would really like to get that code and to look at this again as I can't imagine by know that this could have been without a less questionable solution and I would like to fix it.
French software engineer with 15 year experience on 3D data visualisation and processing. Lots of C++, and switch to Unity recently.
I like when it run fast π
What's the worst code you've ever written... yet.
In 2008 I participated in a graphing calculator challenge where the goal was to convert a numeric input into word form (e.g. 1002 to "one thousand two"). I didn't understand algorithms at the time, so the code was a mass of if statements determining what each part of the screen should print, rather than concatenating a string.
The screen wasn't big enough to handle output that way, so the "and" was... creatively placed.
(I still won though because my program was the fastest... turns out calculators executed loops very slowly, so my not using them gave me an edge!)
At the beginning of my career, I was fond of one-liners and compactness, with all the disregard of white spaces, meaningful variable names and readability all around.
I don't really know if the code was either crappy, genius or average, because I had no idea of what that meant: it was completely obscure to myself in a couple of months.
My code used to look like a regular expression.
Lol I remember early on as a programmer being proud of traits in my code which were objectively awful. Like, seeing complexity as a win because of all the cool things one single algorithm could accomplish.
Yikes
Made my day. Might be due to my constant usage of ihateregex.io/
Any time I've had to work on really bad legacy code where I can't confidently change any existing code, but I can pile some crap on the top somewhere if there's a problem. It just keeps getting worse and worse and worse and eventually you leave the project and somebody else takes the routine.
I once worked on a SQL query that took seven days to execute. Exact same situation.
Aghhhhhh!
Did things ever fail after 5 days and you need to start over? I mean β sometimes I'm running a script that requires me to keep my laptop open and I forget that. π
So it started Like executing for
2 days : Didn't execute, abort
3 days :Didnt work, abort
5 days: Didnt work, abort
finally it was long weekend and i executed it in my cloud virtual machine.
7 days : Finally Done.
ibb.co/6XRc7Xt : See this.
Oh man do I feel this. It's too real haha
Boss: Try to track page views on our website, but also try to avoid making a database trip on every single page load.
Me: Say no more.
Didnβt know React but was called in to do some last minute changes which needs to be committed under a deadline.
Using location.reload() to refresh the browser after a react state change that wasnβt rendering the intended component.
Got so sick in the stomach writing it. Had to purge it from git history so it never exist. Spend the weekend learning React proper.
It felt dirty. I never fully recovered.
C'mon that's not that bad πππ
Probably the funniest and scarest thing I ever did was write a 1 line C app in my freshmen C class. We were learning how to submit keyboard events. So I thought it would be funny to write an app that captured ctrl-alt-delete and call it from autoexe and see how long it would take someone to figure it out... and hit ctrl-c to stop it. Well, they freaked out and thought it was a virus and the prof formatted every computer in the lab and reinstalled everything from scratch. Then the univerisity put up notices in every computer lab and they created some new article in the student handbook about putting viruses on univerisity computers. Needless to say... I never mentioned it again.
Early in my webdev life I really didn't grasp the concept of
GET
vsPOST
. I wrote some really bad/insecure code which attempted to submit huge amounts of data via URL params.I once wrote a primitive ES3 lexical parser in PHP meant to filter out comments and bundle JS files (a few years before node.js was released).
It resulted in errors because it had concatenated jQuery, which used an IEFE, with another IEFE without a semicolon in between, an edge case that I had overseen during development. It took me almost 1Β½ days to find and fix that error.
A SQL script that deletes all tables, views, everything.
Executed by mistake (my first days at work).
My mates pranked me.
I remember do something similar in UNIX scripting where you delete all the files on a system. The way you figure out who did it was that the only remaining account left on the system was theirs, as you cannot delete your own account. That was always fun. Even more fun when one of the backups failed.
Wait so they pranked you into writing the script and executing? Can you expand on the story?
Well I was a trainee (German system) and it was my first month or so. My trainer just wanted to show me some cool stuff on a dummy database. Sadly though the DB software was still connected to the main db. So yeah I deleted main. Of course our admins had backups but still ... Yikes
I was a college student in my first year and I used phyton in basic programming class. It was an exam day and one of the task given was to make a triangle with "*". I didn't even know how to use a loop concept, so I used print() and spacebar a few times to make a triangle. I could say that the task was succesfully failed.
When all you have is a hammer, everything is a nail innit
In the very early days of my program on GitHub (I was still a beginner to Visual Basic at the time), there are countless horrible code blocks that still embarrasses me to this day. The most remarkable one is this (from Kernel Simulator v0.0.2):
When it should have been this:
That "wrapper" function has been removed ever since. I'm embarrassed as to how I did manage to write such code in an abrasive manner.
Other interesting bits:
The variables were used to list users and passwords:
Login.vb:
Kernel.vb:
Three completely identical variables related to usernames and passwords in different places to INITIALIZE a SINGLE user! Try to figure out their roles in Login.vb.
Since then, the source code got much better throughout the four years to the point that it even complies with OOP!
Heh great catch! thatβs probably why it didnβt make it into production.
There should have been 1/17 chance!
Me too
I don't remember why I exactly did this and it was years ago, but I had a bunch of similar named variables and/or methods and was to lazy to even copy and paste the code and do some alternations so I used some loops, concat and exec to generate and execute everything. Even though this was before I started to actually study computer science, I had the clear feeling this was wrong, but all that typing seemed unbearable.
I would really like to get that code and to look at this again as I can't imagine by know that this could have been without a less questionable solution and I would like to fix it.
I had to store plain password in a "new" application cause in the previous application the password were stored like that.
I once implement a sorting algorithm with a complexity of O(n^3)...
It was friday evening. On next monday morning, I just removed all the code and call std::sort() instead.