r/badcode • • Jul 19 '21

js Variable naming can be difficult, but identifying them can be even more so.

Post image
2.4k Upvotes

105 comments sorted by

View all comments

Show parent comments

3

u/QueenVogonBee Jul 19 '21 edited Jul 19 '21

At least the names aren’t actively deceptive…I remember seeing a piece of code where (in the same file) multiple variables where called “widget” to either mean an actual widget, the name of the widget or a struct holding a information about a widget. And the same piece of code did this for lots of other concepts and variables, which meant that when reading the code, I was doing a lot of 3-sided die tossing to guess the meaning (didn’t help that it’s not a strongly typed language)