strict validation versus accepting anything
play

Strict validation versus accepting anything Evan Jones Bluecore - PowerPoint PPT Presentation

Strict validation versus accepting anything Evan Jones Bluecore Personalized e-commerce marketing ~4 years ~140 employees ~35 engineers Recommendations need product data 2. Page loads JS Partner-specific JS 3. User action sent Data


  1. Strict validation versus accepting anything Evan Jones

  2. Bluecore Personalized e-commerce marketing ~4 years ~140 employees ~35 engineers

  3. Recommendations need product data

  4. 2. Page loads JS Partner-specific JS 3. User action sent Data Ingestion Rules, 1. User visits site Email DB Recommendations 4. Find customers 5. Send email

  5. Data ingestion Web Process Customer events Queue Database Handler Data (thousands/second)

  6. Data ingestion Web Process Customer events Queue Database Handler Data (thousands/second)

  7. Product data "id": 429174, "name": "Pilot G2 Premium Retractable...", "price": 13.99,

  8. Product data "id": 429174 , "name": "Pilot G2 Premium Retractable...", "price": 13.99,

  9. Product data "id": "429174", // may contain letters "name": "Pilot G2 Premium Retractable...", "price": 13.99,

  10. Product data "id": "429174", // may contain letters "name": "Pilot G2 Premium Retractable...", "price": 13.99 ,

  11. Product data "id": "429174", // may contain letters "name": "Pilot G2 Premium Retractable...", "price": "£13.99, // may contain currency

  12. What is valid product data?

  13. Design A : Accept anything! Design B : Strict validation!

  14. Design choice: Validation versus flexibility Programming languages: static versus dynamic typing Databases: Strict versus flexible schemas (SQL vs NoSQL)

  15. Robustness Principle (Postel’s Law) “Be liberal in what you accept, and conservative in what you send” Advantage: implementations can interoperate (e.g. TCP) Disadvantage: bugs can become “standard” (e.g HTML)

  16. Original policy: Accept anything Rationale: One chance to store the data; fix it later Implementation: Store any key/value pairs

  17. Fun ensues ... price: 13 (integer), 13.99 (float), “13.99”, “£13.99” products without ids products with both “title” and “name”

  18. Evaluation + Store any e-commerce data + Fix any data bugs

  19. Evaluation + Store any e-commerce data + Fix any data bugs - Processing is much harder - Harder to test if we are sending the right data

  20. Core Validation Raw data System

  21. Valid Core Validation Raw data System Everything

  22. Valid Core Validation Raw data System Everything One-off fix

  23. Conclusion: Err on the side of validation Find errors sooner Simplifies the overall system Easier to relax restrictions than to add them Want to fix errors later? Record everything

  24. Thanks! Evan Jones http://www.evanjones.ca/ Bluecore http://www.bluecore.com/

  25. Store raw but require “core” schema Store the raw data we receive Validate “core” fields: return helpful error messages e.g. must have id, price is a string, use “name” not “title” Found many data bugs

Recommend


More recommend