ssbb

ssbb

I am just trying to migrate my project to Phoenix 1.3 with new contexts mechanism. But I am not sure how I should split my schemas into this contexts. I read a lot about DDD and UL/Bounded Contexts in last few days, but all examples using something like large ERP systems. Also in DDD contexts used to “namespace” UL (ubiquitous language) within this contexts like Sales/Support/Analytics, etc. where Product will be used.

At other side @chrismccord used blog (post, comments) example in his ElixirConf talk. So it looks more like module organization (maybe like Django re-usable apps) and not business model separation to scope UL within this context. So how to know when bounded context should be used?

Whats if I have pretty simple project where I have no overlaps in UL? How to scale DDD down in this case? Maybe just use single context?

Should I think about contexts as module organization - Blog, Accounts, etc. or it is really DDD contexts like Sales/Support? I am confused when they are used together (at single ElixirConf talk by @chrismccord).

Showing Posts 1 to 10

ssbb

ssbb OP

Just found @anders answer:

but I still can’t get used with this Blog example. For me it looks like some re-usable code (maybe umbrella later) and not real Bounded Context in terms of DDD :frowning:

LostKobrakai

LostKobrakai

I know this might not help you much, but just try to work on your app instead of trying to hard to fit your context structure in some kind of predefined schema. In the end it’s your app; you decide what’s worth splitting up and what’s not. Also elixir makes it quite easy to move things around even at a later time.

For example in one application it might be best to leave those 2-3 functions related to registaration with the other user handling (auth, …), while in another one registering might be a quite complex task with multiple steps involved. In that case the registration is probably better moved in a own context separate from other user related tasks. When exactly it’s time to move things in different context is a decision you’ve to make on your own and as stated is mostly dependent on the very app you’re working on.

smithaitufe

smithaitufe

Sincerely, since bounded context was introduced in version 1.3, it has been very difficult working on something. It has however exposed me to a new way of thinking. It will be better if @chrismccord and his team furnishes us with samples like they do in aspnet core. This will help us to have good understanding of this approach. I love phoenix but I couldn’t use the version 1.3 on a new project that I am working on because I was confused. I went for dotnet core even though my heart is in love with phoenix.

michalmuskala

michalmuskala

One important thing - this is not bounded context. The primary aim is to encourage building modular code. If you use DDD and bounded contexts for this - it’s your choice. But it’s just modules & functions until you yourself decide it’s something more in your application.

smithaitufe

smithaitufe

@michalmuskala This is quite interesting. I voted for no context as proposed by Jose. However as a work around, I am thinking of using the project name as my default context as we would do in entity framework, eg LibrilleDbContext. This will hold all the tables that will be created. If need be for new context, I could then restructure it. However, this does not eliminate the need for samples. This will help ELIXIR and PHOENIX adoption.

I wish I am really good like you in Elixir. You are always there to talk to me whether at slack or here. Thanks

StanBright

StanBright

It’s the same with me. It feels more difficult working with Phx 1.3 compared to 1.2. However, I believe that’s because I’m too used to the Rails way…

LostKobrakai

LostKobrakai

It’s really interesting how different experiences can be. I’m not coming from rails, but the php world and I’ve had the best time rewriting a website in phoenix 1.3. First I played a bit with the context generators, but I found them to generate to much stuff (whole crud for each struct/schema), so I moved to creating my own contexts. It’s now super obvious where stuff is done as each context handles a single concern of the website. The whole web layer is only there to trigger stuff deeper in the application and to translate the returned values into markup / flash messages / …. I can use the whole app via iex without ever touching a single conn struct, nor any Repo.something() calls. Sure there was some time needed to get worm with that new approach, but I didn’t find that more difficult than trying to use phoenix 1.2 for the first time.

smithaitufe

smithaitufe

@LostKobrakai it’s good to know you find it very intuitive to work with. If you mind, can you share what you have? Perhaps the github repository if it is not private.

LostKobrakai

LostKobrakai

I can’t share the code, but it’s a website where people can register for a local event and I used the following contexts: auth, email, faq, newsletter, pdf, registration, ticketing and support. These where simply the things needed for the website and which felt to be distinct enough pieces of the whole. That’s why I think nobody can really tell anyone else what contexts they should use.

ssbb

ssbb OP

Thank you, thats what confused me. So contexts in terms of Phoenix means just module scoping and not real DDD? Just for @chrismccord answer at forums it looks like real DDD bounded contexts:

And when examples for different usages (module organization, DDD contexts to scope UL) appears here - I get confused

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews