Time is a fascinating thing. It seems very easy to grasp as a concept for everybody, but when you ask a physicist, things become surprisingly complicated. In computer science, time is often ignored (with the exception of real time systems) when programmers implement software. When events need synchronization of some sort, programmers resort to constructs that use abstractions. For example, if you want to synchronize two distributed processes, you could use logical constructs like semaphores to do this. This is actually much easier than trying to accomplish the same with time based synchronization. Time based synchronization requires that distributed processes have their local clocks in synchronized: only then (and with some clock synchronization algorithms) it is possible to achieve time based synchronization.
Generally speaking, abstracting from time is a good idea and helps programs to be clean, understandable and efficient.
With Tweetflows, I came across an interesting issue concerning time: complex Tweetflows consisting of several commands that are connected with each other need to be published in the reverse order on the timeline of the users. The reason is that on the timeline of the user the newest entry is always on top, because the timeline represents events that go into the past. Computer scientists refer to this kind of structure as a stack, or LIFO queue.
This has the nice side effect that I’m able to integrate dependencies between Tweetflow commands very easily: each Tweetflow command has a unique URL (like Tweets) after it was published. For example the URL
https://twitter.com/ikangai/status/280707058456735744
refers to the Tweetflow command
SR download.qlauncher http://itunes.apple.com/app/id381663352?mt=8/#123456
Thus, after a Tweetflow command is published, we can use its URL in subsequent Tweetflow commands. However, this only works, if Tweetflow commands are published in the reverse order on the timeline of the user. Let me illustrate this with a simple example. We want to ask a user to do three things. First the user should download an App. Then, the user should take a screenshot of the App and upload the screenshot to a web site. Translated into a Tweetflow (without the reference to other Tweetflow commands) this looks like this:
SR download.qlauncher http://itunes.apple.com/app/id381663352?mt=8
SR make.screenshot qlauncher
SR upload.screenshot http://www.ikangai.com
When you publish this in the order of the steps (download app, make screenshot, upload picture) on the timeline of a user the result would look like this:
SR upload.screenshot http://www.ikangai.com
SR make.screenshot qlauncher
SR download.qlauncher http://itunes.apple.com/app/id381663352?mt=8
Thus, we need to publish this in the reverse order to make it understandable for people and to have a meaningful structure. Now, if we include the references the to next Tweetflow command (remember: Tweetflow commands are published in the reverse order and therefore can be referenced) we get this:
SR download.qlauncher http://itunes.apple.com/app/id381663352?mt=8/#.281297742746251264
SR make.screenshot qlauncher #.281297672684584960
SR upload.screenshot http://www.ikangai.com
The number after the hashmark is the reference to the next Tweetflow command and is the control structure of the Tweetflow commands. The reference depends on how the social network handles its data: with Twitter the reference number is part of the URL that points to the Tweet:
https://twitter.com/ikangai/status/281297786471841792
As always in computer science, completing one thing is never enough
. Now that we have managed the publication of Tweetflows we still need to look at the execution of Tweetflows and the effects on the timelines of users with respect dynamic changes in Tweetflows, constructs like splits or joins and the management of conditional execution of Tweetflow commands.
your ikangai science team