Listened to @BeamRadio1 Episode 18: Code Heresy with Chris Keathley.

Today's panel: @lawik @akoutmos @_StevenNunez @redrapids, @sm_debenedetto, and special guest @ChrisKeathley.

Summarizing some interesting and controversial opinions today 🧵 0/24

#myelixirstatus #elixirnewbie
By far the most loved library on the Panel today was Telemetry. Telemetry powers monitoring and observability in elixir projects and provides a consistent interface to do so. Other mentions were OTP, Livebook, and site_encrypt.

When members of today's panel came into the Elixir Industry, they found opinions they like and trust from the Elixir community but also questioned established norms. Thus today's topic: Code Heresy.

So let's throw out our perceived notions from other runtimes and languages to consider alternatives.

These are strong opinions that may cause controversial feedback.

But first, let's understand design.

What is the purpose of design? To create an extensible system to build quickly in a complex domain and allow for future growth.

A bad design can be: over-designed, under-designed, and designed in the wrong direction.

Future growth does not mean "future-proofing." Future-proofing is an example of over-design or designing in the wrong direction. You attempt to read the future of your application and guess incorrectly, leading to unnecessary complexity.

Accommodating future growth does mean getting the design right for what you know. It means taking into account how much you need to design given the potential longevity of the project.

Signs of overdesign include going for scale to start, designing too early before you have enough information to know which abstractions are correct, and caching before it's necessary.

Adding caching to your application is particularly dangerous because you couple yourself to time. Coupling yourself to time is one of the worst things you can do, as it makes your system nearly impossible to reason about.

The best philosophy to design is that if you don't need it, don't do it. If a function does, then use a simple function. However, it's time to design and abstract ideas when the cost of change becomes high.

If you have to wade through multiple system layers for any specific change, that's a sign of overdesign. Instead, a well-designed system should hide the complexity of the lower layers so that you never need to worry about them.

Complexity is a multiplication of the actual domain complexity * the number of times you need to care about it. Thus, reducing the number of times you need to care about it to 0 eliminates complexity.

The network stack is a perfect example of hiding complexity. When was the last time you needed to care about TCP or packets?

Now that we have a better understanding of the goal of design, it makes sense why @ChrisKeathley doesn't like the current context pattern established by phoenix.

For..context (sorry). Chris defines a context as the pattern of generating files done by phoenix.

Core Criticisms included: Contexts do not hide layers below them, Contexts do not hide any complexity inside them. Contexts expose ecto to you. In Contexts, any specific change often requires editing the controller, view, schema, and multiple system layers.

This may even be a fundamental problem with the Model View Controller pattern. Controllers are by design not reusable, and the layers in the system are not generic enough to allow you to ignore them. Likewise, contexts are also not reusable.

Instead, consider moving your layers up and putting more control in the call site. Chris discovered this pattern when dealing with large traffic applications, and one of the easy ways to hide poor performance choices is by hiding calls to the db.

Graphql attempts to do this by giving the client the ability to control what data it retrieves. However, it brings other problems with it.

In the same pattern of thought, you may consider moving control to the LiveView.

To accomplish polymorphism in Elixir, you have several methods: data and functions, behaviors, and protocols. In many cases: the best dependency injection is passing arguments to functions.

This allows you to take apart the truly reusable abstraction and the specific usage.

For example, you may have a function that takes in a function or even a module. Then calls that function or module with specific arguments.

Also talked about was the Norm library. This library allows you to create contracts of input and output using a rich data language.

Chris loves conversations about how to improve how we write software, but not just how we improve a little bit. How do we improve by an order of magnitude difference? He's always on the lookout for the next idea that helps achieve that goal.

Because of this, Chris is no stranger to strong opinions that cause controversial feedback.

I think it's important to remember Chris is trying to make the software industry better, even if you disagree.

As usual, I just summarize the information. I do not represent anyone at @BeamRadio1 nor do I agree with (or understand) everything discussed 😅

But I do learn a ton and have a lot of fun sharing.

For their full views see the original episode:…


• • •

Missing some Tweet in this thread? You can try to force a refresh

Keep Current with Brooklin Myers

Brooklin Myers Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!


Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @BrooklinJMyers

16 Sep
Todays summary: Watched @lawik's LiveStream: Video: Nerves, Livebook & small displays (eInk, OLED)…

How @NervesProject helps you get started with Elixir and IoT without needing to know a lot about the hardware.


#myelixirstatus #elixirnewbie
Raspberry pi is a great way to get your start in IoT, and Nerves and Livebook take that even further. Cool enough: the first real Elixir code Lars wrote was for the Rasberry Pi Zero.

You can sandwich a Rasberry Pi and an eInk display together. The Rasberry Pi runs your application and your application can use The Libraries Inky and Chisel to write to the display.

Read 14 tweets
15 Sep
Listened to @ThinkingElixir with @cadebward @bernheisel and @brainlid and guest @voltonez

OTP Certificates Woes with Bram Verburg.

On September 30, 2021, the root CA certificate DST Root CA X3 will expire. Here's how you stay safe. 🧵

Bottom line, before the end of September, if you are on Elixir OTP 23 or 24 you should upgrade to the latest patch.

specifically OTP or OTP 24.0.4
If you are on an OTP version older than 23, the good news is you will be unaffected so long as you do not upgrade your dependencies. You can freeze your dependencies in order to buy yourself time to upgrade to OTP 23 or 24.
Read 5 tweets
14 Sep
Today's summary thread! @ElixirOutlaws with @Adkron, and @ChrisKeathley. Episode 101: Bright and Tight.…

This episode was packed with information on handling errors in Elixir.

#elixirstatus #elixirnewbie

Error handling can be tricky, and can cause a task you would expect to take a single day to instead take a whole week!

This episode is focused on dealing with errors caused by working with external services. Anytime you're dealing with external dependency, you expose yourself to risk.

Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!

This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!

Follow Us on Twitter!