Transformation is a narrative plot for business logic: raw, incomplete, or overlooked data becomes a more valuable form through refinement, filtering, enrichment, aggregation, or context-sensitive adjustment. section 2.1.5
Common transformation tasks include:
- Enriching user data with external information, such as deriving geolocation from an IP address. section 2.1.5
- Filtering invalid, corrupted, or duplicate records. section 2.1.5
- Aggregating raw sensor readings into daily averages or usage anomalies. section 2.1.5
- Adjusting behavior automatically according to context, such as setting temperature based on weather. section 2.1.5
Mapping a book format to a promotion
A direct transformation maps each book format to a promotional message: digital books produce a download link, while pocket and hardcover books receive their corresponding messages. Because this behavior belongs to an editor’s context and may change with campaigns or regions, it stays outside the book domain model. section 5.1
Exercise: transform a list of people
Given Person objects with names and ages, extract one youngest name, one oldest name, and an alphabetical list of all names. Rework the solution for performance, memory usage, functional programming with one pipeline, and finally maximum readability. section 10.2.1
Transformation is challenging because complexity must remain clear and simple while performance stays adequate. Naming the plot helps organize the logic and reduce the reader’s cognitive load. section 2.1.5 section 2.6
