The Features of C# 9 That Will Make Your Life Easier [Snippets]

This article is a sort of 'cheat sheet' for developers on the most useful features of C# 9 and several functions from previous versions. With each new version of C#, its developers strive to make the programming process more convenient and concise. This time around, most of the attention was paid to changes in object properties, the new Record type, and more, but first things first.

C# is a programming language that Microsoft created for their own projects. Its syntactic capabilities have something in common with Java and C++. In 2000, the company's engineers developed the ASP.NET active server page technology, which allowed databases to be tied to web applications. ASP.NET itself was written in C#. The ability to build flexible and scalable applications in the future is one of the nice advantages of C#. Products can also be very different — from games to web services.

Spring Boot and Java 16 Records

On March 16th, 2021, Java 16 was GA. With this new release, tons of new exciting features have been added. Check out the release notes to know more about these changes in detail. This article's focus will be on Java Records, which got delivered with JEP 395. Records were first introduced in JDK 14 as a preview feature proposed by JEP 359, and with JDK 15, they remained in preview with JEP 384. However, with JDK 16, Records are no longer in preview.

I have picked Records because they are definitely the most favored feature added in Java 16, according to this Twitter poll by Java Champion Mala Gupta.

Java14: Join Database Tables With Java 14’s New Record

Java14 Records in Joins

Did you know that you can join database tables into a Java Stream with Java 14's preview record feature? Read this short article and find out how it is done using the Speedment Stream ORM. We will start with how to set up your project.

You may also like: A First Look at Records in Java 14

Setup

Download Java 14. Go to the Speedment Initializer and download your project skeleton (including pom.xml). Modify the following lines in your pom.xml file.

JDK 14: Records, Text Blocks, and More

Learn more about these five new proposed JEPs targeted for JDK 14.

On Monday, Mark Reinhold's post "JEPs proposed to target JDK 14: 305, 343, 359, 366, & 368" proposed targeting five more JEPs to JDK 14. Some highly anticipated features are among this group, although all but one are proposed to be in "preview" or "incubating":

  • JEP 305: Pattern Matching for instanceof (Preview)
  • JEP 343: Packaging Tool (Incubator)
  • JEP 359: Records (Preview)
  • JEP 366: Deprecate the ParallelScavenge + SerialOld GC Combination
  • JEP 368: Text Blocks (Second Preview)

The Java SE 13 Java Language Updates document describes preview features (JEP 12): "A preview feature is a new feature whose design, specification, and implementation are complete, but which is not permanent, which means that the feature may exist in a different form or not at all in future JDK releases."

Candidate JEPs: Records and Sealed Types

Changes to records and sealed types were proposed in the most recent JDK Enhancement Proposals

Mark Reinhold announced two new closely related candidate JDK Enhancement Proposals (JEPs) on the OpenJDK amber-dev mailing list this week with the posts "New candidate JEP: 359: Records (Preview)" and " New candidate JEP: 360: Sealed Types (Preview)." Both of these candidate JEPs are "preview features" (defined by JEP 12).

In other JDK news: java.lang.Records: Draft Specification

JEP 359: Records (Preview)

The JEP 359 "Summary" states, "Enhance the Java programming language with records. Records provide a compact syntax for declaring classes which are transparent holders for shallowly immutable data."

April 2019 Update on Java Records

After Project Valhalla's "Value Types/Objects," the language feature I am perhaps the most excited to see come to Java is Project Amber's "Data Classes" (AKA "Records"). I wrote the post "Updates on Records (Data Classes for Java)" about this time last year and use this post to provide an update on my understanding of where the "records" proposal is now.

A good starting point for the current state of the "records" design work is Brian Goetz's February 2019 version of "Data Classes and Sealed Types for Java." In addition to providing background on the usefulness of "plain data carriers" being implemented with less overhead than with traditional Java classes and summarizing design decisions related to achieving that goal, this post also introduces noted Java developer personas Algebraic Annie, Boilerplate Billy, JavaBean Jerry, POJO Patty, Tuple Tommy, and Values Victor.