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
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!
Last Post!
kuon
Yeah there is a lot of coupling beween everything is Account that’s why I did split it with defdelegate but ideally, the Account.Users module should not exist. But I it does because otherwise Account becomes way too big to manage.
Popular in Discussions
Other popular topics
Latest Phoenix Threads
Chat & Discussions>Discussions
Latest on Elixir Forum
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









