According to the single responsibility principle, separation of concerns should help with those two - testing and maintenance. I'm yet to focus my efforts on unit testing. But I have some knowledge in it. And for sure, it would help in testing those two classes separately. Concerning maintainability, imagine a situation where your users can be deactivated or enabled or their credentials revoked. I assume in such cases it'd be easier having separated such attributes from the other user-related attributes. I'm no expert though. That's why I'm hoping for some input from people who've been doing this a while.
Обсуждают сегодня