

In this situation, ‘Palette of 2 Colors’ is a Value Object – a concept from the domain model (actual business or problem use case) that represents a single or a set of values. Here’s an example of what they use, identifying each using a name (like summer, winter, gold, pastel etc.):

They often use it to choose a set of colors for their projects. One of their requirements is to be able to view a set of colors, say, 2, commonly referred to as a ‘Palette of 2’ – available as printed copies. Imagine you are creating a solution for students. With records, you can represent a domain value in an expressive and concise way, as compared to representing the same domain value using a regular class.īefore moving forward, let’s quickly understand what a Value Object is. Concise, clean and simple way to define domain values, also referred to as Value Objects (VO) Let’s get started with our first example.ġ. You’ll be surprised to discover how useful records are when used with other modern Java features like Record Patterns and Sealed Classes. In this blog post, I’ll try to answer these questions by using hands-on practical examples for busy developers like you. But what about its semantics? In other words, what does the term ‘Record’ imply? What are its features and limitations? What are the best places to use records, or the worst places to even think about them? If you talk about the syntax, Records seem to be a concise way of creating a new data type to store your immutable data.
