Off Color – The Daily WTF

Date:

Share:

Carolyn inherited a somewhat old project that had been initiated by a “rockstar” developer, and then passed to developer after developer over the years. They burned through rockstars faster than Spinal Tap goes through drummers. The result is gems like this:

private void init(){
	ResourceHelper rh = new ResourceHelper();
	for ( int i = 0; i < 12; i++) {
		months[i] = rh.getResource("calendar."+monthkeys[i]+".long");
		months_s[i] = rh.getResource("calendar."+monthkeys[i]+".short");
	}
	StaticData data = SomeService.current().getStaticData();
	this.bankHolidayList = data.getBankHolidayList();
	colors.put("#dddddd", "#dddddd");
	colors.put("#cccccc", "#cccccc");
	colors.put("#e6e6e6", "#e6e6e6");
	colors.put("#ff0000", "#ffcccc");
	colors.put("#ffff00", "#ffffcc");
	colors.put("#00ff00", "#ccffcc");
	colors.put("#5050ff", "#ccccff");
	colors.put("#aa0000", "#ff9999");
	colors.put("#ff8000", "#ffcc99");
	colors.put("#99ff99", "#ccffcc");
	colors.put("#ffcc99", "#ffffcc");
	colors.put("#ff9966", "#ffcc99");
	colors.put("#00c040", "#99cc99");
	colors.put("#aadddd", "#ccffff");
	colors.put("#e0e040", "#ffff99");
	colors.put("#6699ff", "#99ccff");
}

There are plenty of things in this function that raise concerns- whatever is going on with the ResourceHelper and the monthkeys array, for example. But let’s just breeze past that into that colors lookup table, because boy oh boy.

There’s the obvious issue of using server-side code to manage colors instead of CSS, which is bad, sure. But this translation table which converts some colors (presumably already used in the display?) to some other colors (presumably to replace the display colors) is downright mystifying. How did this happen? Why did this happen? What happens when we attempt to apply a color not in the lookup table?

I want to say more mean things about this, but the more I stare at the original colors and what they get translated to, I think this lookup table is trying to tell me I should…


lighten up.

[Advertisement]
Keep the plebs out of prod. Restrict NuGet feed privileges with ProGet. Learn more.

Source link

Subscribe to our magazine

━ more like this

Dutch childcare benefits scandal – Wikipedia

2005–2019 false allegations of fraud This article needs to be updated. Please help update this article to reflect recent events or newly available information. ...

Customer tries to use employee’s tip jar to pay for her order, refuses to leave and starts hassling other shoppers for handouts: ‘I have...

It’s a shame there aren’t any places dispensing reason, because the logic is flawless in its delusion: if you can see the cash, surely...

The Summer Outfit Trend Cool Dressers Are Wearing

As someone who gravitates toward an easy outfit, I look to cool dressers like Zoë Kravitz for inspiration. Her outfits are consistently cool and...

Nordstrom Anniversary Sale 2025 Preview

The Nordstrom Anniversary Sale 2025 starts now for Icon Card Members! The sale runs from July 8th through August 3rd. Nordstrom Cardmembers shop the...

Analog(ue) #239: Did You Not Get Enough of Me

#239: Did You Not Get Enough of Me July 5th, 2025 · 91 minutes There's a lot in this one. This episode of Analog(ue) is sponsored by: Incogni: Take your personal data...