Settings

Theme

Modeling mutual friendship

minimalmodeling.substack.com

30 points by evilsimon 5 years ago · 2 comments

Reader

mrblampo 5 years ago

I definitely thought this would be philosophical, not technical, based on the title, and I got excited. "Modeling mutual friendship" is definitely something I want to do for my kids, for example.

allknowingfrog 5 years ago

I've run across this problem before and ultimately decided on the two-record solution. I reasoned that it's entirely possible to have a non-mutual friendship. The table ends up having a "user_id" and a "friend_id", with each record indicating that one user considers another to be a friend. A "friend request" can even be modeled as a single record, in which case, accepting the request creates the matching entry. The concept of "mutual" friends determines whether two users are connected and visible to one another.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection