By using this site, you agree to the Privacy Policy and Terms of Use.
Accept
World of SoftwareWorld of SoftwareWorld of Software
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Search
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
Reading: Java Explores Carrier Classes to Extend Data-Oriented Programming Beyond Records
Share
Sign In
Notification Show More
Font ResizerAa
World of SoftwareWorld of Software
Font ResizerAa
  • Software
  • Mobile
  • Computing
  • Gadget
  • Gaming
  • Videos
Search
  • News
  • Software
  • Mobile
  • Computing
  • Gaming
  • Videos
  • More
    • Gadget
    • Web Stories
    • Trending
    • Press Release
Have an existing account? Sign In
Follow US
  • Privacy
  • Terms
  • Advertise
  • Contact
Copyright © All Rights Reserved. World of Software.
World of Software > News > Java Explores Carrier Classes to Extend Data-Oriented Programming Beyond Records
News

Java Explores Carrier Classes to Extend Data-Oriented Programming Beyond Records

News Room
Last updated: 2026/02/04 at 12:26 PM
News Room Published 4 February 2026
Share
Java Explores Carrier Classes to Extend Data-Oriented Programming Beyond Records
SHARE

The OpenJDK project Amber has released a new design note, Data-Oriented Programming for Java: Beyond Records, outlining an exploratory approach to extending record-like capabilities to more flexible class designs. The document introduces the concepts of carrier classes and carrier interfaces, which aim to generalize the core benefits of records without imposing strict representation rules.

Records, introduced in Java 16, provide a concise way to model immutable data carriers. A record declaration such as:


record Point(int x, int y) { }

It automatically defines a canonical constructor, accessor methods, and implementations of equals, hashCode, and toString. Records also participate in deconstruction patterns for use with instanceof and switch. Combined with sealed classes and pattern matching, records support modelling algebraic data types in Java. For example, an HTTP client or gateway may represent different response types as follows:


public sealed interface HttpResponse permits HttpResponse.Success, HttpResponse.NotFound, HttpResponse.ServerError {
    record Success(int status, String body) implements HttpResponse {}
    record NotFound(String message) implements HttpResponse {}
    record ServerError(int status, String error) implements HttpResponse {}
}

Such response hierarchies can then be handled using exhaustive pattern matching:


static String handle(HttpResponse response) {
   return switch (response) {
       case Success(var code, var body) -> "OK (" + code + "): " + body;
       case NotFound(var msg) -> "404: " + msg;
       case ServerError(var code, var err) -> "Error (" + code + "): " + err;
   };
}

In this example, the compiler ensures that all permitted response types are covered. If a new response variant is introduced, the switch expression must be updated to reduce the risk of incomplete error handling.

In a recent discussion, Brian Goetz, Java Language Architect, Oracle, noted that this combination enables powerful data modelling, but adoption is often limited by long-standing object-oriented design habits. He observed that developers continue to design APIs that mediate data access, even when modern language features allow much of that indirection to be removed.

The design note focuses on situations where records cannot be used. Many real-world types require derived or cached values, alternative internal representations, mutability, or inheritance. In these cases, developers must fall back to traditional classes and reintroduce boilerplate. The document describes this transition as falling off a cliff; in which small deviations from the reference model result in significantly more code.

Carrier classes are proposed to smooth this transition. A carrier class begins with a state description similar to a record header, but otherwise behaves as a normal class:


class Point(int x, int y) {
    private final component int x;
    private final component int y;
}

The state description defines the class’s logical components. From these components, the compiler could derive accessors, object methods, and deconstruction patterns. Unlike records, carrier classes are not required to store their state exclusively in these components.

This flexibility enables patterns that are difficult to express with records, such as caching derived values:


class Point(int x, int y) {
    private final component int x;
    private final component int y;
    private final double norm;

    Point { norm = Math.hypot(x, y); }
    double norm() { return norm; }
}

Here, norm is computed during construction but is not part of the state description. The class could still benefit from compiler-generated methods based on its components.

Carrier classes are also designed to integrate with pattern matching:


if (obj instanceof Point(var x, var y)) {
    // use x and y
}

The design note further discusses compatibility with future reconstruction features, such as the proposed JEP 468, which are being explored with expressions for records.

In addition to classes, the proposal introduces carrier interfaces. An interface may declare a state description and participate in pattern matching across implementations:


interface Pair(T first, U second) { }

switch (pair) {
    case Pair(var a, var b) -> ...
}

This approach could simplify common tuple-like abstractions while retaining strong typing.

The design note situates carrier classes within Java’s broader shift toward data-oriented programming. By combining records, sealed types, pattern matching, and potentially carrier classes, the language increasingly encourages developers to model data structures directly rather than relying on heavily layered APIs. Goetz has argued that a key challenge is helping developers recognize how much supporting code can be eliminated when data is treated as a primary abstraction.

At present, Beyond Records is an exploratory document. No concrete syntax, JEP, or release timeline has been announced. However, it signals continued work within Project Amber to reduce boilerplate and extend modern language features to more complex class designs, which could influence how Java developers structure data-centric APIs in future releases.w

Sign Up For Daily Newsletter

Be keep up! Get the latest breaking news delivered straight to your inbox.
By signing up, you agree to our Terms of Use and acknowledge the data practices in our Privacy Policy. You may unsubscribe at any time.
Share This Article
Facebook Twitter Email Print
Share
What do you think?
Love0
Sad0
Happy0
Sleepy0
Angry0
Dead0
Wink0
Previous Article The only social media for lawyers guide you will ever need The only social media for lawyers guide you will ever need
Next Article The Galaxy S26 might not have built-in magnets after all The Galaxy S26 might not have built-in magnets after all
Leave a comment

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Stay Connected

248.1k Like
69.1k Follow
134k Pin
54.3k Follow

Latest News

This Town, 2.0
This Town, 2.0
News
‘The right has won the family’: my relentless search for lefty mommy bloggers
‘The right has won the family’: my relentless search for lefty mommy bloggers
News
Mesa 26.0-rc3 Released With More Graphics Driver Fixes
Mesa 26.0-rc3 Released With More Graphics Driver Fixes
Computing
Massive rare jellyfish the size of a bus spotted with 10m long arms
Massive rare jellyfish the size of a bus spotted with 10m long arms
News

You Might also Like

This Town, 2.0
News

This Town, 2.0

9 Min Read
‘The right has won the family’: my relentless search for lefty mommy bloggers
News

‘The right has won the family’: my relentless search for lefty mommy bloggers

18 Min Read
Massive rare jellyfish the size of a bus spotted with 10m long arms
News

Massive rare jellyfish the size of a bus spotted with 10m long arms

4 Min Read
Too much artificial intelligence (AI) investment? Not for Meta CEO Mark Zuckerberg, who is leading the way at full speed, to the delight of the market
News

Too much artificial intelligence (AI) investment? Not for Meta CEO Mark Zuckerberg, who is leading the way at full speed, to the delight of the market

5 Min Read
//

World of Software is your one-stop website for the latest tech news and updates, follow us now to get the news that matters to you.

Quick Link

  • Privacy Policy
  • Terms of use
  • Advertise
  • Contact

Topics

  • Computing
  • Software
  • Press Release
  • Trending

Sign Up for Our Newsletter

Subscribe to our newsletter to get our newest articles instantly!

World of SoftwareWorld of Software
Follow US
Copyright © All Rights Reserved. World of Software.
Welcome Back!

Sign in to your account

Lost your password?