DEV Community

Discussion on: Unhealthy Code: Primitive Overuse

Collapse
 
stealthmusic profile image
Jan Wedel • Edited

There are a couple of good examples here! One thing that I don’t like about the enum is that it mixes two concerns:

  1. Authentication Result (Success, Failure), there are really only those two
  2. User State, might even allow more than one (FirstLogin, LockedOut) etc

I would probably use a type like a tuple that returns something like
{Success, [FirstTime]}
{Failure, [LockedOut]}
Just a quick scratch, but you might the idea.