Skip to content
0:00 / 0:00

#elixir#phoenix#phoenixcontexts

ElixirConf 2023 - German Velasco - Using DDD concepts to create better Phoenix Contexts

ElixirConf

13K subscribers • 28 videos on Hallway

YouTube
  • Recommended by 3 people: 3 in engineering communities.
  • Presented by German Velasco

Intermediate. Assumes working knowledge.

13K views3 years ago3 recommendations

Software designWeb developmentDomain-driven designSoftware architectureElixir and Erlang

German Velasco explains how to apply domain-driven design concepts to structure Phoenix contexts and avoid bloated namespaces.

Leave comments at: elixirforum.com/t/elixirconf-2023-german-velasco-using-ddd-c… Phoenix contexts were introduced in Phoenix 1.3. Four minor versions later, we’re still confused when trying to apply them in our applications. Contexts may make sense in theory, but it is hard to figure out just what makes a good context when it comes to practice. At least I know I’ve created many “contexts” that became… glorified junk drawers. That’s because Phoenix contexts are generic: they’re a namespace. So, even though they give us a nudge in the right direction, they don’t provide enough guidance to implement our own successfully. That’s where domain-driven design (DDD) can help us. Using DDD’s concepts, we can create different Phoenix contexts based on their role! So, join me as we walk through different types of Phoenix contexts we can use in our applications. Some will be DDD’s bounded contexts (different from Phoenix contexts), others will be DDD entities, and others will be DDD aggregates. By the end, you’ll have a more extensive toolset for creating Phoenix contexts and a new lens through which you can organize your Elixir modules.

Why it's here

3 people recommend this

What people say. Recommended for developers looking to structure Phoenix contexts and manage complexity in Elixir applications.

Moments people linked to

u/warbornxin r/elixir • Recommends

On “Course recommendations for a novice programmer?”

I wrote this list when I was introducing my team to Elixir and Phoenix, hope it helps! # List of awesome resources to learn Elixir and Phoenix ## Begginner #### I recommend the following for starters: Developing With Elixir and OTP One of the best courses about Elixir. From Ruby to Elixir If you have experience with Ruby/Rails, this is a great book to learn the language. Phoenix on Rails Learn Elixir/Phoenix through your experience with Ruby on Rails. LiveView LiveView is a cutting-edge technology of the Phoenix framekwork to make interactive/real-time applications. Elixircasts Video tutorials covering a wide range of topics on how to accomplish tasks using Phoenix. Elixircasts: Wor…

u/germsvelin r/elixir • Recommends

On “Why were Phoenix Contexts introduced? A brief history ”

Totally agree on the emergent contexts. I think that's one great way to create them. I typically do it one of two ways: 1. For new apps where you're still exploring and understanding the domain: make them emergent by putting the code in the controller and later extracting it. Or like you said, have a placeholder (could be the plural of the schema or something like that) where you put the functions until you discover the context. 2. For more established apps -- or whenever you have access to stakeholders with a lot of domain knowledge -- use the domain's subdomains as the contexts. I explored that a bit more on an ElixirConf talk if interested: [video
4View on Reddit

u/Akaibukaiin r/elixir • Recommends

On “Taming Complexity - Structuring Phoenix Contexts”

There was a very good talk in this year ElixirConf regarding the subject of context: link to this video

u/Akaibukaiin r/elixir • Recommends

On “Taming Complexity - Structuring Phoenix Contexts”

This might help: link to this video