Intro to Elixir
Structure of the presentation
- Talk about problems you might be familiar with
- Discuss some possible approaches
- Overview of Elixir
- Questions
Please interrupt me anytime if you have questions
Old state of Web Development
- Come from Ruby or Python
- Writing database heavy MVC based CRUD applications
Disadvantages
- Need to rely on third party webservers
- Application management becomes hard
- Stateful applications become very hard
Elixir
- Familiar syntax
- Functional
- Great tooling
- "Let it crash" philosophy
- Built on top of Erlang/OTP
Erlang/OTP
-
Developed by Ericsson
-
Been around for over 20 years
-
Built with concurrency and distributed systems in mind
-
Battle tested not only in telecom systems
Hello world example
defmodule HelloWorld do
def hello do
IO.puts "Hello, World!"
end
end
HelloWorld.hello() # "Hello, World!"Unique Language Features
Pattern Matching
# without pattern matching
def foobar(foo) do
if foo == "foo" do
"Foo"
else
"Bar"
end
end
# with pattern matching
def foobar("foo"), do: "Foo"
def foobar(_foo), do: "Bar"
Pipes
foo = add1(1) # 2
foo = add1(foo) # 3
foo = add1(foo) # 4
1
|> add1() # 2
|> add1() # 3
|> add1() # 4Ok, I'm interested. Where should I look for resources
- elixir-lang.org
- elixir-forum.com
- irc/elixir slack
In summary
- Write more maintainable applications
- Take advantage of a mature ecosystem
- Unique features that help with development
Fin
Intro to Elixir
By enilsen16
Intro to Elixir
- 233