Event Sourcing and CQRS are design patterns that are great for some domains. The Incident library will help implement them without compromising other parts of your application.
These are my personal notes about Elixir Daze 2017 where I had a really great time, enjoyed the learning and conversations.
Elixir Daze is considered (by the organizers) a more regional conference, but if you take the line up you will notice that is not that true, the talks are in an excellent level for subjects that matter, with the presence of some well known people from the community like Dave Thomas, Francesco Cesarini and Saša Jurić.
Elixir Daze happened in St. Augustine, FL, a pretty nice city, claimed to be the first one in the US, with lots of gift shops, places to eat and drink, beaches and a nice architecture. I need to come back here with my family and enjoy the ocean, something that I couldn't do this time.
The conference for me started one day before, at O'hare airport I met some folks from Hashrocket (I know them from the Chicago Elixir Meetup they organize), they were in the same flight to Jacksonville and I got a ride to St. Augustine, thanks for that, I really appreciated our conversation as well.
Conference Day 1
Keynote: Dave Thomas
There is no doubt that Dave Thomas has lots of knowledge to share, every time I see or watch his talks I take home something that changes the way I was thinking about something.
His keynote was basically about 3 libraries, Quixir, Diet and Jeeves, but it is not the libraries that got me but the reason behind their existence.
Quixir is a simple property-based testing framework that can be used inside any ExUnit test. Property-based test is something for sure I will deep dive this year, it enhances implementation design and bug coverage.
Diet is a DSL for writing your program logic as a sequence of trivial transformations. The nicest thing for me is the ability to keep history of the transformations as steps.
Jeeves is library that transforms regular modules into named or anonymous singleton or pooled GenServers. It is an abstraction that takes the boilerplate out when creating GenServers and can be an easy starting point for Elixir learners to get into the OTP world.
The ABCs of OTP
Jesse Anderson explained in a very nice and didactic way the major points of all components of a traditional OTP application, including supervisors, supervision tree and GenServers.
I really liked the analogy of power on/off to exemplify what a supervisor really does, that it is put the process that had died back in an initial and healthy state. I will gonna use that when explaining the same thing if you don't mind.
Observer Driven Design
In this talk Omid Bachari showed us some examples of how we can use the observer as a design tool and not only for debugging/inspection.
As processes are very important pieces in an Elixir application, relying on a tool like observer will make you not just implement better but also teach you some Erlang internals.
Embrace the database with Ecto
Ecto is a powerful wrapper and DSL for databases, and Josh Branchaud touched some interesting points in his talk.
The database is your friend.
The importance of the data for your business as an asset, so data integrity is critical and the quality of Postgres for web application storage.
Ecto allows you to leverage all of the beauties that Postgres has in terms of constraints and functions. Also, it treats queries as data structures, so composition is really easy to retrieve anything from the database.
Slides: Embrace the database with Ecto
Stronger than fear
Ed Finkler gave the first, let's say, non-technical talk, an open mind message to all of us.
We saw how difficult is in some places to talk about mental illness and how that can affect your daily work.
Communities are about people, not code.
Of course, if you are an engineer manager or team lead, the benefits of this talk and role expectations are more connected but my take is that as a team member everyone is accountable for each other. A team with a weak point will become a weaker team.
Slides: Stronger than fear
Get cooking with Nerves
The first talk about Nerves was really great, step by step on how using Nerves to work with embedded devices.
Garth Hitchens that also gave a Nerves training in the day before (I missed that), showed us how easy it is to develop, burn a firmware in a SD card and play along with Raspberry Pi in a network.
Its all about the journey
The journey of learning that ended up becoming a really cool product. Tetiana Dushenkivska and Keith Salisbury had an incredible idea, based on their story of using post it cards with Elixir concepts, tips or questions/answers. Now the post its are available as decks with 52 cards each and soon at Amazon.
Interesting, besides the great idea, it is how the production of the cards works. The product is not just printing material but all the questions and answers are in a production workflow done in Elixir that is responsible for download the spreadsheet with Q/As, generate tests at runtime to validate them and export PDF files.
I really would like to post some pictures here but I was not lucky enough to get one from the raffles...
Slides: Its all about the journey
Building communities of smart things takes Nerves
Another great talk about Nerves with a focus in IoT as a community of smart things by Jean-François Cloutier with a really content dense slides, a must see.
The cognitive architecture slide is a very nice summary in how the data flows and how each component reacts. Also, the way he implements each components of the architecture as a supervision tree is pretty cool. At the end I had the opportunity to ask him few questions regarding the development cycle.
It is really hard leave two talks about Nerves on a row and don't have a Raspberry PI to play along.
Can Elixir bring down Phoenix?
Bleacher Report is one of the companies that are showcasing the power of Elixir nowadays, the migration they had from Rails was recently published and displays that.
The talk presented by Ben Marx tackled some points of load testing and why you need to make sure your system is ready for traffic spikes that can happen anytime. In their case, any news can become a catalyst of a massive traffic.
Libraries like locust will help perform load testing but bottle-necks can be from many kinds like database pool size, http connections and so on, so the ideal is know your system and define different strategies for each case.
Conference Day 2
Keynote: Saša Jurić
For me, the best talk in the conference, I really like the deep dive Saša Jurić gives in his talks. I had watched some of them online, it is nice that you have the ability to decrease the video speed. Because he speaks fast, super fast, and the content is not trivial, so, you need to pay attention 100% of the time or you get lost.
Erlang VM is the most important thing in Elixir.
His quote above is not just a truly sentence but for me is the path for understanding a lot of the things in the Elixir world.
Different than Ruby where I went too early to Rails, with Elixir I am not just concentrating my learning on internals, OTP and Erlang VM to become a better Elixir developer but I am enjoying it and I am fascinated.
Knowing Erlang VM will help you identify the cases Elixir will do a good job and also show the cases it won't.
Processes are first-class citizens, knowing how the schedulers coordinate them and the ways you can retrieve information from processes will save you some pain during a debugging situation.
Runtime guarantees are much more important than syntax, developer friendless and ecosystem.
Slides: Keynote: Saša Jurić
Monitoring and pre-emptive support
To be able to support a business and be successful, an application needs more than good business logic and clean code. With metrics, logs and alarms in place you will be able to know the the health status of your application, monitor business or system thresholds and tell what is going on in details.
Francesco Cesarini presented some cases when these complimentary pieces were essential for debugging issues and pro-actively support the business. Erlang comes out of box with different types of reports and tools, so with Elixir you get that for free.
Of course, you can continue to use third-party services that will aggregate logs, collect metrics and set up alarms for on-call situations.
Just because you can, doesn't mean you should, which doesn't mean I won't.
Yes, the title is long, probably won the contest of longest title talk at Elixir Daze, but it translates super well what Paul Lamb's talked about.
Erlang, and by consequence Elixir, is recognized with a language that can allow you do fancy things like hot-code reload, make your application run in multiple nodes and has a very solid concurrency model.
But when designing your application, also pay attention to the risks of each of these topics. It is not because you have a tool that does something that it makes sense you apply X or Y feature. For example, in the most of cases, your application will not need hot-code reload and simple releases rollouts will suffice.
My take is that this is also a scalability concern, from stage to stage your application will be concern some aspects of scalability and you should wise to figure out what is suitable and what is over engineering.
The other good point in his talk is ignore deployment solutions only because they cannot do X or Y, for example, Heroku where you cannot do hot-code reload or have your application acting as a cluster.
On the other hand, if you decide that your application case requires any of these features, you have to learn how it works, know the complexity involved and use the tools in place.
Using your umbrella
This talk by Chris Bell came in a very nice timing to me as I am working in a umbrella project now and applying some approaches of Domain Driven Design.
The concept of applications in Elixir helps you scale your application from monolith to choose-an-adjective-for-size-service, the advantages of splitting your system domains in umbrella apps are great in my opinion.
As Chris mentioned, there is no right way of doing these separation, mainly in the database side of things. You can keep many repos per app or you can separate one app to be responsible for durable persistence.
At the end of his talk I could chat with him about some ideas I have and regarding CQRS and Event Sourcing, something that he mentioned in the talk and also something I am using as well.
Slides: Using your umbrella
Beer: not just for your devs
Maureen McElaney talked about the challenges when organizing tech events no matter size, place or technology group. Also, the important things companies that support these events need to be aware of.
I kind of knew the hard points as organizer and all the time (and money) consuming that is in place, but what brought my attention the most is the supporter side.
You can't effectively support a tech community until you understand who they are and who they serve.
And the main points for me are that companies need to think in a long term with no expectation of something in return right way, and companies need to encourage employees to participate in these communities.
Slides: Beer: not just for your devs
Live like a hippy
Databases are useful and almost every application will have at least one type of durable persistence. But Amos King pointed out some consequences of having this kind of dependency in your application, things that are I consider truly concerns and in the most of cases ignored.
Depending the type of data you have (permanent, changing or temporary) you can use different strategies to persist. Agents are very suitable for storing temporary data, they are fast because data will be close to the process and no dependence involved.
He showed one piece of application where he evolved the supervision tree and agents were used to store temporary data and also a failover actor.
In this talk we had the first "shots fired" moment as Josh talked in the previous day about the database is your friend, and Amos we don't need databases, but as I want to be friend of both, my take is that not always you need to persist using a database and you can have the benefits of that, but when you need it, choose Postgres :)
Slides: Live like hippy
Let’s generate tests
I was already convinced to learn more about property-based testing but after Chris Keathley talk I could understand better the comparison between TDD and property-based test.
The example he used was very clear (and super funny too) to demonstrate how some desired benefits of TDD are not achieved the most of times, and how property-based tests will get you the same benefits in a more solid way.
Libraries like Quixir that I mentioned in Dave Thomas' keynote are helpful.
Tackling authentication with Phoenix
Passwords in general are a big issue in security, the majority of the people doesn't care, and how your application manages authentication and authorization can ruin your business. The talk by João Moura was about what we can do to manage well this subject.
Nowadays we have some libraries available that will help with authentication and authorization, they are similar but with slight different approaches.
He covered and explained the differences between coherence, uberauth, pot, guard and keeper (library that he is developing to work as Multi Factor Authentication), and the usage of Json Web Tokens.
In the last talk Jason Cummings covered Elixir macros. Macros allow meta programming and are the kind of thing you need to know before you start using it, and when you should avoid them.
He covered what macros are about, when we need them, when we need to avoid them and the ways we can create them.
Using the library he created, spotify_ex, to interact with Spotify API as an example, we had a chance to see what the macro does in their context and test them.
Only positive things, period. Being part of a community like Elixir is really uplifting, everyone is open to learn and advise. We know our journey is just starting and we have lots of stuff to improve technically and as a community but the upcoming chapters have good perspectives.
Elixir Daze has a very relaxed environment and I felt very comfortable talking with anyone, sharing experiences and make friends, I also had the opportunity to speak some Portuguese when I met Carlos Souza and João Moura in one of the breaks.