 So, this is my first talk, pretty much ever, first time talking in front of more than ten people since like eighth grade, so I'm having like PTSD. So my name is Devin Torres, I've written a few elixir and earling libraries of varying popularity and really glad Jim wanted me to follow the three hardest acts today, so thank you. But I'm also really glad that I don't have to adjust my talk anymore because people keep talking about stuff that I was going to talk about so that's also nice. So greetings Alchemists, I hope that catches on as our thing, if it doesn't I'll be really sad. So my talk is the excitement of elixir, I'm a really excitable person when it comes to technology and if I could have my way I'd probably change my title to chief technology evangelist but I'd have to do more talks to get that to happen and I don't know about that. So I'm just giving this talk, it's kind of going to be like a whirlwind tour of what's new in elixir with 0.14 kind of, but I also want people to take away talking points kind of to, I know there's a lot of people here that want to use elixir professionally which I've done now in two jobs, I'm not sure how many people can say that but if you're looking for talking points to convert some people then hopefully I can give you those. So the platform, OTP, it's great, I can't say that I would be using elixir if it was on any other platform, you know I can't imagine using it if it was you know on the Ruby platform or something like that, fault tolerant we all already know this it's been you know beaten like a dead horse here but I just kind of want to give an anecdote on what brought me to elixir just a quick show of hands how many people came to elixir from Erlang, okay so there's a sizable contingent here that's great so originally at my last job we were heavily invested in Python all of our websites were in Python I think some services were in Python and we were having a lot of trouble scaling it we investigated several solutions you know we were pretty smart dudes so we investigated you know heavily caching things we were trying to scale it horizontally but we were having a lot of problems just with the stateful nature of Python you know we try to catch something or memorize something and you know some thing had stored some property on some property on some property somewhere and so the whole thing would just blow up but you know we investigated some solutions like twisted I spent some time with Scala that kind of just like just too much but then my co-worker came up to me one day with Joe Armstrong's book I don't know why he bought it like on a whim or something but he came up to me and we basically spent the next month reading it I think and we ended up implementing a huge service that are that my old company still uses to this day and have the business runs through I think we spent six months writing it or maybe four months or something like that but as soon as we were done with it and you know we basically ironed out some of the bugs I literally forgot that it was running for like a year and it just ran like we had no problems with it and I think that's really a property of the Erling virtual machine I think you can just expect it to you know not start gobbling up you know tons of memory or something or you know you have some weird highs and bug that just takes down your whole program and yeah so that's great concurrency it's already been beaten to death too I won't talk much about it but I think something that Robert I believe mentioned concurrency is not parallelism and Erling's a concurrent language and the thing about Erling is it was built to be highly concurrent and it wasn't until only recently that well relatively recently in Erling's history that it started getting parallelism and it built that from the concurrency primitives that were already in Erling so distributed that's already been talked about to you so I'm not going to talk about it but it really is the future I think Phoenix I believe is investigating some interesting things with that last thing I heard so that's going to be pretty exciting and I think Chris is going to talk about that later on so that took me forever to make by the way so so the language elixir the thing about elixir that I really like is it balances practicality and power I feel like Jose with every decision that he makes even though he reads a lot of academic papers he he doesn't it doesn't seem like he does things with the language just to be academic it feels like he tries to make the everyday lives of elixir programmers easier macros great you know they've already been talked about so I won't go into those in fact I tried to come up with a contrived example of a macro and I just couldn't think of one and I think that's great because I think some people try to overuse macros and I think the take away that some people should take from this conference is have an API an actual API before you start writing macros my old co-worker actually just said yesterday write it as if you didn't have macros first and if you feel like you need a macro after you've written it a few times then so this was my usage of macros over time in my elixir experience code that writes code though that's a powerful concept and early in my elixir career I really didn't get that and I actually started looking into elixir source code itself before I got this concept in fact it really hit home when I was reading the Unicode module in elixir the Unicode module if you're not familiar actually reads the Unicode database the latest Unicode database and does some string primitives build string primitives from that Unicode database while reading it it actually creates the module from reading that database and so here this is just a small example from some code that I wrote that it reads the MIME types database the Apache MIME types database you might find it on pretty much any you know recent Linux ETC directory or something like that and it creates it reads it and it creates a function that maps extensions to their MIME types and when I first learn this concept it just like blew my mind I mean you can do anything you can read like a TZ database and make a time library for elixir you can read you can read maybe gherkin cucumber files and you know create tests from that or something so this was me after learning that concept and see protocols I'm actually surprised that this was the only slide that I didn't have to have to edit after all the talks I don't think anybody's really talked about protocols other than a brief mention so are the current application that we're developing at my current company unfortunately we're stuck on 0.13.0 until we deploy right you know because we don't want you know weird bugs introduced or anything like but we use a ton of maps to to model some state in our application and when we went to maps there was no there was nothing like put in or update in or any of the helpers that are now in elixir they're actually in the kernel kernel about EX today none of those primitives existed so I had to write a pretty much a poor man's put in from scratch and this is kind of just like an example of what that might look like and that's the great thing about elixir is that you could you can write these kind of things if they don't exist because elixir even 0.13 they have the tools that you need to write powerful powerful constructs powerful tools like these and so as you see it's this is just a set of functions that allow you to get a deeply nested value from nested maps or put a value into a deeply nested you know nested maps and this doesn't have syntax highlighting because apparently the code's too cool for the syntax highlighter so and this is the implementation for map as you can see it's just a simple wrapper map around map.get map.put and protocols are what some of the most powerful constructs in elixir are implemented with things like the access protocol which is how you can actually use the built-in the built-in you know nested getting of maps the enum protocol the inspect protocol that's how elixir you know can actually inspect meaningful meaningfully inspect things and this is just you know just for an example a implementation for hashtag and so structs power records flexibility of maps I didn't want to go into a ton about the language itself because it's already been talked about some of the most primitive constructs like you know pattern matching and processes and you know all the niceties that elixir gives you I mean a lot of us we already know about regex literals we already know about multi-line strings which believe it or not multi-line strings is what originally got me looking at elixir more than anything because you know when you're writing tons of SQL queries it begins to become like a thousand needles so structs I think are a perfect example of Jose's willingness to enhance what we already have in Erlang enhance what Erlang already gives us so Erlang gave us maps and I think at a certain point Jose was thinking about just you know we have maps now so let's just get rid of records and I was I think I was like whoa dude like you know that's that's great and all but then we don't have you know compile time checking of keys or you know we don't have things like default values or anything like that so I think structs were a great compromise not really a compromise though I mean I think it's you know really powerful so so here we have a character struct it's just you know it has a name and a level by the way the thing that got me into programming at a young age was a muds multi-user dungeons so for the next few examples we're going to be doing a little mud so in this example you know we're creating a struct with a name and a level field we're using the new derive and with derive you can give structs behavior you can fall back to the map behavior for your structs because user defined structs you can respond to things in protocols with your struct so as you can see I create a character and I use the access protocol on that character and it gives me back Devonis Maximus I defined the inspect implementation for character just prints out the name and the level and as you can see at the very bottom a struct is literally just a map with an underscore underscore struct underscore underscore atom that's it so super powerful super simple when you understand the implementation the standard library so when I started with elixir I think it was 2009 and I think no excuse me it was 2012 I started with early in 2009 but when I started I think it may have been safe to call elixir Erlang with macros at the time you know there was a lot of cool niceties but it didn't have what it has today which is an expanding standard library I feel like the standard library is really where elixir is beginning to blossom I feel the the the stuff the in the enhancement to OTP that elixir is giving us with things like nested access I've already talked about that this is kind of an advanced example so I won't go into it but with agents you know a while back when we wanted global state we had to implement a gen server and I'm not sure if anybody's implemented you know hundreds of gen servers in Erlang other than the people that raised their hands in here but it was a pain in the butt right so there was a ton of ceremony involved and you know agents kind of do away with all that you know if you want to store some global state easily and you know start and stop an agent it's really easy to do that so tasks tasks have already been talked about so I won't go too much into those but I believe Francisco mentioned Amdahl's law I believe it was pronounced so I did a little googling on that and I think a good takeaway to take away from tasks that have been mentioned is if you have a bunch of blocking calls tournament to tasks you know use async use a weight and all of a sudden that block of code only becomes as slow as the slowest task is to return right so streams so streams are I think the coolest part the coolest new addition to the standard library I really feel that more than anything streams are going to become what really makes people rethink how how things can be modeled in the standard library and in their own applications here we just have a really contrived example of streams it's basically infinite series not sure if how many people here have experience with you know Haskell or you know other languages that have lazy enumerables but here we're just we're basically creating an infinite stream of rats and hoodlums because you know they like to hang out in the sewer and we are cycling through those and adding them to a room or whatever so you know let's say you go into a room and you need ten baddies in there if you take ten baddies from that stream you're gonna have a distribution of of rats and hoodlums based on the number that we took there so this is also how I implemented this this is a chunked P map P map seems to be like the canonical example that Erlang programmers like to re-implement all the time I think I've seen like five implementations of it and this is a chunked P map using only streams and tasks so what a chunked P map is is it's if you have a series of things like let's say one to a hundred you can take a chunk of those like ten and spawn only ten tasks to do some calculations on those ten things and at the end of that take the next ten and take the next ten etc. and you know combine them all into one so probably the right way to do this would be to do to use a pool of workers maybe and not use a new task for every one but I think it's a cool example nonetheless so logger it's not in the standard library yet but I think this was the last big thing for me at least that I felt elixir needed and I think a lot of people felt that way too especially since Jose thinks that it's the last thing that we need before 1.0 so how many people have seen an error like this before yeah I mean you look at something like this and you're pretty much like so so I don't know if you knew you can actually supervise tasks so this is a task a fake one that just raises Kurt Stinks and without the logger you get this mess of Erling terms and Jose was talking about this but this is what it actually looks like and you know we've all seen this stuff before it's it's how Erling sees elixir code and and it's just a mess with the logger looks much better right so and the logger has back ends of course that you can plug your own stuff in too so that's really cool the tooling the tooling of elixir I feel at least when I was being introduced to it was a huge boon I feel like it's some of the most advanced tooling for a new language at least that I can find out there IEX for a repel mix building X unit unit test hex package management EXRM release management a lot of really cool stuff IEX I'm not sure so this is a little module a combat module and it's basically just a simple module that calculates the difference between the two players they want to fight and gives a combat log form right so how many people knew about IEX dot pry couple okay so with IEX dot pry you can you can stop the interpreter you can inspect at any point the binding of variables and your elixir code it's for the JavaScript developers out there it's kind of like the debugger statement of elixir so when this code is run and we run the combat function all we have to do is just allow it to be pride and then we can begin inspecting the the bindings at that point in the in the program dot tests they've already been mentioned a little bit but it's it's huge coming from a Python background it was like really nice when they were introduced and apparently the syntax highlighter can't handle code and docs together so but you know the documentation is a first-class citizen in elixir is a concept that I really get behind I think using doc tests in your code to test your code is a really easy way to both document and and test at the same time so hex it was already mentioned in Eric's talk at least at my table I heard a lot of people express the desire to actually see how do you actually publish a hex package you know how do you actually use it other than you know just pulling in packages so this is this is a just an example of what it would look like if I published my library exec js on hex I just create a package keyword list and have some meta information in there and then I just do mix hex publish and it publishes it to the cloud pretty much so pretty cool the ecosystem the ecosystem of elixir is already really rich we have a lot of cool projects out there already a lot of them seem web-centric I'd like to see some more non-web-centric projects out there but plug is really cool this is a example from the plug library itself it is a plug that takes the connection and remember plugs are completely composable so you can stack them as much as you want takes the connection if the method of the HTTP request is ahead it just turns the method into a get that's literally all it does and these are powerful because the simple plugs are powerful because you can because you can compose them with other plugs ecto ecto is really cool I can't imagine doing a query like this in too many other languages the power of macros that I mentioned earlier are put to really good use in in ecto and even though I know that Jose was poopooing it I know that he at least read a lot of stuff on link when he was originally designing this whether he wants to admit it or not honorable mention Phoenix Caliope I'm not sure if I'm pronouncing that right okay hound hounds by my co-worker Akash I think tools like hound which is kind of a continuous integration testing using web driver written in elixir you can write the whole thing elixir entire test suite for our current application is written in elixir right now jazz honorable mention I know that mass spent a lot of time on that but I really feel like there's there's a really high quality libraries already but I think there needs to be more so the dream for me the thing that would really excite me even more for elixir if we had a breakpoint capable debugger I know that there was already some research into that I'd like to see it taken further quick check for elixir when I originally implemented pool boy which is a pooling library for Erlang and I released it to the world I had this guy Andrew Thompson he basically took my library quick checked it and found that the whole thing was wrong so it's a really powerful way of testing your application and I'd like to see a you know pure elixir maybe even integrated way to use some kind of quick check like testing in a lazy parsing framework I think with streams and maybe even tasks maybe even parsing stuff and in multiple processes I'm not sure there needs to be stuff like lazy Jason parsers or lazy XML parsers maybe not sure how many people are familiar with stacks in Java well actually there needs to be there needs to be an XML parser other than xmerl and early let's just say that and my company's hiring clutch analytics were based here in Austin so if anybody's interested in working on elixir full-time come talk to me that's it that's all I got