-
-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider making value classes final #8
Comments
Good point, I usually make my classes final unless they are explicitly meant to be extended, not sure why I did not do this at the time. |
I was going to suggest adding better support for extending classes like |
These are value objects -- you shouldn't really be extending them. Testing equality is fundamental on VOs and being able to subclass a VO complicates or breaks that feature. |
I'm on the same page as @joshdifabio here; you should favour composition over inheritance, i.e. create your class from scratch, wrapping an instance of I'm usually against extending classes from a library, unless they've been specifically designed for this purpose. In addition to not being good practice, extendable classes add to the maintenance burden by adding backwards compatibility promises to internal code. Maybe if you tell us a bit more about your use case, we can help you refactor it towards composition. What are you extending |
The value classes should really be final.
The text was updated successfully, but these errors were encountered: