wolfiton

wolfiton

Context separation or decoupling conventions and naming

Hi everyone,

Explanation:
This questions is created to establish the best way to deal with separation of big context like a blog in smaller pieces.

The main problem is that a Blog context can get very big if all the schemas go under one context.

Problem:
I wanted to ask if the what is your opinion on the following scenario:

Article context with schema Article and a migration Articles

This would look something like this

YourApp.Article.Article when you will need to reference the schema which might be confusing

So I thought of making the naming more descriptive like this:

YouApp.ArticleContext.ArticleSchema

Question: Is there a better way to name this modules: context and schema for easy readability?

Thanks

Most Liked

baldwindavid

baldwindavid

This post helped me in trying to organize contexts… https://devonestes.herokuapp.com/a-proposal-for-context-rules

baldwindavid

baldwindavid

I do something similar for the blog part of my app, though your contexts are sliced thinner than mine.

MyApp.Blogging.Articles.Article

Blogging is the context
Articles is the sub-context
Article is the schema

All of the functions related to articles are in Articles.

The Blogging context then delegates to those functions…

alias MyApp.Blogging.Articles

defdelegate list_articles, to: Articles
defdelegate get_article!(id), to: Articles
...
LostKobrakai

LostKobrakai

For the question of where to separate things out I usually think about: Which things change together or independently (in the future). Which changes to a part of the system require changes to another part of the system (coupling). It a context is one cohesive part of your domain, but you feel it’s to big, first try to separate stuff within the context, before you move things out to their own contexts and them effectively becoming a part of your whole apps api.

Where Next?

Popular in Discussions Top

jswny
I would like to better understand what the advantages/disadvantages of umbrella applications are compared to structuring your app as as s...
New
lorenzo
Hey everone! I created a prototype for my app using Nodejs for the api. But the framework I chose wasnt great (in general theresnt any g...
New
IVR
Hi all, I’ve seen a number of related threads in the past, but I’d still be very curious to hear an up-to-date opinion on this topic. I...
New
jer
I’ve been using umbrellas for a while, and generally started off (on greenfield projects at least) by isolating subapps based on clearly ...
New
und0ck3d
Hello everyone! A few days ago I’ve created a topic here about how people were creating CMSs with Elixir and Phoenix. I’ve been studying...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
jesse
Hi everyone, I hesitated to post this here because I don’t want you to think I’m spamming, but I’ve been working on a Platform-as-a-Serv...
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New

Other popular topics Top

malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 42920 311
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
johnnyicon
Hi all, I’ve just started learning Elixir and Phoenix Framework, so please pardon my n00bness at this stage. I’m trying to use Postgres...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 52341 488
New
RisingFromAshes
I’ve read in another post that it may be possible with a router helper - but I couldn’t find an appropriate one, and tbh, I’m still just ...
New

We're in Beta

About us Mission Statement