A playground for nerds to geek out on music, movies, TV & more

“Scandal” referenced “code smell,” but WTF does that even mean?

In a recent episode of “Scandal,” the crew of QPA set to work investigating who hijacked Air Force Two while Vice President Cyrus Beene and Attorney General David Rosen were on board. As Quinn, Abby, and Charlie chased different leads to see if Cyrus orchestrated it himself, computer jack-of-all-trades Huck looked into the virus that was used to attack the plane’s systems.

In one scene, Huck announced:

This virus they used to hijack the plane? There is no way the the NSA or any other government agency developed malware with this much code smell. Cyrus must have farmed it out.

It is a passing reference, but here at Pop Culture Experiment, we like to take advantage of teaching moments when they present themselves. Just as “Love, Simon” and RuPaul both provided chances to illuminate some terms, so now does “Scandal.”

“Malware” might be a term you’ve heard before. That is a generic catch-all for intrusive software, like computer viruses, spyware, worms, Trojan horses, and more. You know, bad stuff you don’t want on your computer.

But “code smell” is more of a deep cut. For people who code, play with computers, and so on, it’s a common enough term, but not one you’d expect to hear on a TV show like “Scandal.” I was tickled.

One rather academic article from Italy refers to code smells as “symptoms of poor design and implementation choices.” Another site defines a code smell as “a hint that something has gone wrong somewhere in your code.” Think of a code smell in terms of a stinky fridge. The smell indicates that something is, well, not good.

“Code smell” is used as a generic term, agnostic to specific language, software, library, etc. Huck used it while describing a computer virus, but code used to build a website can also have code smell, as can code used to make an app, code used to scrape data, and so on. In other words, Huck was using it when talking about negative malware, but really, lots of things involving code can have a smell to it.

Code smell does not necessarily mean that the code has a bug, nor does it mean the code will break. The code is not technically wrong, as it will still function. It just means the code is… not good. It’s weak, flawed, inefficient, and probably could be simplified to be better.

Think of code as a recipe. This is an imperfect metaphor, but for the sake of explaining a term to give context to a line in a soap opera, this metaphor will suffice. The act of baking the cake can be the way overall end product runs, whether that product is an app, a web page, whatever. The code — or recipe — instructs the computer, browser, etc. on what to do, how to do it, and when to do it. An efficient code is appealing for the same reason that an efficient recipe is: it allows you to save time and effort on tasks so you can focus on other things.

OK, so an example of a recipe that might “smell,” were we applying that language to recipes for baking, would be a cake recipe that had 37 steps when it could have 10 instead. Or if the recipe asked you to pour 8 quarters of a cup of water into a bowl rather than just pouring two cups of water. Or a recipe that didn’t ask you to preheat the oven until the very last step before baking. Or a code that asks you to mix something by hand, then with an electric mixer, then by hand again. Or a code that asks for six eggs, but has you put the eggs back in the fridge and take them out again after adding each egg to the bowl. It would all still “work,” per se, but it slows down the process, and makes it easier for you to make mistakes.

That’s the gist of “code smell.” The job gets accomplished, but it’s done in a clunky way. It would be like Google Maps telling you to make three left turns when one right one could suffice. Fortunately, there are many resources out there for programmers, developers, designers, and various types of code monkeys. Jeff Atwood, a co-founder of StackOverflow.com, put together this handy guide.

OK, OK, so what does this nerdy reference mean in context of “Scandal”? Now that you have a context for the term, let’s revisit what Huck said:

This virus they used to hijack the plane? There is no way the the NSA or any other government agency developed malware with this much code smell. Cyrus must have farmed it out.

In other words, Huck was confident that no pros who knew what they were doing had touched this code. This was not the work of super-technical spies, which ruled out the possibility of Jake Ballard, B-613, or anyone with any code prowess. In another scene, someone at B-613 suggested that this unsophisticated code could have been intentional, as a way of throwing suspicion. The episode ended with all fingers pointing to… Well, I won’t say, in case you aren’t caught up and still want to watch it to find out for yourself.

And when you do watch it, you’ll now have a context for what Huck said. Of course, you don’t necessarily need that context, but then again, you didn’t necessarily need these covers of Rebecca Black’s “Friday”, either. Or these covers of “Cantina Band” from “Star Wars.” Or these videos of Darth Vader with other people’s voices. Or this ranking of “Melrose Place” characters.