Remy Porter

Remy escaped the enterprise world and now works as a consultant. Editor-in-Chief for TDWTF.

Apr 2017

This Hits an Association

by in CodeSOD on

I recently have needed to write some systems that do analysis on a stream of samples. The target stream of the analysis process was stored in a variable targetOfAnal, because obviously, that’s more efficient to type than targetOfAnalysis. I of course needed an analProcess and analComplete flag, and yes, my inner 13-year old was snickering the entire time.

James’s co-worker decided to demonstrate that immature dirty jokes should only be taken so far. James heard him cursing up a storm, and thus offered to help debug whatever the problem was. You could say this code is hitting the “dirty variable names” button a bit too hard. I present it here without modification, because honestly, there is no way to censor this code and have it convey its full meaning. Ready your alt-tab before the boss comes by:


Identifying the Globally Unique

by in CodeSOD on

UUIDs, aka GUIDs are, well… unique. Unique identifiers. It’s right there in the name.

Active Directory needs to identify things. Thus, it uses GUIDs. “Omni’s” co-worker got this far, but then ran into a problem. If you print a GUID from AD, it looks like this: “35918bc9196d40ea9779889d79b753f0”, but if you print it from C#, it looks like this: “35918bc9–196d–40ea–9779–889d79b753f0”. Whatever is a programmer to do when dealing with these radically incompotible formats?


ByteBool

by in CodeSOD on

Tony Hoare has called null references his “billion dollar mistake”. Dealing with nulls and their consequences have created a large number of bugs, and eaten a lot of developer time. It’s certainly bad enough when you understand nulls and why they exist, but Benjamin Soddy inherited code from someone who absolutely didn’t.

First, there’s our new type, the ByteBool:


When Computers Fly

by in Feature Articles on

In the Before Times, the Ancients would gather in well-sheltered caverns, gather to themselves foods blessed by the gods, drink strange, unnaturally colored concoctions, and perform the Rite of the LAN Party.

In the era when the Internet was accessed by modem, to have any hope of playing a game with usable latency, you had to get all the players in the same place. This meant packing up your desktop in a car, driving to your friend’s house, and setting up your computer on whatever horizontal surface hadn’t already been claimed by another guest.


print_a_idiot()

by in CodeSOD on

Cédric runs the backend for a video streaming service. Since video streaming, even in modern HTML5, is still a bit of a mess, they have to be able to provide many different stream formats. So, for example, the JSON data might look like this:

{"DASH":"https:\/\/anonymised-wtfdash.akamaihd.invalid\/path\/to\/film.mpd",
"HLS":"https:\/\/anonymised-wtfhls.akamaihd.invalid\/path\/to\/film.mp4\/master.m3u8",
"PD":"https:\/\/anonymised-wtfpd.akamaihd.invalid\/path\/to\/film.mp4"}

A Piece of the Variable

by in CodeSOD on

In the Star Trek episode, “A Piece of the Action”, Kirk and his crew travel to Sigma Iotia II, a planet last visited before the Prime Directive of non-interference existed. Well, they left behind a book, Chicago Mobs of the Twenties, which the Iotians took as a holy guide, to be imitated and followed even if they didn’t quite understand it, a sort of sci-fi cargo-cult. Cue the crew of the Enterprise being threatened with Tommy Guns and guys doing bad Al Capone impressions.

Michael’s co-worker may have fallen into a similar trap. An advanced developer came to him, and gave him a rule: in PHP, since variables may be used without being declared, it’s entirely possible to have an unset variable. Thus, it’s a good practice to check and see if the variable is set before you use it. Normally, we use this to check if, for example, the submitted form contains certain fields.


An Extinction Event

by in CodeSOD on

Microsoft’s C# has become an extremely popular language for “enterprise” development, and it’s sobering to think that: yes, this language has been around for 15 years at this point. That’s long enough for the language to have grown from a “sort of Java with reliability, productivity and security deleted.” (James Gosling, one of the creators of Java) to “sort of Java, but with generics and lambdas actually implemented in a useful way, and not completely broken by design”.

15 years is also more than enough time for a project to grow out of control, turning into a sprawling mass of tentacles with mouths on the ends, thrashing about looking for a programmer’s brain to absorb. Virginia N is currently locked in a struggle for sanity against one such project.


Cerebral Flatulence

by in Coded Smorgasbord on

There’s plenty of bad code that makes you ask, “what were they thinking?” There’s a whole bunch of code we get, however, that doesn’t even raise that question- the programmer responsible simply wasn’t thinking. Today, let’s examine a few “programmer brain-farts”. We turn our attention first, to Jim C.

While reviewing some unit tests, he found this line: