Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Adopting Elixir

11 views

Published on

Learn how to successfully adopt Elixir with lessons learned by Bleacher Report.

Top Three Takeaways

How to build a successful team
How to migrate to Elixir
Ways to ensure code quality remains high even with a new language.

Published in: Software
  • Be the first to comment

  • Be the first to like this

Adopting Elixir

  1. 1. THANK YOU @BGMARX ADOPTING ELIXIR
  2. 2. BEN MARX @bgmarx ARCHITECT
  3. 3. TEMPER EXPECTATIONS
  4. 4. START SMALL
  5. 5. BUILDING A TEAM
  6. 6. CONSISTENT CODE
  7. 7. MONITORING
  8. 8. NON-ZERO GAME
  9. 9. TEMPER EXPECTATIONS
  10. 10. HONEST CONVERSATION
  11. 11. REGULAR UPDATES
  12. 12. START SMALL
  13. 13. IMMEDIATE NEED
  14. 14. SERVICE- BASED
  15. 15. TERRAFORM https://github.com/poteto/terraform
  16. 16. DIVERT TRAFFIC
  17. 17. def call(conn, _options) do ghost? = Application.get_env(:faust, :ghost)[:enabled] ghost_traffic(conn, conn.method, ghost?) conn end def ghost_traffic(conn, "GET", "true") do host = Application.get_env(:my_app, :ghost)[:host] url = Enum.join([host, conn.request_path]) Task.start(fn -> HTTPoison.get(url) end) end def ghost_traffic(_, _, _), do: nil
  18. 18. BUILDING A TEAM
  19. 19. WHO’S INTERESTED?
  20. 20. VARYING INTEREST
  21. 21. EXCITED CURIOUS AMBIVALENT OPPOSED
  22. 22. EXPECT RESISTANCE
  23. 23. SET UP FOR SUCCESS
  24. 24. CONSISTENT CODE
  25. 25. CODIFY STANDARDS
  26. 26. CREDO https://github.com/rrrene/credo
  27. 27. DOCUMENT CODE https://github.com/elixir-lang/ex_doc
  28. 28. @doc “”” Attempts to fetch and extract embed data for a url and format it according to the defined content type “”” @spec fetch_and_extract_embed(String.t) :: embed def fetch_and_extract_embed(url) do url |> get_embed_data |> format_by_content_type end
  29. 29. DIALYZER http://erlang.org/doc/man/dialyzer.html
  30. 30. (FROM THE BEGINNING)
  31. 31. @type embed :: map() @spec fetch_and_extract_embed(String.t) :: embed def fetch_and_extract_embed(url) do url |> parse_response |> format_by_content_type end
  32. 32. USE THE FORMATTER
  33. 33. .formatter.exs [ inputs: ["mix.exs", "{config,lib,test}/**/*. {ex,exs}"] ] https://hexdocs.pm/mix/master/Mix.Tasks.Format.html
  34. 34. CODE REVIEWS
  35. 35. CONTINUOUS INTEGRATION
  36. 36. …snip… - run: mix coveralls.json - run: mix credo --strict - run: mix format --check-formatted - run: { shell: '/bin/bash', command: 'bash <(curl -s https://codecov.io/bash)' }
  37. 37. MONITORING
  38. 38. CODIFY METRICS
  39. 39. response run queue query time atoms memory latency
  40. 40. EXOMETER https://github.com/Feuerlabs/exometer
  41. 41. STATIX https://github.com/lexmag/statix
  42. 42. Wombat AppSignal Scout Datadog New Relic Bugsnag
  43. 43. TEST LIMITS
  44. 44. defp multiply_traffic(multiplier, url) do multiplier = String.to_integer(multiplier) range = 1..multiplier Enum.each(range, fn _elem -> Task.start(fn -> request_headers = %{"x-request-id" => Logger.metadata()[:request_id]} hackney_options = [recv_timeout: 5_000, timeout: 1_000, pool: false] HTTPoison.get(url, request_headers, hackney: hackney_options) end) end) end
  45. 45. NON-ZERO GAME
  46. 46. IDEAL SITUATION
  47. 47. LIBRARY SUPPORT
  48. 48. IMPERFECT
  49. 49. TARGETED REFACTORING
  50. 50. “BUT LET US CULTIVATE OUR GARDEN” Candide,Voltaire
  51. 51. HAVE FUN
  52. 52. QUESTIONS? @bgmarx

×