Small lightning talk with some practical advice on how we integrated a Phoenix application in our general application landscape with a rails monolith and some frontend clients.
Elixir & Phoenix – fast, concurrent and explicitTobias Pfeiffer
Elixir and Phoenix are known for their speed, but that’s far from their only benefit. Elixir isn’t just a fast Ruby and Phoenix isn’t just Rails for Elixir. Through pattern matching, immutable data structures and new idioms your programs can not only become faster but more understandable and maintainable. This talk will take a look at what’s great, what you might miss and augment it with production experience and advice.
A short introduction to Elixir presented by Chi-chi Ekweozor at Manchester UK's MadLab on 20 February.
Learn how to use the ubiquitous pipeline operator |> to consume functions as data, pattern matching, modules, lists and other language constructs.
7. Clojure 眼见为实
• 顺序
(do (println 1) (println 2) ……)
• 条件
(if (> a b)
“a大于b”
“b大于或者等于a”)
• 循环
(loop [n 1 ret 0]
(if (> n 100)
ret
(recur (inc n) (+ ret n))))
7
8. Clojure 眼见为实
•(+ a b c d) => a +b + c + d
•(* a (+ b c) d) => a * (b + c) * d
•(op arg1 arg2 ……)
List 数据结构
8
9. Clojure 眼见为实
• Code <=> Data
• List 结构:中间代码,宏可以操作并生成中
间代码
• 宏(Macro):扩展编译器,加入新的语法结
构。
9
if test
then
else
when test
something1
something2
……
(defmacro when
[test & body]
(list 'if test (cons 'do body)))
27. Test
• Unit test: clojure.test & ring-mock
• lein test
• clojure-test-mode
• We just test normal functions
• Integration test:
• clj-webdriver
• Ruby watirwebdriver etc.
27
28. Build/Deploy
• Build
• lein uberjar
• lein ring war
• lein jar + libdir plugin
• Web Container:
• jetty
• http-kit
• Immutant(JBoss)
28
37. At the end
• Book:
• 《Clojure Programming》
• 《Clojure in Action》
• 《The Joy of Clojure》
• Community:
• Clojure User Group
• China Clojure User Group
37