<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Java-17 on dplabs — Software Engineering &amp; Technology Consultancy</title>
		<link>https://dplabs.tech/tags/java-17/</link>
		<description>Recent content in Java-17 on dplabs — Software Engineering &amp; Technology Consultancy</description>
		<generator>Hugo</generator>
		<language>en-us</language>
		
		
		
		
			<lastBuildDate>Mon, 27 Jan 2025 00:00:00 +0000</lastBuildDate>
		
			<atom:link href="https://dplabs.tech/tags/java-17/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>Records and Sealed Classes: Better Domain Models in Java</title>
				<link>https://dplabs.tech/blog/records-sealed-classes-domain-models/</link>
				<pubDate>Mon, 27 Jan 2025 00:00:00 +0000</pubDate>
				<guid>https://dplabs.tech/blog/records-sealed-classes-domain-models/</guid>
				<description>&lt;p&gt;Java domain modeling has historically been verbose and error-prone. Entity classes with dozens of getter/setter pairs, boolean fields that encode state (&lt;code&gt;isActive&lt;/code&gt;, &lt;code&gt;isCancelled&lt;/code&gt;, &lt;code&gt;isPending&lt;/code&gt;), and null fields used to represent the absence of a value all create code that&amp;rsquo;s hard to understand and easy to misuse.&lt;/p&gt;&#xA;&lt;p&gt;Records and sealed classes address this. They&amp;rsquo;re not cosmetic improvements — they change what kinds of mistakes the compiler can catch for you.&lt;/p&gt;&#xA;&lt;h2 id=&#34;records-immutable-data-carriers&#34;&gt;Records: Immutable Data Carriers&lt;/h2&gt;&#xA;&lt;p&gt;A record is a class defined by its components. The compiler generates the constructor, accessors, &lt;code&gt;equals&lt;/code&gt;, &lt;code&gt;hashCode&lt;/code&gt;, and &lt;code&gt;toString&lt;/code&gt; automatically:&lt;/p&gt;</description>
			</item>
	</channel>
</rss>
