Harnessing Java 21 for Data Oriented Programming
Discover how the new features in Java 21—records, sealed interfaces, and pattern matching for switch—work synergistically to facilitate data-oriented programming. This video on the 'Tales from the Jar Side' channel demonstrates two practical examples, highlighting the simplicity and benefits of these features. Learn how immutable data models and stateless services can streamline your code and enhance maintainability, especially when dealing with RESTful web services. Delve into enhanced switch expressions and see live coding examples, including testing with JUnit 5. Leave your comments and thoughts on adopting this approach for your Java applications!
00:00 Introduction to Java 21 Features
00:41 Understanding Data Oriented Programming
01:42 Simple Example: User and Admin Records
05:02 Testing the User Service
06:36 Advanced Example: Astronaut Data Service
07:35 Implementing the AstroDataService
09:36 Fetching and Processing Data
14:42 Pros and Cons of Data Oriented Programming
16:56 Conclusion