Bruce Johnson

Serendipity

by Bruce Johnson
in Feature Articles
on 2014-11-06

Given the title, most of you are expecting a story that goes as follows: Boy meets girl. Girl writes phone number inside a book in a used book store. Ten years pass and boy searches for book. Boy finds book and gets girl. But not this time. Instead, Andrew is the source of a story that ranks much higher on the believability scale.

Andrew's father worked for SmallishNicheCo where, like many small companies in the early 1990s, the sum total of IT knowledge was non-existent. Every problem and request was passed to an outsourced help desk, which in the tradition of solid customer service for which IT help desks have become renown, could take up to 3 days to acknowledge receipt much less dispatch a person to solve the problem. If you needed to have the brightness on your monitor adjusted, you were looking at 5-7 days. And that was after passing the gauntlet of questions to ensure the problem was 'real' (Is your computer plugged in? How about your monitor?)

We Don't Need no Stinking Elses

by Bruce Johnson
in CodeSOD
on 2014-10-13

We've all seen it before. I dare say we've all been a party to it.

First, we look at a block of code that needs to be modified. Then we determine which criteria needs to be added to address the case that we've been tasked to implement. Next, we add the condition and walk away before the waft from the code smell reaches our nostrils. Over time, a monstrosity like the following arises from the depths. Not something that couldn't be greatly improved by some fava beans and a nice refactor. I'm sure the unit tests that cover your production code base will ensure that your refactoring was successful. Right? Right??

Going Out of Style

by Bruce Johnson
in CodeSOD
on 2014-09-23

The process of optimizing the CSS used in a web site can be quite complicated. The subtle interplay between selectors, attributes, specificity, inheritance and the DOM elements can significantly impact the outcome. Style guides can be a thing of elegant beauty, to be admired by many and revered by those steeped in the dark arts of styling.

There there's the code that George found when he took on the task of migrating a 1990's-era web site. Nobody expects code from a 15 year-old web site to be up to current standards. But there are limits. George's spidey sense started tingling when he found a file named 'css.php'. A look inside didn't do anything to turn the alarm bells off.

Feeling Validated

by Bruce Johnson
in CodeSOD
on 2014-09-04

Ugh...Address validation. Take some address strings, add to that a city, state, postal code, and country... make sure they are are all look syntatically 'valid' based on some business logic - it's not as easy as we'd hope to be able to handle EVERY possibility. But, no matter WHAT you come up with, I can guarantee that it's guaranteed to be much easier to digest than the block of validation code discovered by Mickey.

According to Mickey, there are a couple of special rules for this address validation that result in some of the WTF-ness. If an address is changed, and it's "close" to existing address, then the user needs to be prompted to confirm the address. And this prompt shouldn't take place unless the address itself has been changed. Wanna bet that the user specification for 'close' included the phrase 'you know what I mean'? That's probably the reason why the code doesn't actually address the idea of 'closeness'...the developers are still waiting for the definition.

Issue History

by Bruce Johnson
in Feature Articles
on 2014-08-28

Ladies and gentlemen: the story you are about to read is true. Only the names have been changed to protect the innocent. The guilty are too obtuse to recognize themselves in the story, even if their names hadn't been changed.

Playing the part of Alex in this story is you. Your current employer is a stock fund. Your current engagement: to work on FLASH, the in-house developed stock trading system. That's 'stock', the financial instrument, not 'stock', the live kind you find on farms.

Too Much of a Bad Thing

by Bruce Johnson
in CodeSOD
on 2014-08-07

The question of whether you should include in-line comments in your code is a running one in the development community. To some, they are part of the process of ensuring the ongoing maintainability of a codebase. To others, comments are the spawn of satan, lower than cockroach droppings, or slightly above a Justin Bieber song.

Regardless of where you fall on this spectrum, it's reasonably certain that the following isn't considered 'acceptable'.

Limited Options

by Bruce Johnson
in Feature Articles
on 2014-07-23

Security is challenging to get right. It's always a complex balancing act between what users want and what administrators need. Between placing the server in a hermetically sealed container with no cables running the outside world, and setting the server up on the busiest street corner in town with an already logged-in administrator account pulled up on the attached monitor. Depending on the O/S update policy in practice at your company, that last example can be roughly the equivalent of connecting your server to the Internet.

Here at TDWTF, security is a common topic of submissions. If only because there are so many different (and creative) ways to set things up that are wrong and only a couple of ways to set it up that are correct. And there is a non-zero percentage of administrators that are, shall we say, less than diligent in how they go about their job. We're sure that none of you fit into that category. We're talking about other people.

Code Abuse

by Bruce Johnson
in CodeSOD
on 2014-07-07

A client of Jim's with a WordPress site had been having performance issues that were off the scale bad. Slower then a snail on Valium. Slower than a herd of turtles rampaging through a molasses factory. Worse than that, the actual in-browser rendering was taking significantly longer than any benchmarking tests would lead you to believe. Even massively loaded benchmark tests had a better rendering time. And the client's browser's weren't massively loaded.

After investigating a number of avenues, Jim decided to migrate the site to newer, faster infrastructure. The older machines were due for a refresh anyway. And the newer infrastructure would be on Ubuntu Precise, whereas the older was Lucid. So, as a bonus, the client got a free upgrade! Free as in beer.