Reading code and discussions pertaining to code, I often see the words "state" and "status" used interchangeably, but the following tendencies seem to exist:

  • When a variable holds a value intended to indicate that something is in a certain state, the name of that variable more often than not contains the word "state", or an abbreviation thereof.

  • However, when the return value of a function serves to indicate some such state, we tend to call that value a "status code"; and when that value is stored in a variable, this variable is commonly named "status" or something similar.

In isolation that's all fine I guess, but when the aforementioned variables are actually one and the same, a choice needs to be made involving the perverted intricacies of English language (or human language in general).

What is the prevailing coding-standard or convention when it comes to disambiguating between the two? Or should one of those two always be avoided?

This english.stackexchange question is also relevant, I suppose.

  • 2
    Hence this attempt at crowdsourcing. This is very much not the place for opinion polling, though. – Martijn Pieters Nov 24 '13 at 2:20
  • Not on any Stack Exchange site; a forum perhaps? – Martijn Pieters Nov 24 '13 at 2:35
  • It'd be a bit better, certainly. The 'Polling' in the title would have to go too. – Martijn Pieters Nov 24 '13 at 2:55
  • 1
  • 7
    The status of this question will soon be closed, but it will remain in an active state for sometime afterwards. – Reactgular Nov 24 '13 at 14:23

I like this question. The following is from my head but I think it fits quite well.

  • status is used to describe an outcome of an operation (e.g. success/fail).

  • state is used to describe a stage in a process (e.g. pending/dispatched).

I also like this definition:

  • status is a final (resulting) state.

It is quite clear when applied to programming. Much less clear when you apply it to natural language. Let's take the examples from the english thread and see if it holds with the most upvoted answer.

"What is the current status of this project?" The answer should be "In testing."

Well, this might seem to contradict my definitions at a first look but we must realize the context. Probably some supervisor is asking his team about the project and how far they have reached. The point is that the supervisor is interested in the outcome up to now. The fact that there will be something after is just put away because it is not the point of the question.

"What is the current state of this project?" The answer should be "On hold for financial analysis."

So I think that this very nicely demonstrates an essence of a state. "On hold for financial analysis." clearly focuses on the fact that the current situation is a part of some encompassing process and even suggests the next state.

I would say it holds pretty well.

  • 1
    These are the most useful definitions for programming in my opinion. I use "status" when I'm willing to basically describe if the operation was successful or not, and "state" for more descriptive and detailed descriptions. – cprcrack Jul 10 '18 at 16:46

From what I've seen "state" is often used for things that can change and the programmer has at least some modicum of control over how/when it changes (even if indirectly). It also almost always is used to refer to positive states. "You have placed the connection into a disconnected state."

"Status" tends to be the opposite. It tends to be used for things that happen without the programmer's input - and often that the programmer cannot change. It also tends to be used for for negative statuses. "The status of your connection is (checking...) disconnected."


"State" makes me think of "state machine", and I typically use it to refer to something internal / technical, like, "open", "parsing header", "negotiating formats", "reading text", "reading video", etc. Something a fellow programmer might care about, but not intended (much) for the end user. Maybe if they ask for more details on an error, but not the first thing they see.

"Status" is less techie and more for an end user, e.g. "reading", "error 404", "success 200".


Not the answer you're looking for? Browse other questions tagged or ask your own question.