DomainModel.stream()

https://doov.org

Welcome to the Furets !

@gdigugli – Gilles Di Guglielmo

  • Designer of sweet cooked software since 1999
  • Software Architect at LesFurets.com


@jubaudry – Julien Baudry

  • Java Developer since 2007
  • Software Architect at LesFurets.com

LesFurets - The Meta Lambda Track

  • Lambda Architecture at LesFurets.com - State of the Union
    10:00 - 10:40 | Essex
  • From Legacy to Reactive
    10:50 - 11:30 | Norfolk
  • Sparks Fly Everywhere
    11:30 - 12:45 | Buckingham A
  • JOOQ and JOOλ: How to write clean code with your DAO
    11:40 - 12:20 | Burghley
  • Price Competitiveness Hacked by R
    14:30 - 15:10 | Norfolk
  • DomainModel.stream()
    15:30 - 16:10 | Essex

  • 1 website, 5 Insurance Products : Car, Health, Home, Bike, Loan
  • 1 codebase, 450k lines of code, 60k unit tests, 150 selenium tests
  • 22 Developers, 2 DevOps, 4 Architects
  • 19 production servers including Load balancers, Frontend, Backend, Databases, BI
  • 1 release per day
  • 8 years of code history
  • 3M quotes/year, 40% of market share, 4M of customers

Moving the architecture

What you have ...

What you want ...

Que faire ?

Architect at work ...

Keying everything !

A bit of livecoding

Live code 1 : Introduction to key value API

Live code 2 : Mixing with java.util.Map

Live code 3 : Tag filtering

Live code 4 : Generate CQL

Live code 5 : Diff two models

Usages are unlimited

You can use Java 8 stream on your Domain Model !

  • FieldModel#stream() : a stream of key/value pair (FieldId/Object)
  • FieldModel#parallelStream() : parallel stream and better performance
  • Easy use a filter/map/reduce operations on a domain model

Could you write a domain model diff tool now ?

Where we use it at LesFurets.com

  • Simple UI binding by replacing JSON model by a Dictionary (80% less code)
  • Use JSON Dictionary for client/server RPC
  • Batch and ETL with an email provider (90% less code)
  • Persistence in cassandra (from scratch with 200 lines of code for a whole model)
  • Injecting user data in selenium (40% less code)
  • Mocking our domain model in thousand of unit tests

... everything in iterative fashion during the past 2 years.

Future and ideas

  • Push as OSS our Cassandra serialisation code
  • Push some Spark samples
  • JEP 276: Dynamic Linking of Language-Defined Object Models

We need a new name ?

  • Model-Map is cool, keep it
  • YAMF: Yet Another Mapping Framework
  • OWKF: Obi Wan Kenobi Framework
  • Submit your ideas

Model-Map available on Github

  • https://doov.org
  • Framework and examples
  • Apache Licence
  • Try it and contribute !

Thank You!