Manage Your Data In A B-Boy Stance

3,403 views

Published on

Published in: Technology, Business
  • Be the first to comment

  • Be the first to like this

Manage Your Data In A B-Boy Stance

  1. 1. MANAGE YOUR DATAFROM A B-BOY STANCE John SJ Anderson / @genehack dc.pm / 2012-05-01
  2. 2. MAD PROPSCory Watson (GPHAT)Jay Shirley (JSHIRLEY)
  3. 3. DATA::MANAGER IS
  4. 4. DATA::MANAGER ISInput Validation
  5. 5. DATA::MANAGER ISInput ValidationError Handling
  6. 6. DATA::MANAGER ISInput ValidationError HandlingMessage Passing
  7. 7. DATA::MANAGER ISInput ValidationError HandlingMessage Passing“Opinionated Software”
  8. 8. DATA::MANAGER ISN’T
  9. 9. DATA::MANAGER ISN’T Form Generation
  10. 10. DATA::MANAGER ISN’T Form Generation Form Rendering
  11. 11. DATA::MANAGER ISN’T Form Generation Form Rendering Right For Everybody
  12. 12. DATA::MANAGER IS
  13. 13. DATA::MANAGER IS1 or more Data::Verifierobjects
  14. 14. DATA::MANAGER IS1 or more Data::Verifierobjects1 Message::Stack object
  15. 15. DATA::MANAGER IS1 or more Data::Verifierobjects1 Message::Stack objectTiny bit of sugar codesprinkled over the top
  16. 16. TASK:ACCOUNT CREATION FORMUsername field (text box)Password field (password box)“Password again” field (password box)
  17. 17. TASK:ACCOUNT CREATION FORM Constraints: username must be populated password must be >4 characters long password must be the same as password2
  18. 18. TEST CASES
  19. 19. TEST CASESPass case: everything filled in properly
  20. 20. TEST CASESPass case: everything filled in properlyFail cases: No username No password No password2 Short password Value of password != password2
  21. 21. TEST CODE A/K/AILL-ADVISED LIVE DEMO
  22. 22. DATA::VALIDATOR CODE A/K/AMORE ILL-ADVISED LIVE DEMO
  23. 23. WEB CONTEXT
  24. 24. WEB CONTEXT So now we understand how to take a set of fields and validate them
  25. 25. WEB CONTEXT So now we understand how to take a set of fields and validate them But in a web/CGI context, if the validation fails, we can’t just die();
  26. 26. WEB CONTEXT So now we understand how to take a set of fields and validate them But in a web/CGI context, if the validation fails, we can’t just die(); Have to communicate nature of failure back to the user
  27. 27. WEB CONTEXT
  28. 28. WEB CONTEXTAlso, in a more realistic case, we’ll have more complicatedforms
  29. 29. WEB CONTEXTAlso, in a more realistic case, we’ll have more complicatedforms1 form submit -> changes to multiple objects / tables on thebackend
  30. 30. WEB CONTEXTAlso, in a more realistic case, we’ll have more complicatedforms1 form submit -> changes to multiple objects / tables on thebackendFrom a UI perspective, we want to display error messages asclose to the source as possible
  31. 31. DATA::MANAGER IS
  32. 32. DATA::MANAGER IS1 or more Data::Verifier objects
  33. 33. DATA::MANAGER IS1 or more Data::Verifier objects1 Message::Stack object
  34. 34. DATA::MANAGER IS1 or more Data::Verifier objects1 Message::Stack object1 Data::Verifier per form “scope”
  35. 35. DATA::MANAGER IS1 or more Data::Verifier objects1 Message::Stack object1 Data::Verifier per form “scope”1 Message::Stack object to contain all errors/messages aboutthe results of verifying all the Data::Verifiers in theData::Manager
  36. 36. DATA::MANAGER IS1 or more Data::Verifier objects1 Message::Stack object1 Data::Verifier per form “scope”1 Message::Stack object to contain all errors/messages aboutthe results of verifying all the Data::Verifiers in theData::ManagerTiny bit of sugar code sprinkled over the top
  37. 37. NO FORM GENERATION how does that work?
  38. 38. TEMPLATE MACROS A/K/A MEANS NOW, RIGHT?EVERYBODY KNOWS WHAT THIS SLIDE
  39. 39. PUT IT ALL TOGETHER what do you get?
  40. 40. THANKS! Questions?
  41. 41. MORE INFOZhttps://metacpan.org/module/Data::Managerhttps://metacpan.org/module/Data::Verifierhttps://metacpan.org/module/Message::Stackhttp://www.slideshare.net/jshirley/building-better-applications-with-datamanager

×