Class Warfare

by in CodeSOD on

Setting aside cross-browser quirks, CSS is a fiendishly complicated specification. There’s a lot to it. From styling rules and how they interact with the DOM hierarchy, to the complexities of using selectors to navigate the DOM- it’s a complex tool that is also very powerful. I mean, it’s Turing complete.

Shiv works with a self-proclaimed “CSS Ninja”- yes, that was actually in their resume when they got hired. They were hired on the strength of their portfolio- it looked very nice. Unfortunately, the implementation left something to be desired.


A Clever Switch

by in CodeSOD on

Today's anonymous submitter has this to say about this code: "It works fine, it's just... clever."

I'm not certain about the relative cleverness of this solution, myself.


A Right to Remain Ever Conscious Blooms

by in Error'd on

Eion R wrote, "Sure Google Voce, that is exactly what I was looking for."


Tryception

by in CodeSOD on

"If at first you don't succeed, try, try again."

We have all encountered situations where we need to attempt an operation, with full knowledge that the operation might very well fail. And if it does, we should retry it. Usually after a delay, usually with a maximum number of retries.


A Profitable Education

by in CodeSOD on

Today’s anonymous submitter is an experienced Python developer. Their team is significantly less experienced. In the interests of training, someone suggested, “Perhaps we should buy books for everyone.” Our submitter was handed a stack of possible books, and asked to pick the best one to help the team mature.

One book spent some time discussing types, and the conversion between them. By way of example, it provided a handy method which would turn a string into a floating point number:


An Equal Crunch

by in Representative Line on

Rina works in an environment which tends to favor crunch. It's a bit of a feast or famine situation, where they'll coast for months on a pretty standard 9-5 schedule, and then bam, suddenly it's 18 hours days.

No one particularly likes those periods, and code quality takes a nosedive. Co-worker Rusty, though, starts making utterly bizarre decisions when stressed, which is how Rina found this line while doing a code review:


To Round a Corner

by in CodeSOD on

Last week we saw an attempt to reinvent the ceil function. Tina raised a protest: "6 lines to re-implement a ceil function? We can do better."

//Rounds to 1000d Superior public int round1000dSup(int value_To_Round) { int finalResult = 0; int resultIntermediate = value_To_Round / 1000; resultIntermediate += 1; int valueRounded = resultIntermediate * 1000; if ((valueRounded - value_To_Round) == 1000) { finalResult = value_To_Round; } else { finalResult = valueRounded; } return finalResult; }

The Reason is NULL

by in Error'd on

"Turns out that you shouldn’t use your edge browser to download Chrome because of potentially malicious links and...null," wrote Allen B.


Archives