This is how we get better code AND better coders


Smart but junior programmer is assigned to fix some lower-level issues to give him some experience -- because with more experience, he can do the harder stuff, says a pilot fish on the scene.

"While fixing one issue, he discovered one of several data files encoded in JSON," fish says. "This file was large but actually consisted of a single line."

And that makes it hard for the junior programmer to make sense of the file, which consists of a long series of attribute-value pairs like

"firstName": "John", "lastName": "Smith", "age": 25,

instead of a much more conventional format of

"firstName": "John",
"lastName": "Smith",
"age": 25,

So Junior decides to clean up the mess for good in a very easy way: He runs the file's text through a "beautifier" program, which breaks out each pair onto its own line, but without actually changing the syntax.

Once that's done, he checks the much more readable file back into the repository, and goes on to the next issue on his list.

And everything is fine -- until the next version of the software is released and lots of things start to fail. Senior members of the team are scrambling madly to figure out what's breaking code that hadn't been touched.

After several hours of work, they narrow the problem down to the data file.

"It turns out that the previous junior programmer had seen that the data file was a single line too," says fish. "So he wrote code to read that single line from the file and then stop, regardless of whether the end of the file was reached.

"Junior was instructed to not modify configuration files unless necessary. And his next task was to find all occurrences in the system where JSON configuration files were read, and to make sure that the files were read completely before being processed."

It's like Sharky always says: How do you get good judgment? Experience. And how do you get experience? Bad judgment. Share your experience by sending me your true tale of IT life at You'll get a stylish Shark shirt if I use it. Add your comments below, and read some great old tales in the Sharkives.

Get your daily dose of out-takes from the IT Theater of the Absurd delivered directly to your Inbox. Subscribe now to the Daily Shark Newsletter.

The march toward exascale computers
View Comments
Join the discussion
Be the first to comment on this article. Our Commenting Policies