SlideShare a Scribd company logo
1 of 23
Elixir
Elixir
● Funktionellt programmeringsspråk
● Dynamiskt typsystem
● Byggt ovanpå Erlang Virtual Machine
○ Kompileras till Erlang bytecode
○ Battle tested, Erlang skapades 1986
● Skapades av José Valim, för att öka
produktiviteten i Erlang plattformen
Varför Erlang?
"Erlang is the culmination of twenty-five
years of correct design decisions in the
language and platform."
Elixir i ett nötskal
● Enkla datastrukturer (immutable)
● Skicka meddelanden mellan isolerade processer (actor
model)
● Standard bibliotek för att bygga robusta system (OTP)
○ “Let it crash”
● Extensible
○ Meta programming
■ Macros
OTP - Open Telecom Platform
If half of Erlang's greatness comes
from its concurrency and
distribution and the other half
comes from its error handling
capabilities, then the OTP
framework is the third half of it.
Skalbart
● Lättviktiga processer
● Isolerade
○ Share nothing
○ Garbage Collection
○ Egen heap
● Meddelanden
○ Brevlåda
○ Distribuerat system
■ Andra maskiner
Feltolerant
● Organisera kod i processer
○ Applikationen är ett distribuerat system
○ Fokus på att hantera krascher
■ Istället för att försöka förhindra alla
problem
● Supervisors
● Återställer delar av systemet till ett känt
fungerande tillstånd
● Olika strategier för att starta om processer
● Let it crash
s
w w w
s
w w w
s
w w w
Om en process dör
Starta om den
Funktionell programmering
● Everything is an expression
● Immutable data
● Pattern matching
● Recursion
Immutable data
● Application state (data) should only be
mutated using pure stateless functions
● A pure function refers to a function that takes
everything it needs as a parameter and
returns a new copy of data as its output.
Typer och variabler
Typespecs
● Tillägg som kan göra
programmen typsäkra
○ Används ej av kompilatorn
○ Kräver ett extra program
■ Dialyzer (OTP)
○ Dokumentation
● TypeScript vibbar?
Pattern matching (=)
Moduler vs klasser
public, default, protected, private public, private
Pipeline operator |>
Processer
Microservices by default
Det naturliga designmönstret
i Elixir är att organisera kod i
isolerade processer
“Elixir code is written as
microservices by default
without the extra baggage
that comes with
microservices.”
Verktyg
● IEx - Elixir Interactive Shell / REPL
○ Inte bara en REPL
○ Skal (shell) för att kommunicera
med existerande processer
■ Introspektion
● Observer
○ Inspektera systemet
○ :observer.start
Mera verktyg!
● Mix build tool
○ https://hexdocs.pm/mix/Mix.html
● Hex Package manager
○ https://hex.pm/
● ExUnit
○ https://hexdocs.pm/ex_unit/ExUnit.html
● HexDocs
○ https://hexdocs.pm
Populära ramverk och bibliotek
Phoenix
Framework
Ecto
DSL for writing queries
and interacting with
databases in Elixir
Absinthe
GraphQL &
Elixir
Editor support
Bra stöd i Visual Studio Code
Ryktet säger att det även finns
stöd för Atom..
Böcker, nyhetsbrev och resurser
Introducing Elixir
Learning Elixir
Take Off With Elixir
Programming Phoenix
Functional Web Development With
Elixir, OTP and Phoenix
Elixir Radar (weekly newsletter)
https://elixir-lang.org/learning.html
Elixir School
https://elixirschool.com
http://learnyousomeerlang.com
Frågor?
Tack för att ni lyssnade!

More Related Content

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Lightning talk: Elixir

  • 1.
  • 3. Elixir ● Funktionellt programmeringsspråk ● Dynamiskt typsystem ● Byggt ovanpå Erlang Virtual Machine ○ Kompileras till Erlang bytecode ○ Battle tested, Erlang skapades 1986 ● Skapades av José Valim, för att öka produktiviteten i Erlang plattformen
  • 4. Varför Erlang? "Erlang is the culmination of twenty-five years of correct design decisions in the language and platform."
  • 5. Elixir i ett nötskal ● Enkla datastrukturer (immutable) ● Skicka meddelanden mellan isolerade processer (actor model) ● Standard bibliotek för att bygga robusta system (OTP) ○ “Let it crash” ● Extensible ○ Meta programming ■ Macros
  • 6. OTP - Open Telecom Platform If half of Erlang's greatness comes from its concurrency and distribution and the other half comes from its error handling capabilities, then the OTP framework is the third half of it.
  • 7. Skalbart ● Lättviktiga processer ● Isolerade ○ Share nothing ○ Garbage Collection ○ Egen heap ● Meddelanden ○ Brevlåda ○ Distribuerat system ■ Andra maskiner
  • 8. Feltolerant ● Organisera kod i processer ○ Applikationen är ett distribuerat system ○ Fokus på att hantera krascher ■ Istället för att försöka förhindra alla problem ● Supervisors ● Återställer delar av systemet till ett känt fungerande tillstånd ● Olika strategier för att starta om processer ● Let it crash s w w w s w w w s w w w Om en process dör Starta om den
  • 9. Funktionell programmering ● Everything is an expression ● Immutable data ● Pattern matching ● Recursion
  • 10. Immutable data ● Application state (data) should only be mutated using pure stateless functions ● A pure function refers to a function that takes everything it needs as a parameter and returns a new copy of data as its output.
  • 12. Typespecs ● Tillägg som kan göra programmen typsäkra ○ Används ej av kompilatorn ○ Kräver ett extra program ■ Dialyzer (OTP) ○ Dokumentation ● TypeScript vibbar?
  • 14. Moduler vs klasser public, default, protected, private public, private
  • 17. Microservices by default Det naturliga designmönstret i Elixir är att organisera kod i isolerade processer “Elixir code is written as microservices by default without the extra baggage that comes with microservices.”
  • 18. Verktyg ● IEx - Elixir Interactive Shell / REPL ○ Inte bara en REPL ○ Skal (shell) för att kommunicera med existerande processer ■ Introspektion ● Observer ○ Inspektera systemet ○ :observer.start
  • 19. Mera verktyg! ● Mix build tool ○ https://hexdocs.pm/mix/Mix.html ● Hex Package manager ○ https://hex.pm/ ● ExUnit ○ https://hexdocs.pm/ex_unit/ExUnit.html ● HexDocs ○ https://hexdocs.pm
  • 20. Populära ramverk och bibliotek Phoenix Framework Ecto DSL for writing queries and interacting with databases in Elixir Absinthe GraphQL & Elixir
  • 21. Editor support Bra stöd i Visual Studio Code Ryktet säger att det även finns stöd för Atom..
  • 22. Böcker, nyhetsbrev och resurser Introducing Elixir Learning Elixir Take Off With Elixir Programming Phoenix Functional Web Development With Elixir, OTP and Phoenix Elixir Radar (weekly newsletter) https://elixir-lang.org/learning.html Elixir School https://elixirschool.com http://learnyousomeerlang.com
  • 23. Frågor? Tack för att ni lyssnade!

Editor's Notes

  1. Roligt att få prata om Elixir!
  2. Plataformatec, Brazil
  3. Macros allow direct manipulation of the AST
  4. Verktygslåda för concurrent programming. Supervisors, genservers etc..
  5. Applikationen i sig är ett distribuerat system Enkelt att skala till flera maskiner, svårare i en cloud miljö..
  6. Man kan även pattern matcha binärdata
  7. Man kan blanda Erlang och Elixir dependencies, eftersom allt är Erlang kod