3 ms·
What you are saying might be a manifestation of the "bounded context" pattern/problem: https://martinfowler.com/bliki/BoundedContext.html https://martinfowler.
by spawarotti 5y ago
What you are saying might be a manifestation of the "bounded context" pattern/problem:
https://martinfowler.com/bliki/BoundedContext.html https://martinfowler.com/bliki/BoundedContext.html
It is a huge topic. Hard for me to discuss this further without knowing the specifics. But intuitively, if it was as simple as "Really all I need is a simple string and a validation function." then you wouldn't need a class with several hundred lines of code.
Or you could have UsaPhoneNumber, JapanesePhoneNumber, etc.
And instead of doing:
IsValidUsaPhoneNumber(str);
you could do:
var usaPhoneNumber = new UsaPhoneNumber(str);
and now you have the validness captured as a type:
https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-validate/ https://lexi-lambda.github.io/blog/2019/11/05/parse-don-t-va...