Leanpub Header

Skip to main content

Del Objeto al Dato

Data-First Design en Java 21–27

Del Objeto al Dato
This book is 100% completeLast updated on 2026-11-29
Free With Membership

With Membership

Free!

$18.00

You pay

Author earns

$

Also available for 1 book credit with a Reader Membership

PDF
EPUB
WEB
APP
About

About

About the Book

Este libro no es un tour de features. Es una migración.

Parte de un procesador de pedidos escrito en Java 8 (muy sencillo y a modo de ejemplo) y lo transforma pieza a pieza hasta Java 27. Cada capítulo migra una parte del código y resuelve un principio de Data-First Design.

El hilo conductor son los cuatro principios de Data First: modela el dato, manténlo inmutable, valida en el boundary y haz que los estados inválidos no sean representables.

Cada feature que aparece (records, sealed, pattern matching, scoped values...) se justifica por el principio que resuelve, no por su sintaxis y se intenta aplicar como si se tratara de una migración en real.

Si escribes Java en producción y sientes que el lenguaje ha cambiado bajo tus pies ... no estás solo.

Share this book

Categories

Author

About the Author

Jorge Aguilera

Artesano del Software con más de 30 años de experiencia liderando innovación en diversos sectores. Trayectoria contrastada en transformación digital, migración de sistemas monolíticos a microservicios escalables y gestión de equipos de alto rendimiento. Especializado en el ecosistema JVM (Java, Groovy, Micronaut, Quarkus) e infraestructuras cloud-native modernas (AWS, K8s, Terraform).

Contents

Table of Contents

Presentación

Data-First Design en Java

  1. Programación Orientada a Objetos: el problema
  2. Data-First Design: la alternativa
  3. Los principos en Data-First

Algebra computacional

  1. Sum (Sealed)
  2. Product (Record)
  3. ¿Y qué tiene que ver con “álgebra”?
  4. ¿Y qué tiene que ver con mi código?

Order processor en Java 8

  1. Dominio
  2. Modelo de datos
  3. Service
  4. Problemas

Roadmap

Records: datos como estructura

  1. POJOs
  2. Records
  3. Migrando POJOs
  4. Jerarquía y Records
  5. Validar en el boundary (Compact constructors)
  6. equals y hashCode
  7. PaymentMethod

Sealed y switch: descomponer la jerarquia

  1. Sealed interface: el sum type
  2. Switch exhaustivo

Type patterns

  1. type pattern con instanceof
  2. migrar el validate
  3. El límite del type pattern

Record patterns: descomponer sin getters

  1. record pattern, descomponiendo los datos
  2. Nested Patterns
  3. Guarded Patterns
  4. Primitive Patterns

Gatherers: transformaciones puras

  1. El problema: estado mutable en la transformación
  2. Gatherer
  3. Migrar a Gatherer
  4. Gatherer NO es

Scoped Values: contexto inmutable

  1. De ThreadLocal a ScopedValue

Flexible Constructor Bodies

  1. Lo que el compact constructor ya hace
  2. Flexible Constructor

Cagadas

  1. Records anémicos
  2. Anidamiento de definiciones de records
  3. Sellado de dominios inestables
  4. Fugas de mutabilidad
  5. Uso excesivo de coincidencia de patrones
  6. Abstracción prematura

Casos de usos típicos

  1. APIs cloud-native y microservicios
  2. Sistemas event-driven
  3. Máquinas de estados y flujos de trabajo
  4. Configuracion de aplicaciones
  5. Domain-Driven Design
  6. Otros casos

Apéndice

Get the free sample chapters

Click the buttons to get the free sample in PDF or EPUB, or read the sample online here

Also by the Author

Also by the Author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub