36

I'm a software engineer. There are many times when I write a good chunk, or even the entirety of, a feature, but opt not to make it actually run in the program for some reason or another. This code is still there, and could theoretically work, but it never will because it's inaccessible.

What's a good one-word term for such code? I want to use it, or a form of it, like this:

"This is ______ code."

"I am going to ______ this code".


Terms I considered (but don't seem to fully-convey the purpose) include:

  • frozen/freeze (implies it causes the program to freeze?)
  • isolated/isolate (implies it can be run in some isolated environment)
  • vitrified/vitrify (implies it's changed to something else and can't change back)
  • fossilized/fossilize (implies it's old and broken and should only be observed. Same problems as vitrified)
Ky -
  • 1,014
  • 13
    Don't use your first example of "frozen". I would interpret "frozen code" to be code that will definitely not be changed in the future. – James Apr 14 '16 at 17:37
  • 2
    @James As a programmer, "frozen" immediately brings to mind horror stories of applications that refuse to run or terminate for hours on end. I would definitely not use that term to describe code that cannot run. – Zibbobz Apr 15 '16 at 14:47
  • 5
    As an aside, there may not be strong consensus on how to name this tactic, because there is widespread consensus that leaving unused code laying around is a bad idea.

    Reading between the lines, what you are doing might be a first step towards "branch by abstraction." See http://martinfowler.com/bliki/BranchByAbstraction.html for a longer explanation. I strongly recommend you investigate this or other alternatives if you find yourself "many times" writing code that is not called anywhere.

    – GrandOpener Apr 15 '16 at 16:53
  • 3
    It would probably be code that is just about to be deleted — oops, no, it is code that has just been deleted in the version control system. I might label it first so it is easier to find again later. One system I worked on had some code deactivated by #ifdef POST_JUNE_DEVELOPMENT. I was never sure whether that was June 94 or June 95, but it never happened (was never activated) and I removed the code in 2010. – Jonathan Leffler Apr 16 '16 at 14:23
  • For years i've kept a folder handly where I put just such code because I do the same thing. I don't want other coders looking at it because it would clutter the code base. But I worked hard on it and don't want to let go without the possibility to retrieve it. Long ago I named this folder "Junk code". I occasionally salvage something from it but it's primary function is to allow me to let go. – candied_orange Apr 17 '16 at 16:30
  • 2
    Doesn't source control let you go find it later...? – nhgrif Apr 17 '16 at 22:21
  • "bug-free" code? ;) – joshcomley Apr 18 '16 at 02:53
  • 1
    I would really just use "unused code" here, but I'm not a professional software engineer. Can anyone comment on if that would be a good/bad term? I don't think it's really frozen, or really unreachable, but it is definitely unused. – daboross Apr 18 '16 at 03:53
  • 1
    A bit off-topic, but why would you do that? If I find that kind of thing and there's no useful explanation for it in version-control history or comments/documentation explaining why it's there, I delete it. It's bloating your repository, obscuring bug-hunting for maintenance-programmers who don't know you just parked that code, and if it's not reachable you cannot create tests for it, obscuring your test coverage reports. It's also a waste of resources to create something that is never used. Imagine a cook in a burger place making an extra box of sushi because we might need it at some point. – simbabque Apr 18 '16 at 08:13
  • @simbabque That's the inspiration for this question! There's a huge chunk of the program I have just barely completed, but we don't have time to QA it this release, so I have to make sure it doesn't run in production. Instead of just doing so and not specifying, I want to leave comments all over it saying "This was _____'d on purpose 2016-04-14, to be un-_____'d and completed on the following release." – Ky - Apr 18 '16 at 15:18
  • dormant code perhaps? – A.Ellett Apr 19 '16 at 07:20
  • @A.Ellett That's more of an answer than a comment :) – Ky - Apr 19 '16 at 18:32
  • @BenC.R.Leggiero I have been in that same situation, with a huge chunk of code just completed that is not ready to ship. That's what branches of source control are for. I might put a few comments on the main branch in the places where the new code would have been used explaining what the code would do and where to find it, and then I would say I had "set aside" that code or "put that code on a branch". Any of the answers below (so far) seem to cover only one or two aspects of what you want to do while leaving important parts (e.g., that it was intentional) unexpressed. – David K Apr 20 '16 at 13:23

24 Answers24

88

It's called unreachable code.

"Unreachable code" is different from dead code, dead code is code that when executed will result in no change, for example:

x = 5;
/* Dead Code Begin */
x = 6;
x = 5;
/* Dead Code End */

Unreachable code however is code that e.g. in a function that is not referenced anywhere, or code that is after the return clause of a function, this code is present, and theoretically compiled, but can never be "reached" to be executed.

Edit:

Many are claiming that this is not the correct answer and it is not cited anywhere, even though I see wikipedia's distinction is enough, I will quote MISRA C 2012:

Section 8.2 Rule 2.1: A project shall not contain unreachable code

Rationale

Provided that a program does not exhibit any undefined behaviour, unreachable code cannot be executed and cannot have any effect on the program's outputs. The presence of unreachable code may therefore indicate an error in the program's logic.

Then the rule directly after that:

Section 8.2. Rule 2.2: There shall be no dead code

Aplification

Any operation that is executed but whose removal would not affect program behaviour constitutes dead code.

.

.

.

Note: unreachable code is not dead code as it cannot be executed.

And before someone comments that it is saying it is a mistake and not intentional, MISRA exists exactly so that when you break one of its rules you justify why you did that and that it is intentional, otherwise the violation should be removed, but it does not change the definition of what is unreachable and what is dead code.

Mystic Odin
  • 1,180
  • 1
  • 7
  • 15
  • 2
    @ Mystic Odin How does one unreachable code blocks? The OP wants a verb and adjective pair. – Phil Sweet Apr 14 '16 at 19:22
  • 5
    This is the correct answer. Unreachable code is well understood within Computer Science and programming circles. – minseong Apr 14 '16 at 22:03
  • 19
    @theonlygusti - I don't believe this is the correct answer. Unreachable code would be code that cannot possibly run. But a function that is never used anywhere is an uncalled function, not an unreachable function. – TTT Apr 14 '16 at 22:23
  • 10
    @TTT if it's never called, that code path is unreachable during execution. It might not be as correct as referring to code within an if (false){} block, but it's a fairly common use of the term. – Morgen Apr 15 '16 at 02:20
  • 4
    @PhilSweet then he would use I am going to make this code unreachable, I wanted to give an answer with a technical term that is clearly understood by the computer science/programming circle. – Mystic Odin Apr 15 '16 at 09:49
  • 4
    @TTT the code inside the function is unreachable, the function is unreferenced, I'm a software developer and these are some of the few terms that were not changed in meaning across several domains and companies in which I worked. – Mystic Odin Apr 15 '16 at 09:51
  • It's certainly the word that I've always used as a developer. Inserting a random line of code after a return statement brings up a warning from Resharper (a code analysis tool) that reads "Code is unreachable". I don't think that "Code is unused" or "Code is excluded" would be as meaningful in that context. – BrummiePete Apr 15 '16 at 10:09
  • 2
    While I agree that unreachable or dead is the correct term for the code. The conscious act of making the code unreachable usually work on a better defined segment off code, unreachable code can be for several other reasons. Ie. I would say "The feature/module/method/case is disabled" - One could combine the two consepts in the sentence "That code is unreachable because I disabled feature xyz". – Taemyr Apr 15 '16 at 11:20
  • @MysticOdin - I agree with the term unreferenced, but not unreachable. In fact, if you changed your answer to unreferenced I would argue it is correct. The way I see it, there is a big difference between Morgen's example of if (false){}, which is unreachable and SomeUnreferencedFunction() that it is not called from anywhere. The former will be marked "unreachable" by the compiler, the latter will not. And my understanding is the latter is what the OP is asking about. – TTT Apr 15 '16 at 14:04
  • @TTT if (false){} is a rather forceful example, and indeed will be removed by most compilers if you enable optimization, but unreachable would also apply for if (global_var == True) { /* some code */ } if this variable never takes the value True, and this will not be removed by the compiler, while unreferenced functions will be removed by linkers. The thing is you do not know how the code will be rendered unreachable, but if it is compiled and never executed it is, in all cases, unreachable. – Mystic Odin Apr 15 '16 at 14:26
  • 1
    I would definitely not call your example "dead code"; it might get optimized out, but it still effectively runs. Dead code does not run. "Superfluous" or "unnecessary" is better for that example. – Izkata Apr 15 '16 at 15:13
  • @Izkata the difference between dead code and unreachable code is exactly that dead code runs, please read this, or this or google dead vs. unreachable code – Mystic Odin Apr 15 '16 at 18:14
  • 1
    Though this is probably the best answer so far, consider connotation. In general, "unreachable code" is understood to have been made unreachable accidentally. It might be a good idea to specify that it's intentionally unreachable. And just my two cents as a programmer, you should probably comment it out. – Devsman Apr 15 '16 at 19:52
  • 1
    Because I can't post an answer, I'll just leave a comment. Where I've worked, if something has been developed, but locked behind a flag of some sort, we call that feature "dark". For example, we had a plan of moving from one API to another, but other teams were not ready for it yet. So we developed everything on our end, but hid it behind a "should use the new api" flag. When the other teams finished, we set the flag to true, and the feature wasn't dark anymore. –  Apr 15 '16 at 20:28
  • 2
    I also agree that this is not the right answer. Unreachable code is generally considered a bug, a piece of code that should be reached, but is not because you messed up an early return or something. – Tom Apr 16 '16 at 08:55
  • @Tom it is always bad to leave unreachable code, whether the code is intentionally unreachable or not, you can check the comments on the question itself for that. and I agree that unreachable usually carries the meaning that it's a mistake, like Devsman wrote earlier it might be better to specify that it's left intentionally unreachable. – Mystic Odin Apr 16 '16 at 21:46
  • This answer is NOT correct! Dead code is code whose result is never used (see the wikipedia page linked in the comment by @MysticOdin). If the result of the example code is never used, all three lines are dead code. If x is used afterwards, the first two lines might be considered dead code since strictly speaking only the last assignment has an effect (not the first one). – anderas Apr 18 '16 at 07:26
  • I'd even go as far as to argue that unreachable code is unnecessary and should be removed. If it's not reachable, you cannot test it, and thus cannot maintain it. – simbabque Apr 18 '16 at 08:06
  • @andreas yes if x is not used later then all 3 lines are dead code, I was trying to be abstract about it. what characterizes dead code is code that runs but has no effect on the logic of the program, not using the result of an operation is dead code, an unnecessary cast is dead code, *p++; is partially dead code because you're dereferencing the pointer without using the value inside and then incrementing the pointer, you could simply do p++;, and the list goes on, it does not mean that my example is not correct. – Mystic Odin Apr 18 '16 at 08:10
43

Since the code is inaccessible, most compilers will eliminate it through Dead Code Elimination, or DCE. So you can refer to it as dead code, or simply dead.

Nullstone's compendium of compiler optimizations defines dead code as

Code that is unreachable or that does not affect the program (e.g. dead stores) [and] can be eliminated.

Since the code is apparently not going to be run, you can also say it is excluded from the build. So, to complete your sentences:

This is excluded code.

I'm going to exclude this code.

Gnawme
  • 40,887
  • 4
    It really depends on what sense "inaccessible" is meant in. If it's that "you can't get here unless you enter this special code that normal usage will never reveal", then it won't be eliminated as dead code. Then it's more like hidden content (or "unexpected liability" :)). – Joshua Taylor Apr 14 '16 at 18:47
  • 2
    Surely a dead code elimination tool cannot actually identify eliminate all dead code. Therefore, just because a DCE tool doesn't identify it, doesn't mean it's not dead code. (And the corollary, just because a tool identifies something as dead code, doesn't prove incontrovertibly that it's dead. A specific example, I have worked on a class that was used for deserializing the response from a third party web service. ReSharper identified some of the properties as "unused" but they were needed to properly parse the response, even though we didn't use the results in our own code.) – stannius Apr 14 '16 at 20:09
  • 1
    Great points, and I suppose going back to attach the code so that it runs would be like "resurrecting" it, and probably comes with just as many side-effects as resurrecting a corpse ;) – Ky - Apr 14 '16 at 20:10
  • 2
    @stannius Right, the uncomputable nature of the halting problem means any automated dead code elimination (DCE) algorithm cannot be perfect. A properly implemented dead code elimination will err on the side of caution and produce an approximation which is an underestimate of all the dead code in the application. In other words, there will be cases where some dead code is not eliminated for safety. There's some complex mathematics involved in working this out (based on lattice theory) but the core principle is that an optimisation should never affect observed program behaviour in any context. – Cosmic Ossifrage Apr 14 '16 at 20:17
  • 1
    @stannius The OP was looking for a somewhat standard term to apply to code that wasn't going to be run, or even necessarily compiled. Dead code seemed to fit the bill. – Gnawme Apr 14 '16 at 20:43
  • 1
    @Gnawme Sorry, should have @-ed Joshua in my comment. I do agree that "dead code" fits the bill, although given that the code was never alive, I might use "unborn code" if it didn't sound so creepy. – stannius Apr 14 '16 at 21:13
  • 4
    Note that dead code and unreachable code are two slightly different concepts. – Tobia Tesan Apr 14 '16 at 22:44
  • 1
    You are not exactly correct in using this term, I'm telling you as a software engineer. Dead code is a section in the source code of a program which is executed, but whose result is never used in any other computation. Excluded code, means the code which is not taken into account, which is also not describing the purpose of OP. – Farside Apr 14 '16 at 22:50
  • 4
    @TobiaTesan It depends on the context. "Dead code" is absolutely used to refer to unreachable code in informal contexts. Despite lacking a citation on Wikipedia, this usage is pretty common. – jpmc26 Apr 15 '16 at 02:08
  • 1
    @Farside The link in the answer defines dead code as "code that is unreachable or that does not affect the program" and thus can be eliminated by the compiler. If it's not there, it cannot be executed. Most modern IDEs allow you to exclude one or more files from a build, which also results in the code not being executed. (I've been a SW engineer for over 20 years, BTW.) – Gnawme Apr 15 '16 at 05:28
  • 2
    It's not correct to say that since the code is inaccessible most compilers will eliminate it [from the compiled version]. IMO it depends so highly on how it was made inaccessible that the only reasonable estimate of how many compilers will eliminate it is 50% and an even better estimate is no estimate. F.ex. if it's made inaccessible by enclosing it in a conditional statement based on a variable instead of a constant very few compilers will still figure out that that variable is never written elsewhere and so consider that code inaccessible. – SantiBailors Apr 15 '16 at 09:11
  • 2
    @jpmc26 "Dead Code" is wrongly used to refer to "unreachable code", a common mistake but the terminology is exact, Wikipedia is not perfect, this question is asking the same, I would cite MISRA 2012, however; the standard is not open online but if you have access to it check rules 2.1 and 2.2 under section 8.2 Unused Code. – Mystic Odin Apr 15 '16 at 10:10
  • 2
    @MysticOdin That only holds if you take a presciptivist perspective of language. The fact is that "dead code" is used this way in the wild, so to speak. – jpmc26 Apr 15 '16 at 18:02
  • 2
    @jpmc26 if you mean that a term being used in the wild automatically makes it ok to use it, then it's no problem that people use was instead of were all the time, or that they use effect and affect interchangeably, or even that they use Indians to refer to native Americans.

    If you are saying that this is only if I look at from the perspective of software development/computer science terminology or proper use of terms, then what is the other relevant perspective here?

    If you mean something else, please tell me :)

    – Mystic Odin Apr 15 '16 at 18:20
  • @MysticOdin It's based on likelihood of confusion. In informal contexts, they typically don't make a difference. (If your peers are educated, they would expect standard grammar most of the time, but mistakes happen. In some contexts, those variations are on purpose; think of a bunch of low economic class kids on the street.) Obviously, if you're writing a peer reviewed paper about these kinds of code, you want to be precise. When I'm talking to the developer who sits next to me or my manager who isn't even technical, then yes, it is fine. There is unlikely to be any confusion in these cases. – jpmc26 Apr 15 '16 at 18:34
39

RTCA DO-178C - the standard for safety critical code in aircraft - uses the terms "dead code" for code that is never reached in any path through the code. The term "deactivated code" is for code that is deliberately never used in a particular configuration, but could be used in a different mode.

Simon B
  • 2,912
  • 17
  • 20
  • 1
    That's also the regular use of "dead code" everywhere I've seen it before; I have no idea where "optimized out is dead code" came from. – Izkata Apr 15 '16 at 15:18
  • 1
    Finally an answer with sources that is not just a personal opinion. Thank you! – Tom Apr 16 '16 at 08:56
32

You might consider disabled or deactivated:

disable: to cause (something) to be unable to work in the normal way
deactivate: to make (something) no longer active or effective
definitions from merriam-webster.com

Hellion
  • 59,365
28

I'm rather thinking of the word unused.

Edit: Unused should be understandable for non technical persons. Other possibilities include unnecessary (you often see this in change logs, as in removed unnecessary lines) or maybe orphaned (although I haven't seen this in a real coding situation. It's rather a translation of a term in my native tongue)

23

moth-balled

verb (used with object)

  1. to put into storage or reserve; inactivate.

adjective

  1. inactive; unused; stored away:

11

When discussing code or functionality that is either in progress or completed but has not been approved or won't be used, we often use the term

shelved

decide not to proceed with (a project or plan), either temporarily or permanently.

This implies that it was not a failure (which would be "trashed") and that it could later be unsheleved and put to use.

example

  • 3
    Some source control systems use the term "shelved" to refer to changes that were put aside and not checked in. Using it in this context (even for those who use systems without such a concept) would probably be confusing. – stannius Apr 14 '16 at 20:05
  • 2
    @stannius Except that if you have shelves, this is exactly where this kind of code should go. – deworde Apr 15 '16 at 10:44
  • @deworde Yes, I think most of us would agree on that. Or a branch. – stannius Apr 15 '16 at 13:28
  • 1
    @stannius git refers to this as a "stash". – Digital Chris Apr 15 '16 at 13:46
9

My view is that such code should not exist in the code base and is a code or process smell.

This is cluttering code. I am going to clutter up the codebase with this code.

Peter K.
  • 3,766
  • 2
    Ideally, every piece of code should be used, but these might be features I still plan on implementing, but have just not attached to the UI yet, nor am I currently developing. The key word of the question, here, is purposefully. – Ky - Apr 14 '16 at 15:50
  • 3
    My experience is that no one ever goes back and purposefully removes or reintegrates such code. YMMV. – Peter K. Apr 14 '16 at 15:54
  • 3
    It has occasionally happened to me where one project is temporarily interrupted and delayed by another higher-priority project, at a point where the code for the former is reachable only from tests, not from the application. While it's true that if I don't get back to it reasonably soon I probably never will, I do sometimes get back to it soon. Then I'd call the code "work in progress", but that doesn't fit the sentences grammatically, and also implies a kind of urgency in getting back to it which the questioner doesn't express :-) – Steve Jessop Apr 14 '16 at 16:35
  • 1
    @SteveJessop That's exactly this :) – Ky - Apr 14 '16 at 20:12
  • LOL... that's delightful. – Daniel R. Collins Apr 15 '16 at 03:28
  • 4
    I don't see how cluttering could ever convey what the OP asked for. This is just a condescending expression that doesn't say anything at all except whether that code complies or not with one's preferred "best practices". – SantiBailors Apr 15 '16 at 09:40
  • 6
    @BenC.R.Leggiero Then that's what branching is for. – deworde Apr 15 '16 at 10:43
  • I think part of the reason it is hard to fit a word to the action in question is because the action is something one should not do in the first place. It's like installing an extra axle on a truck (but not putting wheels on the axle) because you think in the future you might want more wheels. Is there a word for that? (Note that this is different from driving a truck with extra wheels for a while, then removing the wheels but not removing the axle.) – David K Apr 19 '16 at 11:21
  • @DavidK : Nice analogy! I wonder why the down-voters. Probably code clutterers. :-) – Peter K. Apr 19 '16 at 11:29
  • @DavidK Yours is just rhetoric. This is not a programming site but a language site (and not a programming language site). For a language to have a word for a thing it couldn't matter less whether doing that thing is a good idea or not. I'm sure you can think of a lot of words that indicate things that exist but "should not be done". Peter K, my downvote reason is in my comment, since you are wondering. – SantiBailors Apr 20 '16 at 09:03
  • @SantiBailors You assert condescension in my answer; there is none. The question said This code is still there, and could theoretically work, but it never will because it's inaccessible. The verb clutter means crowd (something) untidily; fill with clutter. I maintain that the word fits very, very well with the asked-for question. – Peter K. Apr 20 '16 at 11:19
  • Peter K, you are completely wrong. As a developer I am even in agreement with you that that code clutters the codebase, and yet "cluttering" doesn't say anything about whether that code is executed or not, just whether it is considered useful or not. Cluttering code might even be executed, and it would still be clutter. Also, you cherry-picked the parts that fit your religious tirade. The request was for a term that indicates that the code is not executed. If one sees "cluttering" he/she will never understand from that that it's code that is not executed, and that was the asked-for question. – SantiBailors Apr 20 '16 at 12:09
  • @SantiBailors If I were going to discuss programming, I would have said how I would deal with that kind of code. Instead, I am concerned with how the programmer could communicate his/her intent to someone else. Perhaps I should have said "something many people will think one should not do," keeping my own value judgment out of it; nevertheless, I haven't seen any answers on this topic yet that indicate a purposeful, deliberate action without pejorative connotations, and I suggest that there is a practical reason for that. – David K Apr 20 '16 at 13:12
5

I would use the word "inactive" since it is possible to use that code, yet it is not actually doing anything, as you have stated.

5

I originally posted this as a comment, but will add a meaningful and expanded answer. As a software engineer myself, I'm using generic term redundant code.

"Redundant code" fits perfectly almost for every case:

  • when part of code is unnecessary,
  • or is not in use,
  • or it's unreachable,
  • or is unreferenced,
  • or is not used in computations,
  • or optimized out by compiler.

Redundant code is generic term, it defines the category of the code. If you need to clarify, why it's redundant, you may use more explicit terms, depending on the context:

  • unused code – part of the code, which is never used in any computations, the logical rules never lead to execution of it, or it can be just commented code;
  • unreachable code – part of the source code which can never be executed because there exists no control flow path to the code from the rest of the program;
  • dead code – has no external effect: e.g., does not change the output produced by a program, result is never used in any other computations, and normally may be optimized out by compiler;
  • legacy code – is source code that relates to a no-longer supported, not-maintained anymore, and could be partially not in use. This definition might be a bit blurry, and these conditions are not necessarily part of the term, it mainly depends on the context of usage;
  • unreferenced code - subtype of dead code, unused code, i'd say.
Farside
  • 463
  • 4
  • 12
4

How about auxiliary code (auxiliary/auxiliarize): something that's useful but unused, held in reserve in case it's needed.

(I also like vestigial code, but that's not as good an answer, since it might imply obsoleteness).

JonahHuron
  • 161
  • 2
3

I would call this feature toggled code. If you read the linked post you may come away with the impression that you must use configuration to toggle features. That's true. Your configuration just happens to be hard coded right now.

You may want to fix that, but even if you don't, I think "toggled off" is a reasonable description of this code.

kojiro
  • 2,103
3

I'd use dormant. As per the verb I'm not sure if there is one for make it dormant otherwise I'd just say that.

ADDED: This term would be a metaphor about something currently inactive but that has the full potential to do things if it gets activated, f.ex. a dormant volcano, or a dormant spy living an apparently normal, unrelated life but that can be activated as a spy in the future.

SantiBailors
  • 175
  • 7
2

I would use the word hidden:

kept out of sight; concealed.

synonyms: concealed, secret, undercover, invisible, unseen, out of sight, closeted, covert; secluded, tucked away; camouflaged, disguised, masked, cloaked

"This feature has been implemented, but it's currently hidden from users."

Kevin Workman
  • 11,324
  • Hidden code? Nerver heard this term in my life in relation to source code. As well as explanation alike cloaked code or camouflaged is totally out of the competition. Thank you, you have a really good sense of humor, will share this with my colleagues - software developers :-D – Farside Apr 16 '16 at 13:40
  • @Farside To be fair, you'd refer to the feature as hidden. The code itself is just "the code for that hidden feature". – Kevin Workman Apr 16 '16 at 14:25
  • Kevin, to be fair, the question was about source code, not about features, or anything else... sounds like your answer is off-topic... – Farside Apr 16 '16 at 14:59
  • 1
    @Farside If you say so. The OP asked what to call their code. I would call it code for a feature that's hidden from users. Have a good day. – Kevin Workman Apr 16 '16 at 15:05
2

One term is crippled. As in "the freeware version had several functions crippled."

https://en.wikipedia.org/wiki/Crippleware

Phil Sweet
  • 15,699
  • That refers to features removed for licensing reasons, not in a case like this, where the coder has just decided not to integrate them in any release. – underscore_d Apr 18 '16 at 08:11
2

After reading all of the other answers and OP's comments to them, I now have concluded that the code in question is complete, and it just isn't being used anywhere yet. (Imagine a method overload or helper function that no one is calling yet.) Therefore the most sensible option I can think of that other programmers would instantly understand is:

uncalled
or
unreferenced

The thinking here is that after the entry point, all code is potentially called by other code. You have code that is not called by other code anywhere yet. Compared to some other answers I like, this is very similar to unused, with the minor difference that uncalled is more targeted specifically to code, whereas unused is a broader term which can be applied to many things, one of which is code.

Some other terms that were mentioned that I'd like to comment on:

  • orphaned - this is similar, except that it suggests that at one time the code actually was called somewhere, and now it isn't called anymore.
  • shelved - I originally liked this answer the best, because I thought the wrong question was being asked. I thought a better question would be: "What should I do with this code that I don't want to use right now?" But that isn't quite the same thing as "What should I do with this code that I don't want to use right now, but someone else might want to use right now?" In the latter case you don't want to shelve it because someone could legitimately want to use it right away, and I believe that's a better description of the scenario in the question.
TTT
  • 254
1

You could consider suppressed:

to keep in or repress.

to withhold from disclosure or publication.

(Dictionary.com)

That conveys not only that the code is unused, but that it is intentionally prevented from being used.

PellMel
  • 3,014
1

I would use inactive to indicate that it is not being executed in any existing code path.

From your example:

"This is inactive code."

"I am going to activate/deactivate this code".

Michael J.
  • 2,372
1

Depends on why you disabled it. You could perhaps be more descriptive about why you disabled it rather than looking for a generic "____ code". Here's a few generic words:

  • Disabled
  • Unused
  • Stashed

And a few specific ones:

  • Uncontrolled
  • Untested
  • Deprecated
  • Obsolete
  • Non-production ready
Mateen Ulhaq
  • 1,521
1

I think the word you are looking for is "sideline" (sidelined).

past tense: sidelined; past participle: sidelined

cause (a player) to be unable to play in a team or game. "an ankle injury has sidelined him for two weeks" remove from the centre of activity or attention;

place in a less influential position. "backbench MPs have been sidelined and excluded from decision-making"

1

There are several good answers here (and a few that, IMHO, are not so good).  A couple of them mention the word "reserve" in passing, but don't propose it as an answer, so I will: reserve or reserved:

transitive verb:

1. to keep back or save for future use, ...
3. to set apart for a particular use, purpose, service, ...

adjective:

15. kept in reserve; forming a reserve: a reserve fund; a reserve supply.

For the answerers who suggest that such code should be deleted, is a waste of time, is clutter or obsolete, consider this scenario: Programmer thinks of a neat new feature for a product and codes it.  Her manager says, "Yes, that's neat, but our marketing plan for this product calls for a new major version six months from now; let's keep this in reserve until then."

  • I would go with the 'in reserve' form of this. Not sure why it was attracting down votes. Especially since other answers quote definitions or describe their own suggestions explicitly using this one! – Phil Miller Apr 18 '16 at 14:58
1

I do believe this is called Dormant Code, a variant term from Unreachable code, because Unreachable code is most of the times an error effect as stated above as

    programming errors in complex conditional branches;
    a consequence of the internal transformations performed by an optimizing compiler;
    incomplete testing of a new or modified program that failed to test the bypassed unreachable code;
    obsolete code that a programmer forgot to delete;
and not a purposeful actual cause; I would term it Dormant Code, because it's functional code that you chose not to turn on but it's there whenever you need and if you trigger it; if you can't actually FIND the code although it's functional AND working, then the term is Hidden code not Dormant code. HOWEVER, if Kojiro's concept for the code fall in these:
      unused code that a programmer decided not to delete because it was intermingled with functional code;
      conditionally useful code that will never be reached, because current input data will never cause that code to be executed;
      then it can be placed inside the construct of Unreachable Code
      0

      If we borrow what git calls code you store away for later, try stashed.

      It does not come up often in casual conversation so there is unlikely to be conflicting usage.

      Similarly, there is also stored.

      Mateen Ulhaq
      • 1,521
      • If you worked with GIT yourself, and ever used stash functionality - you would not post this answer, as it has totally different meaning. Has nothing to do with the OP question. – Farside Apr 16 '16 at 13:46
      • 2
        @Farside Sure, but it can potentially be used to store away working code. I assume he's going to be using it locally (with his peers/coworkers), so precision doesn't matter as long as everyone agrees upon it. – Mateen Ulhaq Apr 16 '16 at 23:34
      -2

      legacy code, used primarily for informal pseudocode

      • It was never implemented. Legacy code is code from a system that has been in place for a long time. – TimR Apr 14 '16 at 16:55
      • Legacy code doesn't necessarily imply implemented; I keep legacy Access VBA code from old magazines without having ever really implementing it. – John Edward Law Apr 14 '16 at 17:02
      • 8
        Legacy pertains to the age/era of the code or codebase not to its disuse. – TimR Apr 14 '16 at 17:09
      • 2
        legacy code – is source code that relates to a no-longer supported, not-maintained anymore, and may be partially/fully not in use. This definition might be a bit blurry, and not all these conditions are necessarily part of the term, it mainly depends on the context of usage. But for sure, disuse - is not definitive here, it's more a consequence of the fact, that code is aged out, inherited and not maintained properly. – Farside Apr 15 '16 at 10:15
      • As for the OP, I would definitely say that most application developers (or software developers...) would say "I am going to save this code" or "I am going to pitch this code", given our proclivity to being pack rats of code ;-) – John Edward Law Apr 15 '16 at 15:13
      • I have always seen it called 'commented-out' code.The code isn't reached because it is marked as a comment, so we can read it as a passing notation, but the computer does not compile it as code. – Yosef Baskin Jan 30 '17 at 22:44