axelson

axelson

Scenic Core Team

8) ElixirConf US 2018 – Growing Applications and Taming Complexity – Aaron Renner

ElixirConf US 2018 – Growing Applications and Taming Complexity – Aaron Renner (@aaronrenner)

Growing an application is hard. We started our app with the best of intentions and promised ourselves we were going to “design it right". However as the app grew, complexity increased, dependencies piled up, and changes that were once small now felt like slogging through mud.

Driven by the need to keep our sanity, we decided to apply ideas from Phoenix’s contexts and Domain Driven Design with the hope that we could put boundaries around the complex parts of our system and keep the code from turning into a tangled rat’s nest. This talk covers many of the lessons we learned along the way, including:

  • How to start tackling complexity by teasing apart the app into multiple layers.
  • How to simplify testing and reduce mental burden by defining contracts between these layers.
  • How to verify contracts using tools like dialyzer, automated tests and mocks.
  • How to document these contracts and use them to guide the application design.

After applying these ideas to our codebase for almost a year, we’re eager to share our experiences and provide strategies you can use to tame complexity in your own applications.

Audience: Intermediate
Topics: phoenix

All talks are available in the ElixirConf US 2018 Talks List or via the elixirconf2018 tag

Most Liked

slashdotdash

slashdotdash

The behaviour/impl module and separate implementation approach is used by the new Elixir Telemetry library.

aaronrenner

aaronrenner

Phoenix Core Team

I know it’s over a year later, but I just posted an in-depth article covering the layering and swapping mechanisms I gave an overview of in this talk.

LostKobrakai

LostKobrakai

I‘ve not had a look at the repo yet, but it‘s probably created by driving the point of the talk all the way to make a point.

On the other hand having clear interfaces is something, which is by no means inherently OO. Interfaces are something your code has even if they‘re not written out somewhere explicitly. At the least you should have it as soon as there are multiple implementations, which can be switched out (and as @josevalim argued when creating Mox, this stands also if a second implementation is just used for testing). This was one point in the talk, that it makes testing easier. But I‘m with you that it‘s quite a bit of ceremony if there‘s only one implementation. It just makes is super clear, which functions are meant to be public interface vs. what is implementation detail. In bigger projects, this might otherwise not be as clear.

Naming errors is imo a good thing like anywhere else in programming, especially for the common cases, which are the ones one has to deal with all the time. It could‘ve been an atom instead of an exception struct, but the latter has the ability to later be enhanced with metadata, while with a plain atom to start with the interface would probably need to change in a backwards incompatible way.

Where Next?

Popular in Talks Top

axelson
by @takasehideki Can you imagine that your Elixir code will be executed as a hardware circuit on an FPGA? The FPGA (Field-Programmable...
New
axelson
ElixirConf 2017 - Streaming Video with Elixir - @johnwahba Running a video stream is challenging. You can’t ...
New
derpycoder
QUIC protocol support coming to BEAM. As of now, I am using Caddy in front of Phoenix server to experience H...
New
axelson
ElixirConf 2017 - Elixir by the Bellyful - @bryanhunter Elixir makes me happy! Since 2007 I have been on the...
New
AstonJ
Kicking this thread of with the now infamous talk by Dave Thomas (or at least the best recording of it I can find) - please add any you f...
New
axelson
ElixirConf 2017 - Working with legacy databases in Ecto - @geo Often when starting an Elixir or Phoenix proj...
New
kokolegorille
Lonestar Elixir 2018 videos are starting to pop up :slight_smile: https://www.youtube.com/channel/UCOy-_b9bqjokoWX9Hg5ZgUg Day 1 Chris ...
New
axelson
We’re now on the day 2 talks! ElixirConf US 2018 – Understanding Elixir’s (Re)compilation – Renan Ranelli ...
New
axelson
by @jon At PagerDuty, we run our systems across many geographic regions to ensure we’re always available, even when you might not be. E...
New
ElixirConf
ElixirConf: ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts Comments welcome! View the <span cla...
New

Other popular topics Top

sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
danschultzer
None of the current solutions worked well for me, so I went ahead and built a user management system from scratch. This project took far...
548 29603 241
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 41989 114
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement