Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.
#Devoxx #AwesomeElixir @koenighotze
Bootstrap
|> Elixir
EASY FUN FOR BUSY DEVELOPERS
#Devoxx #AwesomeElixir @koenighotze
@koenighotze / David Schmitz
Senacor Technologies
Programmer!
Bad, bad fighter!
#Devoxx #AwesomeElixir @koenighotze
WET YOUR APPETITE FOR ELIXIR
SHOW OFF SOME COOL FEATURES
CODE A DISTRIBUTED PIZZA PARL...
#Devoxx #AwesomeElixir @koenighotze
学⼀一⻔门语⾔言,就是多⼀一个观察世界的窗户。
To learn a language is to have one more window from which to l...
#Devoxx #AwesomeElixir @koenighotze
Two minor caveats
#Devoxx #AwesomeElixir @koenighotze
I AM THE JON SNOW OF
ELIXIR AND ERLANG/OTP
#Devoxx #AwesomeElixir @koenighotze
THIS IS NOT A README!
#Devoxx #AwesomeElixir @koenighotze
YET
ANOTHER
PROGRAMMING
LANGUANGE?
Y
A
P
L
#Devoxx #AwesomeElixir @koenighotze
Elixir in a Nutshell
+
Elixir in a Nutshell
+
#Devoxx #AwesomeElixir @koenighotze
Principle of Conciseness
Principle of Consistency
Principle of Flexibility
Why Ruby is...
#Devoxx #AwesomeElixir @koenighotze
Battle-proven BEAM and OTP
Ever seen WhatsApp crash?
Reactive before Reactive-is-HipTm...
#Devoxx #AwesomeElixir @koenighotze
Why Clojure is awesome
Because Rich Hickey is always right
#Devoxx #AwesomeElixir @koenighotze
WHY NOT JUST USE
RUBY, ERLANG OR CLOJURE?
#Devoxx #AwesomeElixir @koenighotze
It didn't take long, but pretty
soon my gut feeling kicked in.
This is good $hit. …, t...
#Devoxx #AwesomeElixir @koenighotze
Programmer focussed
OTP Power + Ruby Love
Functional but pragmatic
Standard Toolset
Wh...
#Devoxx #AwesomeElixir @koenighotze
#Devoxx #AwesomeElixir @koenighotze
Erlang/OTP
ERLANG/BEAM TOOLS
LIBRARIES PATTERNS
#Devoxx #AwesomeElixir @koenighotze
Elixir
ERLANG/BEAM TOOLS
LIBRARIES PATTERNS
#Devoxx #AwesomeElixir @koenighotze
Pizza Parlour - Version 1
“Take my money! I want a salami pizza!”
“I am hungry!!”
“3 €...
#Devoxx #AwesomeElixir @koenighotze
Pizza Parlour - Version 1
Demo
#Devoxx #AwesomeElixir @koenighotze
WHAT ABOUT
99.9999999?
#Devoxx #AwesomeElixir @koenighotze
Pillars of Resilience and Reliability
Message-passing between
isolated processes
Autom...
#Devoxx #AwesomeElixir @koenighotze
Elixir Power Tools
Messaging with GenServer modules
Supervisor for transparent resilie...
#Devoxx #AwesomeElixir @koenighotze
Shared resources Shared state Shared stability
SHARED STATE
COMPUTATION COMPUTATION CO...
#Devoxx #AwesomeElixir @koenighotze
Light Weight Processes
MAILBOX
STATE
COMPUTATION
Asynchronous
Synchronous
GENSERVER
#Devoxx #AwesomeElixir @koenighotze
GenericServer in a Nutshell
loop(current_state):
wait for message
handle message
send ...
#Devoxx #AwesomeElixir @koenighotze
GenericServer in a Nutshell
loop(current_state):
wait for message
handle message
send ...
#Devoxx #AwesomeElixir @koenighotze
GenericServer in a Nutshell
loop(current_state):
wait for message
handle message
send ...
#Devoxx #AwesomeElixir @koenighotze
GenericServer in a Nutshell
loop(current_state):
wait for message
handle message
send ...
#Devoxx #AwesomeElixir @koenighotze
Architecture build around tiny Processes
PROCESS
PROCESS
PROCESS
PROCESS
PROCESS
PROCE...
#Devoxx #AwesomeElixir @koenighotze
Message driven Pizza - The request
{:pizza, “Salami”}
handle_call({:pizza, “Salami”}, ...
#Devoxx #AwesomeElixir @koenighotze
%{order_number: 123, price: 10.50}
Message driven Pizza - The reply
#Devoxx #AwesomeElixir @koenighotze
Pizza Parlour - Version 2
Demo
#Devoxx #AwesomeElixir @koenighotze
NOW REALLY,
WHAT ABOUT
RESILIENCE???
#Devoxx #AwesomeElixir @koenighotze
“HAVE YOU TRIED TURNING
IT OFF AND ON AGAIN?”
#Devoxx #AwesomeElixir @koenighotze
The WHAT IF scenario
{:pizza, “Salami”}
#Devoxx #AwesomeElixir @koenighotze
Risk at the Bottom of the Supervision Tree
APPLICATION
SUPERVISOR
Here be dragons…
#Devoxx #AwesomeElixir @koenighotze
APPLICATION
SUPERVISOR
Supervisors watch their Children
#Devoxx #AwesomeElixir @koenighotze
APPLICATION
SUPERVISOR
Supervisors watch their Children
#Devoxx #AwesomeElixir @koenighotze
APPLICATION
SUPERVISOR
Supervisors watch their Children
#Devoxx #AwesomeElixir @koenighotze
Pizza Parlour - Version 3
Demo
#Devoxx #AwesomeElixir @koenighotze
There is so much more
#Devoxx #AwesomeElixir @koenighotze
Protocols for polymorphism
defimpl String.Chars do
def to_string(bitmap),
for: [Bitmap...
#Devoxx #AwesomeElixir @koenighotze
Hygienic Macros
defmacro unless(clause, do:expression) do
quote do
if(!unquote(clause)...
#Devoxx #AwesomeElixir @koenighotze
Hygienic Macros
defmacro unless(clause, do:expression) do
quote do
if(!unquote(clause)...
#Devoxx #AwesomeElixir @koenighotze
Zero downtime Hot code replacement
def code_change(ver, old_state, extra) do
new_state...
#Devoxx #AwesomeElixir @koenighotze
Real-time apps with Ecto and Phoenix
defmodule Video do
def alphabetical(query) do
fro...
#Devoxx #AwesomeElixir @koenighotze
Real-time apps with Ecto and Phoenix
def alphabetical(query) do …
Video
|> Video.alpha...
#Devoxx #AwesomeElixir @koenighotze
SHOULD WE ALL START
BUILDING EVERYTHING
WITH ELIXIR?
#Devoxx #AwesomeElixir @koenighotze
#Devoxx #AwesomeElixir @koenighotze
WELL….MAYBE NOT?!
#Devoxx #AwesomeElixir @koenighotze
AND OF COURSE…
#Devoxx #AwesomeElixir @koenighotze
MICROSERVICE AND
CLOUD READY ;)
#Devoxx #AwesomeElixir @koenighotze
New insights and ideas
Clean patterns as part of the core
Architecture and Tooling for...
#Devoxx #AwesomeElixir @koenighotze
Elixir Homepage, http://elixir-lang.org/
Dave Thomas, Programming Elixir
Fred Hebert, ...
#Devoxx #AwesomeElixir @koenighotze
Thank you very much!
<david.schmitz@senacor.com>
Nächste SlideShare
Wird geladen in …5
×

Elixir - Easy fun for busy developers @ Devoxx 2016

636 Aufrufe

Veröffentlicht am

Did you ever want to create an application that is never down?
Have you ever been jealous of those Erlang guys, that produce applications that practically never fail?
Have you tried Erlang and fled because of its baroque syntax and tooling?

Enter Elixir!

Elixir combines Ruby's love for programmers with the absolute power that is the Erlang platform.

This talk will introduce Java programmers to Elixir and OTP. You will gain an understanding of what Elixir brings to the table and how to build highly scale-able systems with a toolset that is actually fun to use.

Even if you will never use Elixir and OTP for you projects, you will learn some of the concepts, that make Erlang into such a powerful ecosystem.

Veröffentlicht in: Ingenieurwesen
  • Als Erste(r) kommentieren

Elixir - Easy fun for busy developers @ Devoxx 2016

  1. 1. #Devoxx #AwesomeElixir @koenighotze Bootstrap |> Elixir EASY FUN FOR BUSY DEVELOPERS
  2. 2. #Devoxx #AwesomeElixir @koenighotze @koenighotze / David Schmitz Senacor Technologies Programmer! Bad, bad fighter!
  3. 3. #Devoxx #AwesomeElixir @koenighotze WET YOUR APPETITE FOR ELIXIR SHOW OFF SOME COOL FEATURES CODE A DISTRIBUTED PIZZA PARLOUR
  4. 4. #Devoxx #AwesomeElixir @koenighotze 学⼀一⻔门语⾔言,就是多⼀一个观察世界的窗户。 To learn a language is to have one more window from which to look at the world
  5. 5. #Devoxx #AwesomeElixir @koenighotze Two minor caveats
  6. 6. #Devoxx #AwesomeElixir @koenighotze I AM THE JON SNOW OF ELIXIR AND ERLANG/OTP
  7. 7. #Devoxx #AwesomeElixir @koenighotze THIS IS NOT A README!
  8. 8. #Devoxx #AwesomeElixir @koenighotze YET ANOTHER PROGRAMMING LANGUANGE? Y A P L
  9. 9. #Devoxx #AwesomeElixir @koenighotze Elixir in a Nutshell + Elixir in a Nutshell +
  10. 10. #Devoxx #AwesomeElixir @koenighotze Principle of Conciseness Principle of Consistency Principle of Flexibility Why Ruby is awesome
  11. 11. #Devoxx #AwesomeElixir @koenighotze Battle-proven BEAM and OTP Ever seen WhatsApp crash? Reactive before Reactive-is-HipTm Actors before Actors-are—HipTm Why Erlang is awesome
  12. 12. #Devoxx #AwesomeElixir @koenighotze Why Clojure is awesome Because Rich Hickey is always right
  13. 13. #Devoxx #AwesomeElixir @koenighotze WHY NOT JUST USE RUBY, ERLANG OR CLOJURE?
  14. 14. #Devoxx #AwesomeElixir @koenighotze It didn't take long, but pretty soon my gut feeling kicked in. This is good $hit. …, they both compile to instructions for the EVM - Joe Armstrong (Creator of Erlang)
  15. 15. #Devoxx #AwesomeElixir @koenighotze Programmer focussed OTP Power + Ruby Love Functional but pragmatic Standard Toolset Why Elixir is awesome
  16. 16. #Devoxx #AwesomeElixir @koenighotze
  17. 17. #Devoxx #AwesomeElixir @koenighotze Erlang/OTP ERLANG/BEAM TOOLS LIBRARIES PATTERNS
  18. 18. #Devoxx #AwesomeElixir @koenighotze Elixir ERLANG/BEAM TOOLS LIBRARIES PATTERNS
  19. 19. #Devoxx #AwesomeElixir @koenighotze Pizza Parlour - Version 1 “Take my money! I want a salami pizza!” “I am hungry!!” “3 €, please!”
  20. 20. #Devoxx #AwesomeElixir @koenighotze Pizza Parlour - Version 1 Demo
  21. 21. #Devoxx #AwesomeElixir @koenighotze WHAT ABOUT 99.9999999?
  22. 22. #Devoxx #AwesomeElixir @koenighotze Pillars of Resilience and Reliability Message-passing between isolated processes Automatic recovery and monitoring Transparent distribution
  23. 23. #Devoxx #AwesomeElixir @koenighotze Elixir Power Tools Messaging with GenServer modules Supervisor for transparent resilience
  24. 24. #Devoxx #AwesomeElixir @koenighotze Shared resources Shared state Shared stability SHARED STATE COMPUTATION COMPUTATION COMPUTATION HEAVY WEIGHT PROCESS COMPUTATION COMPUTATION COMPUTATION
  25. 25. #Devoxx #AwesomeElixir @koenighotze Light Weight Processes MAILBOX STATE COMPUTATION Asynchronous Synchronous GENSERVER
  26. 26. #Devoxx #AwesomeElixir @koenighotze GenericServer in a Nutshell loop(current_state): wait for message handle message send reply loop(new_state)
  27. 27. #Devoxx #AwesomeElixir @koenighotze GenericServer in a Nutshell loop(current_state): wait for message handle message send reply loop(new_state)
  28. 28. #Devoxx #AwesomeElixir @koenighotze GenericServer in a Nutshell loop(current_state): wait for message handle message send reply loop(new_state)
  29. 29. #Devoxx #AwesomeElixir @koenighotze GenericServer in a Nutshell loop(current_state): wait for message handle message send reply loop(new_state)
  30. 30. #Devoxx #AwesomeElixir @koenighotze Architecture build around tiny Processes PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS PROCESS HEAVY WEIGHT PROCESS
  31. 31. #Devoxx #AwesomeElixir @koenighotze Message driven Pizza - The request {:pizza, “Salami”} handle_call({:pizza, “Salami”}, from, state)
  32. 32. #Devoxx #AwesomeElixir @koenighotze %{order_number: 123, price: 10.50} Message driven Pizza - The reply
  33. 33. #Devoxx #AwesomeElixir @koenighotze Pizza Parlour - Version 2 Demo
  34. 34. #Devoxx #AwesomeElixir @koenighotze NOW REALLY, WHAT ABOUT RESILIENCE???
  35. 35. #Devoxx #AwesomeElixir @koenighotze “HAVE YOU TRIED TURNING IT OFF AND ON AGAIN?”
  36. 36. #Devoxx #AwesomeElixir @koenighotze The WHAT IF scenario {:pizza, “Salami”}
  37. 37. #Devoxx #AwesomeElixir @koenighotze Risk at the Bottom of the Supervision Tree APPLICATION SUPERVISOR Here be dragons…
  38. 38. #Devoxx #AwesomeElixir @koenighotze APPLICATION SUPERVISOR Supervisors watch their Children
  39. 39. #Devoxx #AwesomeElixir @koenighotze APPLICATION SUPERVISOR Supervisors watch their Children
  40. 40. #Devoxx #AwesomeElixir @koenighotze APPLICATION SUPERVISOR Supervisors watch their Children
  41. 41. #Devoxx #AwesomeElixir @koenighotze Pizza Parlour - Version 3 Demo
  42. 42. #Devoxx #AwesomeElixir @koenighotze There is so much more
  43. 43. #Devoxx #AwesomeElixir @koenighotze Protocols for polymorphism defimpl String.Chars do def to_string(bitmap), for: [Bitmap] do … end end
  44. 44. #Devoxx #AwesomeElixir @koenighotze Hygienic Macros defmacro unless(clause, do:expression) do quote do if(!unquote(clause) do unquote(expression)) end end end
  45. 45. #Devoxx #AwesomeElixir @koenighotze Hygienic Macros defmacro unless(clause, do:expression) do quote do if(!unquote(clause) do unquote(expression)) end end end
  46. 46. #Devoxx #AwesomeElixir @koenighotze Zero downtime Hot code replacement def code_change(ver, old_state, extra) do new_state = … {:ok, new_state} end
  47. 47. #Devoxx #AwesomeElixir @koenighotze Real-time apps with Ecto and Phoenix defmodule Video do def alphabetical(query) do from q in query, order_by: q.name end end
  48. 48. #Devoxx #AwesomeElixir @koenighotze Real-time apps with Ecto and Phoenix def alphabetical(query) do … Video |> Video.alphabetical |> Repo.all
  49. 49. #Devoxx #AwesomeElixir @koenighotze SHOULD WE ALL START BUILDING EVERYTHING WITH ELIXIR?
  50. 50. #Devoxx #AwesomeElixir @koenighotze
  51. 51. #Devoxx #AwesomeElixir @koenighotze WELL….MAYBE NOT?!
  52. 52. #Devoxx #AwesomeElixir @koenighotze AND OF COURSE…
  53. 53. #Devoxx #AwesomeElixir @koenighotze MICROSERVICE AND CLOUD READY ;)
  54. 54. #Devoxx #AwesomeElixir @koenighotze New insights and ideas Clean patterns as part of the core Architecture and Tooling for IoT Vibrant and friendly Community Come for OTP, stay for…
  55. 55. #Devoxx #AwesomeElixir @koenighotze Elixir Homepage, http://elixir-lang.org/ Dave Thomas, Programming Elixir Fred Hebert, Stuff Goes Bad: Erlang in Anger Do you want to know more?
  56. 56. #Devoxx #AwesomeElixir @koenighotze Thank you very much! <david.schmitz@senacor.com>

×