Skip to main content

Serendipidity or Law of Attraction?

· 3 min read

Sometimes, things just happen. Just at the end of the work day, my colleagues were talking about this thing they called “Law of Attraction”. Not sure where they got it from. What they were referring to is that when one thing of a nature happens, it seems usual, even natural, to have another event of a similar nature occur as well.

Take for example, when we were taking the lift as we knock off work, we were teasing one guy among us about him leaving his motorbike keys in the office as he dug around his bag trying to look for it. It then happens that another lady (a stranger) who was also in the lift with us turned back after exiting the lift shortly, seemingly to return to her office to get something she had left behind. (One person searching for his keys lead to another person remembering something she left behind.)

At home, I was browsing the videos from the GoogleDevelopers YouTube channel and the latest one was “Webify Your Game“. Funny thing is, while I do Web development work, I don’t work on games, yet for some reason I clicked on the video and opted to watch it. The strange thing is that there were other videos that are probably more relevant to me before, but I never watched them.

The main take-away from the video is the ability to modify the design of the application (game) to stagger the loading of large amounts of data to ensure that the user experience is not disrupted.

The serendipitous nature of this video watching is from a time earlier in the day when another colleague returned from a meeting selling our Web application. He complained that, for some reason, a particular page did not load whereas the other parts of the application ran fine. And he tried refreshing that page three times – it just didn’t work.

Needless to say, that problem was not replicable in the office. And for some inexplicable reason, that page is a fairly simple one compared to the others that ran. So that got me thinking as to how to improve the application to avoid these kinds of problems as much as possible.

My final thoughts were to use the browser’s local storage mechanism to cache the model’s data which can be used to load the web page in lieu of the latest data being fetched from the server. A staggered approach yeah ;)

And one of the items that were considered was how long before the cache data should be used. Instinctively, I decided on three seconds. Coincidentally, the video also cited three seconds as the amount of time a user can tolerate before switching to another site.

In the larger picture, this “revelation” wouldn’t probably have mattered anything to anyone. But it does make you wonder about the natural affinity things and events seem to have around each other. Much like how when you are queuing up for food and the queue seems to be annoyingly long and then when you have gotten your food, the stall owner then stand around with nothing to do. The next time you queue for your food, maybe that’s something you can think about.