I am altering the deal

I am altering the deal

Imagine your legacy production Ruby application is highly dependent on a third-party API — until you learn your vendor deprecates your current connection. What do you do when you’re forced to make a change? Accept the challenge by embracing abstractions, switching libraries, feature flags, edge-case testing while developing new features. Game on.

Focuses on: Famous example of third-party dependencies that have broken application; Abstracting the API interaction; Utilizing Ruby switching libraries; Feature flagging; Testing for edge cases (QA & customer service); and much more!

D82778274a818df1c0379d1453462e3f?s=128

Brittany Martin

February 18, 2020
Tweet

Transcript

  1. I AM ALTERING THE DEAL (PRAY I DON’T ALTER IT

    FURTHER) Brittany Martin parisRB 2020 Brittany Martin @BrittJMartin
  2. Brittany Martin Lead Web Developer @ Pittsburgh Cultural Trust Brittany

    Martin @BrittJMartin
  3. Host 5 B Y 5 R U B Y O

    N R A I L S P O D C A S T Brittany Martin @BrittJMartin
  4. Norma Skates L I T T L E S T

    E E L D E R B Y G I R L S Brittany Martin @BrittJMartin
  5. THE DEAL Brittany Martin @BrittJMartin

  6. 3rd Party Dependencies C R E D I T :

    M e d i a c l i p Brittany Martin @BrittJMartin
  7. Do they always behave? C R E D I T

    : T H E F O U N D Brittany Martin @BrittJMartin
  8. C R E D I T : H i C

    l i p a r t S T R AT E G Y Brittany Martin @BrittJMartin
  9. Avoid Catastrophe! Brittany Martin @BrittJMartin

  10. Strong Customer Authentication C R E D I T :

    P Y M N T S . C O M Brittany Martin @BrittJMartin
  11. Payments Intent C R E D I T : M

    O L p a y Brittany Martin @BrittJMartin
  12. I N S TAG R A M C R E

    D I T : S e a r c h E n g i n e J o u r n a l Brittany Martin @BrittJMartin
  13. Graph API C R E D I T : S

    a n i t y Brittany Martin @BrittJMartin
  14. Brittany Martin @BrittJMartin

  15. Brittany Martin @BrittJMartin

  16. Brittany Martin @BrittJMartin

  17. Rollback Hell C R E D I T : D

    e p l o y B o t Brittany Martin @BrittJMartin
  18. C R E D I T : S t a

    r W a r s Brittany Martin @BrittJMartin
  19. C R E D I T : A t l

    a s s i a n Brittany Martin @BrittJMartin
  20. AutomateTesting C R E D I T : C h

    a r u d e a l Brittany Martin @BrittJMartin
  21. Beauty in Testing Brittany Martin @BrittJMartin

  22. Performance C R E D I T : A b

    d u l R a h m a n Brittany Martin @BrittJMartin
  23. P E R F T E S T Brittany Martin

    @BrittJMartin
  24. LOAD TESTING Brittany Martin @BrittJMartin C R E D I

    T : P i x a b a y
  25. Perform. C R E D I T : P i

    x a b a y Brittany Martin @BrittJMartin
  26. Ruby Community C R E D I T : J

    o n n y L e w Brittany Martin @BrittJMartin
  27. Benchmark VCR Scientist Brittany Martin @BrittJMartin

  28. C R E D I T : G i t

    h u b , P i x a b a y Branch by Abstraction Brittany Martin @BrittJMartin
  29. Scientist G ITHU B C R E D I T

    : P i x a b a y Brittany Martin @BrittJMartin
  30. C R E D I T : G i t

    h u b Brittany Martin @BrittJMartin
  31. require "scientist" class MyWidget def allows?(user) experiment = Scientist::Default.new "widget-

    permissions" experiment.use { model.check_user? (user).valid? } # old way experiment.try { user.can?(:read, model) } # new way experiment.run end end C R E D I T : G i t h u b Brittany Martin @BrittJMartin
  32. VCR C R E D I T : B B

    C Brittany Martin @BrittJMartin
  33. C R E D I T : T e e

    P u b l i c Brittany Martin @BrittJMartin
  34. require 'rubygems' require 'test/unit' require 'vcr' VCR.configure do |config| config.cassette_library_dir

    = "fixtures/vcr_cassettes" config.hook_into :webmock end class VCRTest < Test::Unit::TestCase def test_example_dot_com VCR.use_cassette("synopsis") do response = Net::HTTP.get_response(URI('brittanymartin.dev")) assert end end end Brittany Martin @BrittJMartin
  35. B E N C H M A R K C

    R E D I T : S p r o u t S o c i a l Brittany Martin @BrittJMartin
  36. SOAP vs.Rest Brittany Martin @BrittJMartin Benchmark.bmbm(100) do |x| x.report("SOAP") {

    n.times do Webservices::Requests::GetNewSessionKeyRequest.new({:ip => '0.0.0.0'}).invoke.session_key end } x.report("REST") { n.times do Rest.new.create_session('0.0.0.0')['SessionKey'] end} end APIs called 100x each. Benchmark::Tms:0x00007ff17de18270 @label="SOAP", @real=3.547331999987364, @cstime=0.0, @cutime=0.0, @stime=0.09988699999999984, @utime=1.6087319999999998, @total=1.7086189999999997 Benchmark::Tms:0x00007ff17f596f50 @label="REST", @real=26.420482000001357, @cstime=0.0, @cutime=0.0, @stime=0.17270999999999992, @utime=1.5042220000000004, @total=1.6769320000000003 SOAP real-time = 3.547331999987364 REST real-time = 26.420482000001357 SOAP is 8x faster.
  37. Brittany Martin @BrittJMartin

  38. C R E D I T : C o l

    l i s Brittany Martin @BrittJMartin
  39. Silver Linings. C R E D I T : 4

    D H u m a n B e i n g Brittany Martin @BrittJMartin
  40. C R E D I T : N Y T

    i m e s Brittany Martin @BrittJMartin
  41. B R E A K U P C R E

    D I T : V e r a A r s i c Brittany Martin @BrittJMartin
  42. Be Strong A V O I D N E G

    A T I V I T Y Brittany Martin @BrittJMartin
  43. C R E D I T : T e s

    T e a c h Brittany Martin @BrittJMartin
  44. brittanymartin.dev 5by5.tv/rubyonrails Please lunch with me! Brittany Martin @BrittJMartin