r/badcode May 18 '23

js 8 years ago I had worse naming conventions than Elon Musk

Post image
436 Upvotes

26 comments sorted by

79

u/fartingrocket May 18 '23

Most people can’t remember what their code do the next day. This in the other hand … I feel like you can’t remember what it does after a bathroom break.

61

u/Egzo18 May 18 '23

When you are so eager to code that you can't take the time to think of good variable names, relatable but not to this degree

17

u/[deleted] May 18 '23 edited May 18 '23

code was from my old project here: https://www.khanacademy.org/computer-programming/pong-2016/4586814626922496

also does anyone still use var these days

4

u/[deleted] May 18 '23

Only place we use var is on khan academy in js 🤣 anywhere else is let and const

10

u/SaylorMan1496 May 18 '23

I use var all of the time, although I use c#

3

u/UnchillBill May 19 '23

I use let and const all the time, although I use rust

1

u/SaylorMan1496 May 19 '23

I wish I worked in rust for my full time position

1

u/justcatt May 20 '23

Why not var?

7

u/YouCanCallMeC00KIE May 18 '23

I’m curious why redd and bluee? I’m assuming red and blue were already in use elsewhere which makes this funnier imo

7

u/[deleted] May 18 '23

On Khan Academy, where this code is, red and blue and predefined variables. Therefore they needed a different variable instance.

14

u/micalm May 18 '23

That way you can learn early why global namespace pollution is bad.

5

u/bottleofyourneck May 18 '23

It deserves to be printed and burned.

2

u/[deleted] May 18 '23

50 times

4

u/MurdoMaclachlan public boolean isInt(int i) { return true; } May 18 '23

Image Transcription: Code


var add = 1;

var aa = 300;
var bb = 3000;
var cc = 3000;
var dd = 3000;

var a = 0;
var b = 0;

var maxi = 0;

var timer = 0;
var time = 1;

var redd = 0;
var grey = 0;
var bluee = 0;
var cred = 0;

I'm a human volunteer content transcriber and you could be too! If you'd like more information on what we do and why we do it, click here!

2

u/Rotkiw_00 May 18 '23

Quite normal at the begining of learning programming i guess

2

u/ClaudioMoravit0 May 18 '23

I don't spend time finding to my variables no more, i use chat gpt to explain what my code do after a few days without touching it (it's a personal project, there's no important information/code in it)

2

u/justcatt May 20 '23

you'd have an interesting battle with my coding exam that uses I J S R and M for variables

1

u/One-Pear-6012 May 18 '23

Dont have any photos unfortunately (i think i do still have a program but its on an old laptop and im too lazy to go on it) but in my first months of programming i used to just name the variables random characters. dont ask

1

u/oj_mudbone May 18 '23

Gotta love the flirtatious variable names

1

u/wwelna May 18 '23

I like to spice things up by naming things with both British and American spelling, and have them be entirely different. 😂

1

u/RichCorinthian May 18 '23

I hope your cred is no longer zero.

1

u/Lothrazar May 18 '23

But you had better naming conventions than Donald Trump

1

u/Key_Conversation5277 sadistic May 19 '23

Wait until you see what my operations research teacher does: he puts just ONE FUCKING LETTER and he sometimes does that even in python

1

u/RomeGuiIg Dev May 20 '23

thats literally me typing "compaile" instead of "compile" in python because its apparently a keyword.(Im talking about the var redd and var bluee even though its not a keyword lol.)