Code is Tricky, Part 1: Dead Code

Every software expert at Quandary Peak regularly reads and analyzes large volumes of source code, and while understanding the specific programming language can help, it’s not the only skill we bring to a project. Knowing the unique qualities and nuances that apply to programming code can be the difference between winning and losing a case. In this eight-part series of posts we’ll describe a few of the unintuitive aspects of source code that experts have to keep in mind when working on your case.

What is dead code?

Dead code is source code that is present in the program but doesn’t actually get used by the program. It’s not uncommon for a software product to have hundreds of thousands (even millions) of lines of code, and not all of them are used every time they’re run. Essentially, there are two situations which can result in dead code: one, if a condition required to run a piece of code is never fulfilled, or two, if the program provides no execution path into the code. In both cases the code exists in the program, but the program never executes it, resulting in dead code.

Unsatisfied conditions

For the first situation, here’s an oversimplified example to illustrate the mechanism:


Code can be dead because of unsatisfied conditions

Above, if the $DAY_OF_WEEK variable has the value of “Monday” or “Friday”, either the complain_about_work or the make_dinner_reservations method will run. The method infringe_valuable_patent will never run because there’s no such day as “Kronsday”. Because the condition to execute the patent-infringing code will never be true, the infringe_valuable_patent method will never run; it is dead code.

No route to execution

With just a small change we can illustrate how the second situation that causes dead code happens:


In the above example, we have a definition for the infringe_valuable_patent method; that is, we have the code that would run if we could execute the method. But there’s nothing in the logic of the program that actually in fact tells the method to run, so it never runs. If that’s not clear, consider the example of a connect-the-dots picture; think of the main program as dots 1 through 50, with the dead code dot starting at 100. Without dots 51 through 99, so you will never get to dot 100. So whatever part of the picture you might see using the dots from 100 on up will never get drawn.

Dead code and software patents

Understanding dead code has special importance for software patent cases because infringement exists only if the program performs the claimed invention. It’s not enough for the code to merely be present; it must also be executed. Quandary Peak regularly creates detailed code execution traces that show precisely what code is run under what conditions, which is essential for proving (or defending against) infringement. Contact us at, tell us about your case, and we’ll help you understand the best way to move forward.

Jason Frankovitz

Jason Frankovitz has been in the trenches of software development for over twenty years. He is an expert in Web and mobile technologies, virtualized and cloud-based computing, and software programming methodologies and best practices.

Leave a Reply