Does a domain object have to be persisted, or does this violate some convention about domain objects?
For example, let's say I'm using an object called AuthenticationState
to represent authentication state in the application. This object has a boolean field isLoggedIn
. I want to force the user to re-login each time so when I start the application again, I just create a new instance of the model with isLoggedIn
set to false, instead of attempting to load one from local device/browser storage.
I feel like I may be overthinking things, but every example I've found online always has its domain objects use some sort of persistence. Is using domain objects in this way still acceptable?
isLoggedIn
is presumably just one of the fields in a domain object. How do you propose that the system remember the other fields?