I’ve been working on a social networking site for a while now, and here’s some basic concept I’ve learn from he process ( warning : These are based on my experience, maybe different with you, but what do i care… ) :
Basic Entity of a Social Network Site :
- User ( could be Person or anything else, think about social network for your pet )
- Message
- File
Expecting something more ? well, I tell you, nothing more than these I can tell you about ![]()
Anything else is built on top of those entities as extension, or simply connecting those three, in meaningful way of course.
Example :
- User connected to other User as friend
- User send Message to other User, to her / his friends, or simply make it available to public
- A File attached to a Message sent from one User to another.
- User make a mark ( a tag , for you pundits ) to a File, then send Message to other user about it.
- User make comment on other User’s Message with a File attached to it, a comment itself is another form of Message
Think about it, we can create so many other kind of relationship between those three objects, tangle it, twist it, of course it has to be in meaningful way, and then you got your social networking site, as simple as that, in a geek point of view.
So far, with all these basic knowledge about those three basic entities, I have abandon one CMS system ( Drupal, sorry for all you Drupal fans out there… ) because I then realize that generic CMS can only accomodate the relationship the way it want me to, not the way I want it to, well, maybe because I have insufficient knowledge for the CMS, or maybe I just mess around too much with it, I don’t know… All I know is that I can’t get scalability and speed by just plugging around all different add-on modules created by all different people and way of thinking and then try to configure smoothly as if it was all come from same people. It was simply hard to imagine how to scale up, if early in development phase you already have at least 40 tables in the default database ( yaiksss… ), not to mention the way add-on, modules, and hooks works… with more than 20 modules installed, a simple process like saving a node will take significant time since the system will have to enquire which hook implementation should be triggered, and amny other part of the system need to be triggered to keep everything in sync.
I tell you, it was like fishing with a shot gun… really, you are on boat, aiming for a fish with your shot gun, fire up, and then … the thundering sound will drive away the fish , along with everything else that can move, and the shot gun kick back will send you off the boat on the other direction
… not good, not good…
I move on rewriting the whole thing, using CodeIgniter, a sleek simple MVC based PHP framework, and so far I get by with only 15 tables in my database to carry all the data required by those 3 basic entities, including all the relationships between them, not a bad setup, as I expect I will end up with less than 20 tables when the site will be launched.
Okay, I admit, I do a great deal of denormalization, because I need speed and less query, the wisdom came from my mobile content days… And I also feel sick about table joins, so I’d rather make the DBAs and business application programmers disappointed, than make my life less joyful, couldn’t care less about their feelings anyway, if you ask me… After all, theory is good, but when you have to face real world, all you can think of is how to get there in simplest, fastest way possible.