Recent Articles

Jan 2013

The Biggest Boon-Dongle in the World

by in Feature Articles on

Telecommunications manufacturing is a cut-throat business. Features, functionality and hardware need to be added and continuously improved at a frenetic pace in order to stay one step ahead of the competition. Engineers must constantly increase their skills to leverage the latest advances in technology to design and build the best product possible at the lowest cost. Slip up just a little, and it can be a death knell for your company.

To save costs, Dog and Bone Corporation (DNB) had eased up on their latest-and-greatest push. Budgets shrank. Progress on adding new features slowed. Hardware upgrades failed to happen. Meetings to justify every little thing began to become the main task in everyone's day. Competitors leapfrogged. Interest waned. Unfortunately, this caused their flagship private telephone exchange (DBX) product to start to stagnate and made some of the engineers begin to feel that their skills were getting to be a little out of date. Engineering-eyes began to wander.


Reusable Code

by in CodeSOD on

Code reuse is one of the key steps to maintainability. There are many ways a developer might make their code reusable. For example, Steve’s co-worker wrote this block, which generates 1000 log entries:

int next = 0;  

List<FeedSearchTransactionLogResult> allDataSimulated = new List<FeedSearchTransactionLogResult>();  

allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));  
allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));  
allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));  
//SNIP skip 995 lines…  
  
allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));  
allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));  
allDataSimulated.Add(new FeedSearchTransactionLogResult(next++));

Scheming Schema

by in Feature Articles on

Adam worked for a moving company. When he joined up, it was a regional enterprise with several locations and a surprisingly large fleet of trucks. One day, he came to work to learn that he now worked for a much larger, national company, called ConHugeCo. Nobody was getting fired, but now Adam had to get their data integrated with ConHugeCo’s.

ConHugeCo had a fat middleware tier built in WebSphere MQ. Like any true enterprise solution, everything was glued together by XML, and that meant Adam built many small programs that pulled data from legacy systems and spreadsheets and mashed it into XML files, which were then shipped off to the MQ system. Adam had the HR and insurance data synced within a few days, but when it came time to sync their loadouts for moving large items, things started to get weird.


You’ve Got to Give to Retrieve

by in CodeSOD on

It was a dark and stormy night. The kind of night envisioned by Mr. Bulwer-Lytton when he penned his infamously bad opening sentence, but the weather was not a deterrent to Craig. Craig faced a task more daunting than mere lightning and rain. He was on the trail of an annoying bug and was determined to track it down come hell or high water (a possibility made more real given the weather).

How Craig came to this point is not unfamiliar to anyone who writes code. It was the last day of the sprint, in fact, it was more like the last hours of the sprint. He had been struggling mightily against the whims of programming fortune all day (and into the evening) trying to stamp out the final stubborn bugs in a feature that was his responsibility. A feature that, if it wasn’t delivered, would mean a failed sprint for the entire team.


Hey Kids, Don't Smoke in the Rain

by in Error'd on

As a parent, I'd prefer the middle choice in this one that Kevin G. sent in. It's large enough to block the elements and sends a powerful message to the kids.


The Sysadmin's PC

by in Feature Articles on

“Hey, can you give me a hand? This computer I built won’t boot.”

Alexander sighed, and went to see what Nicholas had done now.


De-Populate Dates

by in CodeSOD on

"That was call seventeen about the sales logger," said Jeff, "The dates are all mangled. Nothing’s getting logged. We need to escalate."

Tabitha, Jeff's supervisor, furrowed her brow. "Oh, we can’t escalate until we get eighteen complaints," she replied very matter-of-factly. Her sense of humor was so dry Jeff could never guess when she was kidding.


Too Much Sleep

by in Best of the Sidebar on

I've frequently posted about my attempts to speed up our system being thwarted by sleepy management decisions about application performance. Our application is essentially: query data, crunch data and save results. Each of those tasks took approximately 1/3 of the run time. A large part of my job is to make the application run more quickly. Every time I fixed something, something else would break, not because I coded something incorrectly, but because of the fragility of our application, other associated applications and the database. For instance...

Sleep for the database

We run four instances of our application. We also perform about 30 load-data queries. Most of them query tables with 3+ billion rows. If all four instances of the app do queries at the same time and each query is run in its own thread, that's 120 parallel queries just from our application server instances. The database simply could not keep up. The original developer created five threads for thirty parallel queries. Then, to add insult to injury, he added sleeps after each query (in each thread) to give the database a chance to catch up. Part of the problem turned out to be that the DBAs only allocated 512M of temp space for all users. They refused to fix it.

Sleep to cool the cpu's


Website WTF - Asus Transformer Book

by in Feature Articles on

Creating websites so that they display the same on all browsers and platforms for all vendors is tough business. Designers aim for "One size fits all" but sometimes, even with the best of incantations, "One size fits most" is the end result.

Case in point, Eric's simple goal: learn more about Asus' Transformer Book. All that he wanted to do was to pull up http://transformerbook.asus.com/ on his Ubuntu laptop and marvel at the dynamic animations and glitzy transitions between product features but instead all he got was a screenful of ugly. No text styling, a couple of images, but mostly just blah-looking plain text.


I'm not Null, I'm a Human Being!

by in Error'd on

"Xfinity's website seems to think that I'm 'null'," wrote Jon Klein, "I tried to change that by creating a new username but instead got stuck in an endless loop."


Comments

by in Coded Smorgasbord on

Comments are a vital part of making code readable, but they’re more than just documentation. They’re communication between one developer and another. They tell us what the code does, but also how we feel about it.

Scott found this, which conveys a most fervent hope for this block of code:


I.S.O. is for L.O.S.E.R.S.

by in Feature Articles on

Map"You ever seen one of Arnold Schwarzenegger's speeches?" Alan's new supervisor Tessa asked as she led him to his new office at BigTelCo.

"Can't say I have," Alan replied.


A Forest of Trees

by in CodeSOD on

Our system was written by neophyte troglodytes who didn't follow standards of any kind. They coded whatever they wanted, however they wanted, whenever they wanted, wherever they wanted. Usually via copy/paste/plagiarize.

In particular, we have a class called Tree. More accurately, there are 18 (yes, that's e-i-g-h-t-e-e-n) Tree classes; one each for: char, byte, short, int, long, float, double, Character, Byte, Short, Integer, Long, Float, Double, String, BigInteger, BigDecimal and Object[]. One might think: Hey! Let's use generics: Tree<T>. Nope! Each one is needlessly just a little bit different. Some implement the same methods with different types. Some have methods with completely different implementations to do the same thing. Some use completely different names for the same methods. Sometimes, the methods are identically named, and the parameters are the kind that can be auto-up-cast (e.g.: short -> int):


The Curse of the Night of the Ticket That Wouldn't Die

by in Feature Articles on

“232632, in the flesh. I’ve waited a long time.”

Matt started at the voice over his shoulder. He turned to find a college-age girl at the threshold of his borrowed cubicle, with an intense and nearly crazed look in her bloodshot, bag-laden eyes. Matt had no idea who she was.  That was true of most of the people in this office. He was a roving consultant, who had arrived earlier that morning on one of his semi-annual onsite visits for software training and support.


Sponsor Appreciation, You Seem Strangely Distant, and More Error'd

by in Error'd on

TDWTF Sponsors

JRebel Logo   JRebel is a JVM-plugin that makes it possible for Java developers to instantly see any code change made to an app without redeploying. JRebel lets you see code changes instantly, reloading classes and resources individually and updating one at a time instead of as a lump application redeploy. Download your FREE Trial Today!
Inedo   Inedo - the makers of BuildMaster, the free, and easy-to-use, web-based deployment and release management tool. Going far beyond Continuous Integration and into Continuous Delivery, BuildMaster delivers a series of robust features unparalleled by other build-promote-deploy-distribute tools.

And now back to our regularly scheduled program...

 


Who Needs Connectivity? I Have Service!

by in Feature Articles on

Jim worked in the IT department of a university and one of his many jobs was maintaining the dial-up system.

Yes, that's right. Dial-up.


InsertSql()

by in CodeSOD on

Data-driven applications need to generate SQL from time to time. Usually, we leverage things like stored procedures or ORM tools to keep our code sane, but from time to time, we might hard code our SQL statements. You sacrifice some flexibility for some transparency into what your code actually does to the database.

Sometimes, however, writing SQL is just too darn readable. Adam’s co-worker has a better way:


Color Me Stupid

by in Feature Articles on

Andy's company develops solutions for "Industrial" handheld devices. To make deployment and updates easier, they each run a thin client so only the server is different from project to project. This client was written by a long-gone employee in the early nineties, and had barely changed since because it "just worked". Updating it was discouraged for fear of breaking backward-compatibility.

Andy's new project was the first chance he'd had to use it, so he asked a colleague if there was some code that could be used to interface with it. What Andy received was essentially a giant method which responded to the client by cycling through a switch-statement to decide what to paint next based on the current state of the client. Andy took the initiative to create a library for making servers for these things a bit less spaghetti-like, and to encourage this new-fangled concept of code-reuse.


Divide and Validate

by in CodeSOD on

In IT, what many developers mistakenly consider to be magic code or evidence of elite (aka "L337") hacker-type abilities actually turns out to just be some cleverly applied math concocted by a developer who chose to think outside of the box.

Take into consideration the following code that Piotr Kaminski submitted. I have no doubts that it validates user information just fine, but the fact that it does so by adding booleans and division is a new one for me.


Not the Sharpest Blade in the Data Center

by in Error'd on

"Not the sharpest blade in the data center...if you know what I mean," wrote Sam C.


Slow Down, You Click Too Fast

by in CodeSOD on

You know what really gets to me? People who open links too quickly. Haphazardly opening new tabs all over the place...it really grinds my gears.

Ok, I've never thought that, but apparently somebody did when they added the code that Jonathan Peppers found in an abstraction layer for System.Windows.Forms.WebBrowser.


Check the Check Printer

by in Feature Articles on

There was nothing unusual about an unusual ticket. Matt worked helldesk at an assembly plant, and not a week went by without some confusing brain-bender from his users. He didn’t blink when he received this ticket:

We’re having an issue with our check-printer. Every time a user logs on, it prints out an inventory of electrical parts dated from 1984. On our checks. This is causing some accounting issues.