4 ms·
But doesn't this basically mean that my constructor has to allow for invalid states? Also, doesn't that mean that another object has the rules for what makes th
by virmundi 15y ago
But doesn't this basically mean that my constructor has to allow for invalid states? Also, doesn't that mean that another object has the rules for what makes the first object valid? Isn't that a violation of separation of concerns?
- tsewlliw 15y agoI'm coming at this with Java semantics, apologies if that just doesn't work for you :) I'd make the constructor private, and move the validation into a public static factory method on the same class that returns an Either.