Skip to:

Re: Friends and Groups for BuddyPress 1.3



Just speaking strictly from a software design standpoint, calling someone’s friends a group does not make sense.

A friendship is a direct relationship between two people. It is a one to many relationship which is handled by using a lookup table that points back to the user table. It is just about the fastest possible relationship that you can have in RDBMS because both keys point back to the users table and the optimization of that query is killer if you have the right indexing. The only faster one would be a self join, for instance Bob is Jane’s spouse, which requires no lookup table.

A group however, is a one to many relationship, which is handled with a lookup table that acts as a bridge to a third table that holds the groups data. This is much different when it comes to querying. If friends are just Bob’s private group, it is going to make querying for relationships between two people very convoluted in many situations, especially where a fourth, fifth table or more is involved. There will be round tripping for data and/or nasty DISTINCT queries in many cases where it would not otherwise be necessary.

Skip to toolbar