Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8305157
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:01:13+00:00 2026-06-08T18:01:13+00:00

For example, let’s say we have User s, which are related to Group s,

  • 0

For example, let’s say we have Users, which are related to Groups, Events, and other Users by Memberships, Rsvps, and Friendships, respectively.

Where should we refer to instances of objects by their functional/relational names (“member”, “rsvp”, “friend”) and where should we refer to instances of objects by their class names (“users”)? i.e. When is a User a “user”, and when is a User a “member”?

Which do we use in the Model? (group.rb for this example)

has_many :members, through: :memberships, source: :user
# vs.
has_many :users, through: :memberships

Which do we use in the Controller? (groups_controller.rb in this example)

@members = @group.members                    # or @group.users, depending on the model
# vs.
@users = @group.users

Which do we use in the View? (groups/show.html.haml in this example)

- @members.each do |member|                  # or @users.each, depending on the controller
  = "This is a member named #{member.name}"
-# vs.
- @users.each do |user|
  = "This is a member named #{user.name}"

It seems more readable to use the functional/relational name, but easier to remember with the class name. Has anyone found (or invented!) a thorough and logical convention for this sort of thing?

Edit:

  1. changed “easier to remember and refactor” to “easier to remember”
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:01:16+00:00Added an answer on June 8, 2026 at 6:01 pm

    My convention is to use always the function/relation name. I don’t understand why do you say it’s easier to remember and refactor with the class name. I personally find that everything is easier when you use the function/relation name. It’s also more “flexible” because if tomorrow you decide to allow groups to be inside other groups, then member still has sense, yet users isn’t quite that right… Users or the class name is the “current” implementation/solution of what you are using… The functional or relation name is how that object will be used… It’s more related to the “interface” or what you expect it to have… So you are focusing on what thing it should do, and what it should solve, and not in how it does it ATM.

    It’s also generally easy to deduce the type or possible types of something by looking at the context, and or/running tests, so I think that the functional relational name adds a lot of useful information, while the other adds useless information, that might be more adversary than good.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A simple example: Let's say I have one alias being sourced somewhere as: alias
Please indulge my simplistic example: Let's say I have 1 million pages on my
Maybe a silly question but here goes anyway. Example: Let's say I have one
I have a function which is constant to its argument, for example let is_prime
I'm struggling with the F# type signature notation. For example let's say you have
Really simple example: Let's say I have this table: ID Name GUID1 John GUID2
For example let's say I have an app that uses $_SESSION['user_id'] . Now if
Should you always create unique keys whenever possible? For example let's say I have
I'm having some trouble writing a query. For example: Let's say I have just
I have 1 or more items in an array, for this example let's say

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.