No Hash Map, No Problem (Actually, Big Problem)

No Hash Map, No Problem (Actually, Big Problem)
switch-statement-memes, hashmap-memes, object-lookup-memes, samsung-memes, code-optimization-memes | ProgrammerHumor.io

Whoever wrote this switch statement clearly never heard of a HashMap. They're out here mapping Samsung Galaxy Buds models to their product codes like it's 1999.

Instead of this monstrosity with 10+ case statements, they could've just done: const productCodes = {"Galaxy Buds FE": "R400XX", ...} and then return productCodes[var] || "default";

But hey, who needs elegant solutions when you can write code that scrolls for days? Bonus points for the completely random product codes that follow no logical pattern whatsoever. Samsung's engineers are probably the same people who name their variables a1, a2, a3...

More Like This