Making Software. Better.
Simple solutions to big business problems.
a sip of elixir
About me
● Likes to solve problems that usually involves writing software
● Currently, helping customers of Equal Experts solve their software problems
● Twitter: @uttamkini
● Blog: https://medium.com/@uttamkini
What is functional programming anyway
● Declarative
● Immutable state
● Data is separate from functions (though functions can accept and operate on data)
● Functions are first class citizens (functions can be passed to and returned from other functions)
● Iteration is done using recursion (no for(i=0...) loops)
Functional programming is important !!
● Today, faster programs means utilizing multiple cores of a machine
● Because state is immutable, it becomes easier to write concurrent programs with functional programming
● Code is easy to read and reason about (once you get used to it)
● Easy to enforce correctness with type inference and checking
But, I don’t do functional programming !!
Are you sure ?
● Immutable objects have always been around in Java (remember the String class ?)
● Not using setters/changing an object once it is created is considered good practice
● Preferring composition over inheritance
● Lambdas in C# and now even in Java
● The stream api in Java 8 and Linq in C#
● Optionals in Java 8
But …..
● Since FP features are a bolt on to an OO language, writing functional code does not feel “natural”
● It is easy to go back to old habits of writing code with for loops and mutations
● It is nicer to learn a paradigm in a language that is designed for the paradigm
An elixir to get you started
● Is a dynamic and functional language
● Runs on the battle tested Erlang VM (Beam)
● Designed for distribution and fault tolerance
● Syntax inspired from Ruby
● Developer friendly tooling and ecosystem
● Can use Erlang libraries
Talk is cheap ….
Show me the
code !!
Communication in a stateless world
Static or Dynamic typing ?… a bit of both
● Dynamic by default
● The elixir compiler uses type inference where it can
● You can optionally add @spec directive for stronger type checks
Location transparency
● One Process can pass messages to another process in the same “OS process” or to a different process on
the same machine or a different machine in the cluster.
● The VM takes care of serializing/deserializing messages and calling the right process
Supervisors and Applications
● A supervisor is a process that monitors another process
● It restarts the process if it terminates (let it crash philosophy !)
● One process crashing does not bring the application down
● Applications are supervisors that can be configured to automatically start on process start up
Soar with the Phoenix
● Inspired by Ruby on Rails
● Focussed on developer productivity
● Can handle millions of connections at the same time
● Really performant (has micro second response times for regular workloads)
● Great support for web sockets that can used to build more interactive web apps
Closing thoughts
● Be patient when you learn something new, it takes time
● Learning a new language makes you a better programmer even in your current language
● You don’t have to learn everything all at once, everybody has a different pace of learning, so again be
patient
● If reading books doesn’t work, try videos or online courses (Every person has a different way of learning)
● If you enjoy what you are learning, the chances of dropping out go down
Thank You
Twitter
@EqualExperts
LinkedIn
linkedin.com/company/equal-experts
UNITED KINGDOM
+44 203 603 7830
helloUK@equalexperts.co
m
Equal Experts UK Ltd
30 Brock Street
London NW1 3FG
INDIA
+91 20 6607 7763
helloIndia@equalexperts.com
Equal Experts India Private Ltd
Office No. 4-C
Cerebrum IT Park No. B3
Kumar City, Kalyani Nagar
Pune, 411006
Web
www.equalexperts.com
CANADA
+1 403 775 4861
helloCanada@equalexperts.com
Equal Experts Devices Inc
205 - 279 Midpark way S.E.
T2X 1M2
Calgary, Alberta
PORTUGAL
+351 211 378 414
helloPortugal@equalexperts.co
m
Equal Experts Portugal
Avenida Dom João II, Nº35
Edificio Infante 11ºA
1990-083Parque das Nações
Lisboa – Portugal
Thank You
USA
+1 866-943-9737
helloUSA@equalexperts.com
Equal Experts Inc
1460 Broadway
New York
NY 10036

A sip of elixir

  • 1.
    Making Software. Better. Simplesolutions to big business problems. a sip of elixir
  • 2.
    About me ● Likesto solve problems that usually involves writing software ● Currently, helping customers of Equal Experts solve their software problems ● Twitter: @uttamkini ● Blog: https://medium.com/@uttamkini
  • 3.
    What is functionalprogramming anyway ● Declarative ● Immutable state ● Data is separate from functions (though functions can accept and operate on data) ● Functions are first class citizens (functions can be passed to and returned from other functions) ● Iteration is done using recursion (no for(i=0...) loops)
  • 4.
    Functional programming isimportant !! ● Today, faster programs means utilizing multiple cores of a machine ● Because state is immutable, it becomes easier to write concurrent programs with functional programming ● Code is easy to read and reason about (once you get used to it) ● Easy to enforce correctness with type inference and checking
  • 5.
    But, I don’tdo functional programming !!
  • 6.
    Are you sure? ● Immutable objects have always been around in Java (remember the String class ?) ● Not using setters/changing an object once it is created is considered good practice ● Preferring composition over inheritance ● Lambdas in C# and now even in Java ● The stream api in Java 8 and Linq in C# ● Optionals in Java 8
  • 7.
    But ….. ● SinceFP features are a bolt on to an OO language, writing functional code does not feel “natural” ● It is easy to go back to old habits of writing code with for loops and mutations ● It is nicer to learn a paradigm in a language that is designed for the paradigm
  • 8.
    An elixir toget you started ● Is a dynamic and functional language ● Runs on the battle tested Erlang VM (Beam) ● Designed for distribution and fault tolerance ● Syntax inspired from Ruby ● Developer friendly tooling and ecosystem ● Can use Erlang libraries
  • 9.
    Talk is cheap…. Show me the code !!
  • 10.
    Communication in astateless world
  • 11.
    Static or Dynamictyping ?… a bit of both ● Dynamic by default ● The elixir compiler uses type inference where it can ● You can optionally add @spec directive for stronger type checks
  • 12.
    Location transparency ● OneProcess can pass messages to another process in the same “OS process” or to a different process on the same machine or a different machine in the cluster. ● The VM takes care of serializing/deserializing messages and calling the right process
  • 13.
    Supervisors and Applications ●A supervisor is a process that monitors another process ● It restarts the process if it terminates (let it crash philosophy !) ● One process crashing does not bring the application down ● Applications are supervisors that can be configured to automatically start on process start up
  • 14.
    Soar with thePhoenix ● Inspired by Ruby on Rails ● Focussed on developer productivity ● Can handle millions of connections at the same time ● Really performant (has micro second response times for regular workloads) ● Great support for web sockets that can used to build more interactive web apps
  • 15.
    Closing thoughts ● Bepatient when you learn something new, it takes time ● Learning a new language makes you a better programmer even in your current language ● You don’t have to learn everything all at once, everybody has a different pace of learning, so again be patient ● If reading books doesn’t work, try videos or online courses (Every person has a different way of learning) ● If you enjoy what you are learning, the chances of dropping out go down
  • 16.
    Thank You Twitter @EqualExperts LinkedIn linkedin.com/company/equal-experts UNITED KINGDOM +44203 603 7830 helloUK@equalexperts.co m Equal Experts UK Ltd 30 Brock Street London NW1 3FG INDIA +91 20 6607 7763 helloIndia@equalexperts.com Equal Experts India Private Ltd Office No. 4-C Cerebrum IT Park No. B3 Kumar City, Kalyani Nagar Pune, 411006 Web www.equalexperts.com CANADA +1 403 775 4861 helloCanada@equalexperts.com Equal Experts Devices Inc 205 - 279 Midpark way S.E. T2X 1M2 Calgary, Alberta PORTUGAL +351 211 378 414 helloPortugal@equalexperts.co m Equal Experts Portugal Avenida Dom João II, Nº35 Edificio Infante 11ºA 1990-083Parque das Nações Lisboa – Portugal Thank You USA +1 866-943-9737 helloUSA@equalexperts.com Equal Experts Inc 1460 Broadway New York NY 10036