Quick question: I'd like to hear your thoughts on when to use "State" versus "Status" when naming both fields such as "Foo.currentState" vs "Foo.status" and types, like "enum FooState" vs "enum FooStatus". Is there a convention discussed out there? Should we only use one? If so which one, and if not, how should we choose?
-
27Heh. The other day at work I came across some structure that had a member named "state" and another member named "status," and they were different things. I started thinking about what the words meant, and about whether to change it, but the code was old and crufty and working, so I let that sleeping dog lie. Oh.. this probably should have been a "comment," rather than an "answer, eh? Comment, answer, state, status... whatever. – smcameron Jul 22 '09 at 02:54
-
12And of course this is closed. Good ol' SO. – jn1kk Oct 14 '13 at 17:07
-
6@jsn not only is it closed (what isn't these days?), but it's *still* by a long shot the most popular thing I've contributed here :) – Sophistifunk Jan 09 '14 at 03:53
-
10This is a legitimate programming question. http://martinfowler.com/bliki/TwoHardThings.html – May 14 '14 at 00:33
-
7Status is a simple label, like "healthy", "degraded", "unavailable", etc. State includes all the gory details; e.g., CPU util and load averages, memory util, JVM metrics, disk usage, etc. – May 14 '14 at 00:48
-
2I think this question explains the difference very well: http://english.stackexchange.com/questions/12958/status-vs-state – Adam Hošek Aug 20 '14 at 15:06
12 Answers
IMO:
status == how are you? [good/bad]
state == what are you doing? [resting/working]

- 2,788
- 2
- 16
- 12
-
19Where were you in 2009? This answer makes the most sense in technical jargon (cpu state, thread state, state machine; return status, raid volume status, etc.), and even much of everything else (application status, account status, etc.). The only thing I can think of that is inconsistent is stuff like "state of affairs" or "the state of things" which is more like your "status" (good/bad idea of things that are going on, rather than the things that go on themselves). – Peter Mar 06 '13 at 14:17
-
5State also implies that it holds more information than just "resting/working" -- but all the details about the work (or resting) that it is doing. – BrainSlugs83 Nov 05 '13 at 23:40
-
4"I'm building a tree house in my brother's back yard" would be a more detailed example of **state**, as you suggest, @BrainSlugs83. In this example my **status** might be tired/sweaty/energized/happy. – spemble Oct 28 '14 at 13:23
-
6I love this example. Clean and concise. For my practical usage, I might generalize it to an axiom by saying that `State` should reflect the "indicated node" within a graph of state-machine (or workflow) state nodes, where the description might easily be a verbal adjective (often ends with "-ing"), whereas `Status` is a simple property of the object, a plain adjective, that might be used by a trigger or as observed value for a decision to change (or keep) a state. I'm probably overthinking it. I do that.. – Alan McBee Jun 30 '16 at 04:20
-
9
-
@Neil I like your idea. Could you make it more concrete with an example if you don't mind? – Abdel Aleem Dec 19 '19 at 12:19
-
-
@Peter tell that to [TaskStatus](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.taskstatus?view=net-6.0) :P – t3chb0t Sep 05 '22 at 20:31
It depends on the context.
State generally refers to the entire state of an entity - all its values and relationships at a particular point in time (usually, current)
Status is more of a time-point, say, where something is at in a process or workflow - is it dirty (therefore requiring saving), is it complete, is it pending input, etc

- 20,030
- 7
- 43
- 238

- 9,209
- 2
- 28
- 29
Typically I will use State to mean the current condition of an object or the system as a whole. I use status to represent the outcome of some action. For example, the state of an object may be saved/unsaved, valid/invalid. The status (outcome) of a method is successful/unsuccessful/error. I think this jibes pretty well with the definition of status as "state or condition with respect to circumstances," the circumstances in this case being the application of an action/method.

- 524,688
- 99
- 697
- 795
Another (entirely pragmatic) reason to prefer state over status is that the plural is straightforward:
- state -> states
- status -> statuses
And believe me, you will sooner or later have a list or array or whatever of states in your code and will have to name the variable.

- 30,027
- 10
- 102
- 108
-
3
-
Wiktionary says statuses: http://en.wiktionary.org/wiki/status#Noun . Other languages have different plurals for it though. – robinst May 22 '12 at 16:58
-
10
I think many people use "Status" to represent the state of an object if for no other reason than "State" refers to a political division of the United States.

- 95,573
- 20
- 147
- 170
-
13that is not the reason I have ever used, nor anyone I have every worked with or read text from... – Luke Schafer Jul 22 '09 at 02:52
-
4
-
4Yep. In Australia, too, we use the term State to describe the former individual colonies that were unified in the Commonwealth in 1901. So, I tend to only use .status, as having .state is often used in data structures that have an address. – Matthew Schinckel Jul 22 '09 at 03:39
-
1So address.state = Tasmania; makes sense, but device.state would not be expected to involve geography. – spemble Jan 15 '20 at 19:35
I think you could add another perspective to the equation, namely 'sender-requester'.
From a senders perspective, I'd communicate my state with anyone willing to listen. While from a requesters perspective, I'd be asking for someone's status.
The above could also be interpreted from an uncertainty point of view:
- Defined = state
- Undefined = status
What's your status? I'm in a relaxed state.
I'm pretty sure this is just one interpretation, which may not apply to your particular situation.

- 4,041
- 6
- 20
- 37

- 31
- 2
A quick dictionary check reveals that status is a synonym for state, but has an additional interpretation of a position relative to that of others.
So I would use state for a set of states that don't have any implicit ordering or position relative to one another, and status for those that do (perhaps off-standby-on ?). But it's a fine distinction.

- 268,207
- 37
- 334
- 440
A lot of the entities I deal with (accounts, customers) may have a State (TX, VA, etc.) and a Status (Active, Closed, etc.)
So the point about the term being misleading is possible. We have a standardized database naming convention (not my personal choice) where a state is named ST_CD
and a status would be ACCT_STAT_CD
.
With an enum in an OO milieux, this issue is not as important, since if you have strict type safety, the compiler will ensure that no one attempts to do this:
theCustomer.State = Customer.Status.Active;
If you are in a dynamic environment, I would be more worried!
If you are dealing with a domain where state machines or other state information and that terminology is predominant, then I would think State is perfectly fine.

- 88,164
- 40
- 182
- 265
-
The address belongs to the customer's address, not the customer per se, e.g., theCustomer.MailingAddress.State = Iowa; – spemble Jan 15 '20 at 19:38
-
@spemble Possibly, and possibly not. It can also be a state of birth or a state of residency when attached to a person absent an address, and of course can be attached to many other entities like addresses, licenses, permits, etc. In any case, I'm not sure it's relevant to the question of whether there is ambiguity with using a common problem domain term like State for an implementation-specific of a state machine/flag/status. And then whether state or status have or do not have different meanings. – Cade Roux Jan 16 '20 at 20:09
-
Being object-oriented has nothing to do with static or dynamic or strict typing. They are completely orthogonal concepts. – Roland Illig Nov 14 '20 at 12:01
We had this exact debate on my current project a while back. I really don't have a preference, but consistency is an important consideration.
The first (there are several) definition of "state" in my Sharp PW-E550 (an awesome dictionary, I might add) is "the particular condition that someone or something is in at a specific time." The first definition of "status" is "the relative social, professional, or other standing of someone or something". Even the second (and last) definition of "status" is inferior to "state" in this context: "the position of affairs at a particular time, esp. in political or commercial contexts."
So if we wanted it to be as easy as possible for someone using my dictionary (it uses the New Oxford American Dictionary, 2001), "state" would be the best choice.
Furthermore, there is a design pattern described in the Gang of Four's book called the State Pattern, firmly establishing the term in the computing lexicon.
For these reasons I suggest "state".
P.S. Is that you DDM? Are you still bitter about "state" versus "status" ?!!!!!!! LMAO!

- 14,093
- 16
- 59
- 76
Not the same thing at all. Stopped and started are states. Stopping and starting are status.
If you make them them the same thing how do you describe the vehicle as stopped but is currently starting. Or an application as currently lodged but hasn't yet entered the approval process or is being approved but is currently on hold with an error condition of awaiting signature?
-
1OP was asking about using one or the other; not both. One could argue that `Starting` is indeed a `State` completely distinct from `Stopped`. *It depends on the semantics of your system*. Check, for example, Windows Services. – Andrew Barber Oct 23 '12 at 02:18
Well, they do mean the same thing. I don't think it's necessary to promulgate a great preference of one over the other, but I would generally go with "status", because I like things that sound Latinate and classicist. I mean, in my world, the plural of schema is schemata, so there's pretty much no other way for it to go, with me.

- 122,029
- 33
- 303
- 309
-
-
1The context for this question is software, which is why the question is valid. Computer systems pretty much always have to determine & report the state/status of various parts of the system and naming things descriptively becomes very important for people who are debugging or improving the software. – spemble Mar 05 '19 at 14:25
Sophistifunk, I'm sure you'll get arguments for both State and Status. The most important thing to do is that you pick one, and use only one. I'd suggest discussing this with your team and see what everyone agrees on.
That said, my suggestion is as follows.
Assuming you are using an object-oriented programming language, an object's "state" is represented by the object itself. SomeObject.state is misleading imo. I'm not sure what "status" represents in your example, but my natural intuition is to prefer this to state.

- 28,925
- 4
- 72
- 77
-
3Picking one and sticking only with one is absurd. The two have different meanings and implications. Consider for example "GameState" versus "GameStatus" -- the two have very different implications and are not interchangeable. – BrainSlugs83 Nov 05 '13 at 23:35