Skip to content
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

Immutable value objects #568

Open
snazy opened this issue Dec 16, 2024 · 0 comments
Open

Immutable value objects #568

snazy opened this issue Dec 16, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@snazy
Copy link
Member

snazy commented Dec 16, 2024

Describe the bug

Basically all object types in Polaris have mutable attributes, either directly (via setters) or indirectly (via collections). This is known to be prone to programming issues. All value types should really be immutable types - none of the elements of a value type should be mutable. Libraries like immutable are built to support this.

immutable is superior to both Java records and Lombok. While the direct attributes of Java records are not changeable, the objects (collections!) referenced from Java records are not enforced to be immutable. Lombok provides similar functionality than immutables, but adds bytecode (and functions/methods) that is not present in the source code, which makes for example debugging harder.

@snazy snazy added the bug Something isn't working label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant