Whether you're polling message queues, batching records to a datastore, or concurrently uploading a file in pieces to S3, interacting with external services is often complex. When this complexity mingles with your application logic your code becomes messy, hard to test, and fragile to change.
What if you could cleanup the mess with the use of Elixir streams? By choosing to describe these resources as `Enumerable` and `Collectable`, we can encapsulate this complexity and allow the purpose of the code to shine through.
Everyone is familiar with the classic streaming example:
File.stream!(""source.txt"") # source
&String.capitalize/1) # logic
File.stream!(""destination.txt"")) # destination
The power of this way of writing code has very little to do with files, and far more to do with the way in which the `Enumerable` and `Collectable` protocols separate the concerns at work. There is tremendous untapped potential here for declaratively integrating external services with program logic simply and succinctly.
By implementing Enumerable for SQS, and Collectable for a task cluster, a stream could be just as easily be:
SQS.stream!(""task-queue"") # source
|> Stream.map(&build_task/1)# logic
Tasks.cluster(""task-cluster"")) # destination
In my talk I'll cover concrete, practical ways you can encapsulate external resources in this way, yielding tremendous benefits with respect to clarity, versatility, and testing. I'll also go over some of the challenges presented by this approach, to include difficulties faced when making such streams proper OTP citizens.
Future changes to the standard library are likely to make great strides toward overcoming these difficulties, but they're already surmountable. My talk will show you how I've done it, and the decisions that you'll likely encounter along the way.
This talk will start with the basics of match types, sizes, units, and encodings. We'll then cover function heads and logical branching with a real life example of recursive parsing using pattern matching. Towards the end, we'll cover how to optimize binary matching for BEAM and get feedback directly from the compiler.
This talk is relevant both to those new to Elixir and those looking to learn more about how to tune existing code for BEAM.
Building a real-world application with Ecto has taught me to think about building queries as data pipelines. In this talk, I'll discuss how this mindset helps build composable, reusable queries in Ecto that are easy to read and easy to extend.
I'll show lots of code around building and composing query pipelines. I'll also cover my approach to pagination, release as the hex package Scrivener.
 - http://blog.drewolson.org/composable-queries-ecto/
 - https://hex.pm/packages/scrivener
One of Elixir's greatest strength are macros, and everybody knows that. However, macros are just one way to access a powerful and magical land: the compile time™.
In the last few months, I've been working on a gettext implementation for Elixir (under the direction of José). This library does most of its work at compile time.
In this talk, we'll have a look at what crazy things you can do at compile time as well as some examples of taking advantage of compile time in the wild (and in Elixir itself). We'll see how moving things from the runtime to the compile time has huge benefits in terms of performance, without sacrificing clarity and expressiveness. We'll dive into Gettext's source code as the main example of this.
Interoperability in Elixir
Dealing With the World Outside of the Beam
Ports, Nifs, and Interfaces, Oh my!
Elixir is an incredibly powerful language that sits on top of the battle tested and reliable Erlang ecosystem. This power is a big reason I am excited about building applications in Elixir. It enables us to write more of our application's stack in Elixir itself--especially compared to previous languages I have used.
Still, not everything can be written in Elixir. Sometimes you have to interact with the outside world, other tools, the operating system, or other code bases written in a completely different language. Thankfully, Erlang, and by extension, Elixir received a ""plays well with others"" award in kindergarten!
The Erlang ecosystem gives us several tools to work with other systems, processes, and code bases. In this talk, I'll cover the basics of each type of interoperability, as well as the pros and cons of each. These include:
Nifs: powerful native extensions
Ports: allow external programs to be treated like any other Erlang process
Jinterface: gives us interoperability with the Java Virtual Machine
These tools enable us to tap into the power of other ecosystems and make it easy to fit Elixir into our existing systems. This can be an excellent way to introduce Elixir into your organization and solve problems well-suited to Elixir.
As a young community, we have to resist the urge to reinvent the wheel for foundational libraries and instead look to the battle-tested awesomeness that is OTP. When designing complex systems with many moving parts in Elixir, we should ask ourselves the following question: has OTP done this?
In order to answer that question in this talk, we'll first look at the gen_fsm, gen_event, and gen_server libraries. We'll see some examples illustrating how, where, and why they should be used for building robust, fault-tolerant, and distributed systems.
A broad discussion of some of the built-in database options like ETS and Mnesia will follow. We'll examine the pros and cons of each system, and take a look at some examples.
Lastly, attendees will get a brief overview of OTP-style releases and how they can fit into modern deployment infrastructure.
Learn how naively copying a grammar file from one parser generator to another won't work. Go back to the beginning and learn about lexers vs parsers, but discover that the power of interpolation changes the computational complexity and forces the lexer to be a push-down automata instead of a finite-state machines and how this maps to Erlang implementation of the tokenizers in native Elixir.
Understand that there are different types of parsers and what each of their names mean. Learn why some of the Ruby-ish feature of Elixir's syntax (like no parentheses function calls and do block) favor some parser types or others and why this complicates, writing the intellij-elixir parser.
Learn how intellij-elixir uses Elixir and JInterface to check parser equivalence and found bugs in native Elixir.
Slides (Viewable): https://kronicdeth.github.io/the-road-to-intellij-elixir-1.0.0
Slides (Source): https://github.com/KronicDeth/the-road-to-intellij-elixir-1.0.0/tree/gh-pages
Project (Source): https://github.com/KronicDeth/intellij-elixir/tree/v1.0.0
Have you always wanted to contribute to an Open Source project, but you're not sure how? The Elixir and Phoenix Framework communities are a great place to get started. In this talk you'll learn how to navigate the ecosystem, avoid missteps due to unwritten rules, find something to work on, and make your first contribution.
We'll start with the easiest things you can do, (ask a question! fix a typo in the docs!) move on to creating a bleeding edge project using the master branch of Phoenix so you can try out your changes, and go all the way through to building Elixir from source and patching the language itself.