Beruflich Dokumente
Kultur Dokumente
It’s been a while since my last writings. Hhhhmm … lets write about social network, Twitter.
(Images will be updated soon :P)
Let’s see the time frame from popular social network I’ve been following recently;
2004 : Time of Friendster, anybody in Indonesia get crazed and hunting for testimonials from
others :P
2008 : Year of Facebook, by that time FB still have that sleezy user interface and not booming yet in
Indonesia.
Idea(s) to elaborate about Twitter has been stuck in my mind for months.
I want to decrypt it components into logics and tables. Lets use reverse engineering shall we ;)
Actually we can firmly slice Twitter from its web services by translating its functions 1-by-1.
Just go to this link http://dev.twitter.com/doc/recent. You can read and translate its logic into your
own but I like it when I can translate it by my own thoughts. In here, I’ll only slice pieces of it relates
to following & followers + public timeline + home timeline + DM.
Before I continue with this writing, I should remind u all that this is just my personal opinions.
I don’t want to start any flame wars here.
Any comments should be addresses in appropriate manners. I’m open for any suggestions,
comments, and critics.
How Twitter determine friendship is different than other Social Network, such as Facebook.
In Facebook/Friendster when we already confirmed a person as a friend, automatically we will also
added as their friend.
Its a two-way trust, under the hood aka Database, query’s working to determine this friendship will
have to do some ‘heavy duty’ to display our friends list.
But for FB/FS their query will be much complicated because it will need to make a JOIN function
with the same table that already been aliased to another name.
SELECT f1.follow_id
FROM friendship f1 LEFT JOIN friendship f2 ON (f2.user_id = f1.follow_id)
WHERE f1.user_id = ourID AND f1.pending = 0;
Why using aliases for the same table and join it? Because this query will be useful to check whether
we already being inserted on as friend on column follow_id or user_id
2. Public Timeline
To display Public Timeline, we will need to have a join with table ‘friendship’ + ‘via’
Details:
@aryonp = p.username
(lock/no lock icon) = p.private
blablabla … = s.comment
in reply to someone = s.reply_id
via something = v.name
3. Home Timeline
I have notice that using the same table ‘status’ we can create also DM function, just change its query
into this to display all messages relate.
DM can only be sent if you follow your friend and he/she following you back.
Inbox:
Outbox:
Well, that’s all from me. Any comments or else can be address to below comment box. I hope this
can be an inspiration for u all to see whats going on behind the Twitter curtain ;)
Twitter – Under the hood by M. Aryo N. Pratama is licensed under a Creative Commons Attribution-
NonCommercial-ShareAlike 3.0 Unported License.
Based on a work at www.halilintar.org.
Permissions beyond the scope of this license may be available at http://www.halilintar.org/.