Should functions be connected to their actor or what they are acting on?

I have an app where users can be invited to join a group. I have a function called get_pending_invites(User). Should this go in MyApp.Users, MyApp.Groups, or MyApp.GroupInvites?

I don’t mean Actor in the OTP sense.

1 Like

If you want to name function get_pending_invites then I would put it into MyApp.GroupInvites, however, if I would like to put it into MyApp.Users, because I just would like that, then I would call function get_pending_group_invites because maybe you have in system other invites too, not only group.

P.S. This is only my personal opinion, and I think this topic is more about how it’s easier to maintain the code for you or others in longer run.

1 Like