We were having a discussion at my work about the use of enums in Java.
A coworker was arguing that when using enums on the server-side, whenever required we should use string to reference to it (for instance when sending data from JS to the server or when storing in the database), arguing that this is much more clearer for the developer and also arguing that it would fail fast in case of typos.
I always used integers to identify enums in these cases, because it would be immutable identifiers and would not have case and typo problems (even though if a dev made the mistake of using the value 2 instead of 1, it would not fail fast).
Being very analytic about these arguments, I would say that using strings is better, but I get a strange feeling about it (as if it was not a good approach).
Is there any best practice regarding this discussion that could guide me?