kuon

kuon

Naming context, again

I have read many discussions on the forum about this topic, but I still have a few “wonderment”.

Basically, my folder structure (module name) is:

lib/my_app
├── account                  MyApp.Account
│   ├── access_tokens.ex     MyApp.Account.AccessTokens
│   ├── roles.ex             MyApp.Account.Roles
│   ├── users.ex             MyApp.Account.Users
│   ├── schemas
│   │   ├── access_token.ex  MyApp.Account.AccessToken
│   │   ├── role.ex          MyApp.Account.Role
│   │   ├── session.ex       MyApp.Account.Session
│   │   ├── user.ex          MyApp.Account.User

The MyApp.Account module is mostly composed of defdelegate that forward to submodules, like MyApp.Account.Users. Code outside of account folder can only interract with the MyApp.Account module.

The files in schemas are just ecto schemas. I removed the Schema in the module name, because it’s a bit long and doesn’t bring anything.

Now, I am quite happy with this, but I have an issue with the plural names MyApp.Account.Users for example.

It is a bit hard to spot in the filesystem and when searching for the file.

I was wondering if you had suggestions for a suffix.

Like MyApp.Account.UserContext or MyApp.Account.UserManagement … (those two does not convince me).

Most Liked Responses

christhekeele

christhekeele

I know they’re not super common in instructional material, but I find pluralized module names to be quite useful. They’re not that uncommon in Elixir projects!

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
vans163
So useless benchmarks aside, Its possible to write a webserver that can serve 300k requests per second (perhaps more with optimizations)....
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
thojanssens1
It would be nice to be able to define a redirect from one route to another from the router.ex file. E.g.: redirect "/", UserController, ...
New
mmport80
I have put far too much effort into Dialyzer over the last year or so - and basically - I doubt it’s worth the effort. It’s not as easy ...
New
arcanemachine
https://nitter.net/josevalim/status/1744395345872683471 https://twitter.com/josevalim/status/1744395345872683471
New
Crowdhailer
I’ve been hearing much about the new formatter and it’s something I have been keen to try. I find examples buy far the most illuminating...
248 19204 150
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
pdgonzalez872
If this has been asked here before, please point me to where it was asked as I didn’t find it when I searched the forum. Maybe a mailing ...
New

Other popular topics Top

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
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
gausby
I asked this very same question on twitter and got some interesting feedback, but I thought it would be a good question to ask here as we...
1207 39297 209
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

We're in Beta

About us Mission Statement