Nov 08 2009

Predictions on the future of NoSQL

Category: Ideas,UncategorizedAleksander Kmetec @ 12:02 pm

These days new NoSQL databases are springing up faster than URL shorteners. Even incomplete lists are likely to mention over 50 of them, most of them never heard of before. But even though they’re all being lumped together under the same name, they are so different from each other that there’s still a dilemma how to come up with a name which would describe them for what they are instead of describing them for what they’re not.

Nobody knows for sure what the future of NoSQL will be like, which way the development is most likely to head and who the winners will be, but we can still try and make some predictions. Here are mine:

Several subgroups will emerge
This is not as much a prediction as much as it is an observation of already visible patterns. At least two main groups will emerge from the NoSQL movement: networked data structure servers (key/value stores, queues, …) and databases for working with structured data.

The data structure branch will remain very diverse
Typical software in this category is rather minimalistic, both in terms of functionality and in terms of code size. Thanks to this the threshold for entry of new players is rather low; also low is the price paid by users for switching between competing implementations.
Various players will likely specialize in some technological niche and they will continue to be used mainly as means of speeding up applications and not as fundamental building blocks.

Relational databases will fight back
Some databases already have support for storing, manipulating and indexing structured data in the form of XML. I have a feeling that JSON support can’t be far away. For most users this will be enough to stay with the established players in the database field instead of choosing a strictly document oriented database.

Document oriented databases will morph into graph databases
Implementing cross document referencing will take them half way there. Pressure from the relational databases, as described above, will push them the rest of the way.

SPARQL will become the query language of choice
SPARQL is a query language for RDF1; in other words: a language for querying graphs. It supports querying multiple data sources at the same time (federated queries) and there are projects underway to make it work with Hadoop clusters.
I’m not saying that alternative methods of querying will disappear completely! I’m just trying to say that the key players most likely to be used by the average developer (the next generation graph database equivalents of MySQL and PostgreSQL and similar) will end up standardizing on SPARQL instead of inventing yet another language.

Software will gain weight
Reading about NoSQL databases gives me a feeling of deja-vu. Most of it reads almost exactly like articles about MySQL from the beginning of this decade: “We’re better than competition because we don’t have transactions/triggers/datatype checking/guaranteed consistency/fulltext search/…”. MySQL now has all of those features and NoSQL databases will follow in the same path. Most users will start hitting walls due to lack of features, not due to performance issues and when that happens having features will become more important than being lean.

The cycle will repeat itself
After a decade or so a new class of players claiming that their lack of features is their strength will emerge once again

  1. RDF is an extremely simple format wrapped in a metric buttload of mystery in misunderstanding. But more about that some other time.

Tags: , , , , ,

Sep 15 2009

Replacing menus with dashboards

Category: Android,Ideas,MobileAleksander Kmetec @ 10:00 am

Is it just me, or do most dialogs on Android seem to be removed really, really far away from the main parts of applications?

Not sure what I’m talking about?

Let’s take a look at the browser, for example. Just entering a new URL requires you to go through 3 different screens:

By the time you can start typing it feels like you’re already in a different application1. Switching to a different window also involves going to a special part of the application designed to handle this single task.

This pattern is not limited just to the browser. Entering an address in the maps application or searching the list of your contacts also involves going through several steps.

Back to the browser…

If you take a look the UI of a regular browser you can immediately see a number of frequently used elements such as the location bar, the back button and tabs for switching between windows. Those UI elements are always visible and usable with a single click. On mobile devices things are a bit different. Because of limited screen sizes most of browser’s UI is either eating away precious screen real estate (like on the iPhone) or is hidden behind a menu button (like on Android).

Except that because of the nature of menus, many of those features are not hidden just behind the menu button, but also behind an item on that menu.

Now, just as I’m typing this, Marissa Mayer is on the stage at TechCrunch50 introducing Google fast flip and talking about how Google is obsessed with speed and shaving milliseconds off of repetitive interactions. So what can can we do to speed up interaction with Google’s mobile browser?

First, we need to understand what’s wrong with menus.

A typical menu is a list of actions available for that application, but most of those actions can’t be performed from the menu itself. Instead, selecting an item takes you somewhere else where that action can finally be performed. In essence, a menu keeps asking the question “What do you want to do?” over and over again and the user then needs to explicitly say that he wants to go to to the place where he can type in an URL or go to the place where he can switch to a different window, etc.

How do we handle this situation where we know that in many applications the user’s answer to the menu’s question is going to be the same most of the time?

Like it is the case usually these days, the solution can already be found on the iPhone. No real surprise there. The iPhone doesn’t have built-in support for application menus which could be copied, but it does have this:

What you’re looking at is a special dashboard for controlling music playback, which can be brought up by pressing the home button twice.

With a bit of bad luck – or bad judgment – this could have easily been implemented as a list of items such as “adjust volume” and “control playback”, with each of them leading to a new screen where that action could be performed. But instead its designers made it possible to perform common actions directly from the pop-up and added a “Music” button that takes you to that other app where the rest of the playback controls are.

So let’s take this dashboard pattern and apply it to Android’s browser menu:


While some features (like bookmarks) still remain hidden behind a menu button, the two most commonly used ones are immediately presented in usable form. The “go” button is replaced by an actual location bar and the “Windows” button is replaced by thumbnails of windows. You now no longer need to announce first that you want to go to a different page or switch to a different tab; you can perform that action directly instead.

A quick before/after comparison:

Action Before After
Loading a web page press “menu” → press “go” → focus URL field (3 steps) press “menu” → focus URL field (2 steps)
Switching to a different window press “menu” → press “tabs” → select tab (3 steps) press “menu” → select tab (2 steps)

Removing a single step here and there may not seem like much, but it adds up. Making a typo in the URL or working with several windows suddenly becomes just a little bit less frustrating. A simple improvement that can be achieved simply by ignoring the established meaning of the word “menu”.

  1. Sure, if you have a phone with a physical keyboard you can just start typing and invoke the default action without going through menus, but what if your phone uses an onscreen keyboard or if you want to use some other action?

Tags: , , , , , ,

Jul 04 2009

Advertising overload

Category: UncategorizedAleksander Kmetec @ 11:27 pm

I followed a link to Forbes today and this is what I saw:

Advertising overload

There’s an article hidden somewhere in that screenshot. Can you find it?

Content is no longer king. It is now a third-rate citizen; a stinky bait used to lure in visitors; a parasite eating away at precious advertising space.

Tags: ,

Jul 03 2009

The Future of Mobile Browsers

Category: Ideas,Mobile,Mobile web,Semantic WebAleksander Kmetec @ 4:39 pm

Not that long ago, while my coworkers were attending a conference in London, I was spending my time wandering around the city in full tourist mode, trying to find a shop I had read about on the Internet but that didn’t seem to actually exist in real life. Although I was pretty sure I was on the right street I couldn’t find it and nobody I asked about it had the slightest idea about where it could be located.

This problem should be easily solvable in our age of ubiquitous connectivity, right? All I had to do was take out my mobile phone, fire up the web browser, check the shop’s website for the address and locate it using Google maps. How hard could that be? Very hard, as it turned out.

The experience of trying to perform this task was so horribly bad that in the end I wound up walking to Apple store a couple of streets away and waiting in line for a display iMac so that I could find the information I needed, copy it to a piece of paper and finally walk back. Yes, that was in fact a better alternative to trying to accomplish anything using a mobile browser.

A year and a half has passed since, but things haven’t changed much for the better. Even though connection speeds have gotten better and hardware is now much faster, the gap between mobile devices and computers is still huge and browsing the web on a mobile device can still be rather frustrating experience. Unlike computers, which these days have large displays running at high resolutions and are coupled with mice which give users pixel-accurate cursor control, mobile devices still have tiny touch screens and pointer accuracy of around 400 square pixels… if you’re lucky enough to have pointy fingers.

And despite their differences we use both types of devices for accessing the same websites.

So you’d probably think that browsers running on mobile devices with their tiny screens, clumsy keyboards and imprecise pointer control would be the ones getting all the usability improvements and fancy automated features. But you’d be wrong. What’s curious to me is that despite the fact that mobile devices are the ones with highly obvious usability problems, desktop browsers – which are already much easier to use – are the ones getting all the improvements. Autopager, Adblock, Greasemonkey, Stylish, Readability/Tidyread, Bookmarklets, Web slices, Accelerators and many others are features mobile users can only wish for1.

What about usability features specific to mobile browsers? Apart form the “.com” button on iPhone’s virtual keyboard I really can’t think of any. As a matter of fact, I’m having a difficult time thinking of a single user-facing feature available in today’s mobile browsers that wasn’t already present in Netscape Navigator in the mid 90s2.

So what can we do to bring mobile browsers into the modern times?

1. The single most important feature need by mobile browsers is support for extensions.

When was the last time you tried out an interesting mobile browser extension? I’d say never. Since most mobile browsers have no support for extensions whatsoever, you couldn’t do it even if you wanted to.

Once it’s possible to easily extend the browser anyone can start experimenting and adding features, but without that the existing browser is a dead end. Developers who want to add even a tiniest feature need to re-implement the whole browser functionality around the page rendering component. And I know from personal experience that doing this and then sneaking code for additional functionality in through the back door is a truly awful way of adding features. Not only is it a lot of work for the developer, but it’s also rather inconvenient and unlikely for users to try out a new browser.

2. Mobile browsers need to become content aware.

Now that the miracle of copy&paste has finally arrived to the world of mobile phones, performing some tasks like moving an address from the browser into the maps application has become slightly easier. But is this really enough to keep us happy for the next few years? Even on desktop computers where performing such a task takes only a second, copying from the browser and pasting into another app is no longer considered good enough.

Internet Explorer 8 now supports accelerators (so does Firefox, via IE8 Activities add-on) which perform such tasks for you. They are not perfect, of course. One problem is that all accelerators are offered every time, even if they make no sense in the given context:

IE8 Accelerators

Suggested accelerators don't always make sense

This same problem will be bigger on mobile devices – once and if they gain support for accelerators. I predict that more accelerators will be needed due to the limited nature of the devices, but displaying them all won’t work very well on small screens. Which is where content awareness comes into play. If the browser knew what kind of content you just selected it could present you only with options which make sense at that moment. Even better – most of the time selecting the text could be skipped altogether since the browser would already know where something starts and ends and could attach accelerators to that piece of content in advance. It could even grab new accelerators online if it determines using them would make sense.

There are several ways content awareness could be implemented. Microformats and RDFa immediately spring to mind, but since they are about as common in the wild as pink flying giraffes, some other solutions would need to be found. Alternatives might include external content descriptions and extraction rules (possibly crowdsourced), downloadable sets of algorithms for detection, data extracted by services like YQL open data tables or NLP services… But more about that some other time.

What I believe is important is that this content recognition should be performed by a centralized framework and available to all extensions so they don’t need to do their own parsing. Some basic work in this direction has been done with the Operator toolbar and Firefox’s support for Microformats, but in my opinion such functionality is much more needed in mobile browsers.

3. Browsers need to start detecting and exposing available extensions

You’re visiting a page that contains several events which can be added to your calendar and a table which can be displayed as a chart. Someone has created an alternative stylesheet which removes the huge header and there is also a mobile widget which allows you to interact with he same service in a more mobile-friendly way. But you’re never going to know about them and use them if your browser doesn’t notify you about their existence and make it easy to install and use them.

4.  We need support for client-side content modification

Some might disagree, but I believe we do.

How many times have you had to zoom in just so you could click the link to the next page in a sequence of pages, or pan around to find where that huge header ends and content starts? You don’t need to put up with any of this if you’re browsing the web on a computer. All sorts of common annoyances can be solved by simple tweaks, and extensions for desktop browsers have been making it possible to do this for years. By augmenting, modifying and filtering content they not only make it easier to access content you’re interested in, but also make it possible to ignore irrelevant parts of pages.

These are just some ideas about what the future of mobile browsers could look like. You might not agree with me on whether content awareness and even content modification are going to be important factors in the future of mobile browsing, but there’s one thing which is difficult to disagree with: a lot of work still needs to be done in order to turn mobile browsing into a user-friendly experience.

  1. While iPhone’s browser does support bookmarklets, they’re still a royal pain to set up.
  2. I wanted to list pinch-to-zoom here but I realized it’s more of an OS feature than a browser feature.

Tags: , , , , , , ,

May 21 2009

Ultimate JavaScript minification

Category: Ideas,JavaScript,UtilitiesMatjaž Lipuš @ 10:00 am

This is a guest post by Matjaž Lipuš, a social web geek, front-end web developer and semantic web enthusiast.

After developing some fat client applications using JavaScript frameworks I noticed how some code constantly repeats, making application footprint even bigger than necessary.
A while ago I (once again) stumbled upon article about helping the YUI Compressor. Article is great and in large client side applications could really make a difference in final footprint considering these tips. I think this should be automated as much as possible, so I extended a list of this tips which could be fully automated. And here comes in the YUI Compressor (YUIC).
I am using YUIC for code minification. I also contributed some fixes and suggestions to the author – Julien Lecomte. Those were implemented in past versions. YUIC is a great tool for code minification and munging. I believe it can be further extended and improved generating even smaller output. So here are my tips how to achieve this, ordered by complexity.

Concatenate static strings with +

If you have a big chunk of text to insert into page you would probably split it into multiple lines and making multiple strings. YUIC already has functionality concatenating static strings into one. So code like this:

var x = "This is " +
        "some text";


var x="This is some text";

Don not use arrays for this, because YUIC cannot tell you are actually concatenating strings.

Variable declarations at the beginning of the function

Scope in JavaScript is per function. So if you declare a variable twice in the same function, second time variable is just overridden with new value. As JSLint suggests you should declare all variables at the beginning of the function. Looking at this from minification view this means only one var statement! So instead of:

function iterate(array) {
    var result = "";
    for (var i=0, len=array.length; i<len; i++) {
        var el = array[i];
        result += el + ",";
    return result;


function iterate(array) {
    var result = "",
        i, len,
    for (i=0, len=array.length; i<len; i++) {
        el = array[i];
        result += el + ",";
    return result;

You should note when declaring global variables there is no need for var statement at all.

This as local variable

Writing serious JavaScript code means writing object-oriented code. In JavaScript we access object members in conjunction with this keyword. This means a lot of this keywords.

Person.prototype.getInfo = function()
    var result = "",
        i, len;
    for (i=0,len=this.length; i<len; i++) {
        result += this[i].name + " " + this[i]. surname + " - " + this [i].age;
    return result;

Assigning this to a local variable means YUIC can munge local variable to a 1-3 letters which means smaller footprint.

Person.prototype.getInfo = function()
    var x = this,
        result = "",
        i, len;
    for (i=0,len=x.length; i<len; i++) {
        result += x[i].name + " " + x[i]. surname + " - " + x[i].age;
    return result;

You should note local variable must be declared first, as we could access members of this object in the following variables declaration/assignment.

Person.prototype.getInfo = function()
    var x= this,
        result = "",
        i, len = x.length;
    for (i=0; i<len; i++) {
        result += x[i].name + " " + x[i]. surname + " - " + x[i].age;
    return result;

You should also note using this as local variable is only reasonable when this keyword occurs at least two times per scope, but that is most of the time.

Shorten numbers

Although this seems to be strange it is simple to trim leading zero from decimal numbers. So instead of:

var n1 = 0.1,
    n2 = -0.1;

you should write

var n1 = .1,
    n2 = -.1;

Common strings

As with JavaScript frameworks and it’s hash style configs there is a lot of string repetition.

var form = new MyForm({
    id: "form",
    items: [{
        type: "text",
        cls:  "blue",
        name: "name"
    }, {
        type: "text",
        cls: "blue",
        name: "surname"

This code can be minified (in a inner scope) as:

var textString = "text",
    blueString = "blue",
    form = new MyForm({
    id: "form",
    items: [{
        type: textString,
        cls: blueString,
        name: "name"
    }, {
        type: textString,
        cls: blueString,
        name: "surname"

A special caution must be given to a strings declared as variables as they can be changed. So we cannot use this variable as a constant. These two strings should be separated into two variables unless we are sure value has not been changed until constant string usage.
We could go even further by moving common strings to outer most scope which uses this string and accessing it in inner scopes with closures and even further replacing substrings (in this case »name«). This raises a question about performance penalties doing string concatenation.

Repeating access to object members

function focusInput()
	if (this.msgInput) {

this could without any problem been written as

function focusInput()
	var msgInput = this.msgInput;
	if (msgInput) {

Shorten object’s member access

JavaScript libraries have a nice namespace convention, but in a large usage of library you get a lot of code repetition.

var store  = new,
    record = new;

We can see a common namespace is which can be shorten by assigning to a variable

var Data   =,
    store  = new Data.Store(),
    record = new Data.Record();

There could even be further improvements if we are dealing with (static) object which does not have this key word in the function. Good example is the utility function JSON.stringify(), which can be assigned to a local variable.

var toJSON  = JSON.stringify,
    result1 = toJSON(obj1),
    result2 = toJSON(obj2);

Shorten object’s member names

While using namespaces is good in an organizational way it means a lot of code for just accessing object. The idea is to shorten object’s member names. So instead of

function Person(name, surname)
    this.firstName = name;
    this.lastName  = surname;
Person.prototype.getFullName = function()
    return this.firstName  + " " + this.lastName;

code looks like

function Person(name, surname)
    this.a = name;
    this.b = surname;
Person.prototype.c = function()
    return this.a + " " + this.b;

This is only reasonable for automated process, although keeping short member names can also save a lot of bytes.
You should keep in mind that you must replace member access in all places, this means where they are defined (set) and used. You also cannot shorten reserved members such as Array’s length or documents getElementsById.
So a good idea would probably be keeping a white list of members which should (not) get munged.

I was already doing some work in YUIC about variable declarations at the beginning of the function, shorten numbers and common strings, but it is not 100% stable, although I successfully minified some of the JS libraries.
Also I did not measure any performance penalties of these tips, but it would be interested to see some.
You should note that this would best perform if code is also JSLint compliant.


May 16 2009

A proposal for symbiosis between Wolfram Alpha and Wikipedia

Category: Ideas,UncategorizedAleksander Kmetec @ 9:30 pm

Attention, please!

Wolfram Alpha is not a Google killer!
Wolfram Alpha is not a Wikipedia killer!
Wolfram Alpha does not want to dismember any company and bathe itself in its blood!

Please ignore unimaginative claims made by linkbait authors. Let’s forget the 1999′s prehistoric “me kill” mentality and focus instead on more peaceful opportunities. We now live in the age of mash-ups, so here’s my modest proposal for symbiosis between Wolfram Alpha and Wikipedia.

The opportunity for symbiosis comes from their different strengths. Wolfram Alpha’s FAQ section gives a very clear description of how it compares to Wikipedia:

Wikipedia gives you pages of narrative about topics. Wolfram|Alpha computes answers to specific questions you ask, just giving facts, not narrative. Wolfram|Alpha often includes sidebar links to Wikipedia.

Wikipedia describes a concept; Wolfram Alpha gives you the ability to try out that concept in practice.

And because everything needs a car analogy…
Wikipedia is like a car magazine and Wolfram Alpha is like a car simulator. You can open a magazine and read more about a car you just took for a virtual test drive, or start with the magazine and go for a ride in a car you just read about.

You can see in the above quote that one-way links from Wolfram Alpha to Wikipedia already exist. What’s still missing are connections from Wikipedia to Wolfram Alpha, which might one day look like this:

A hypothetical Wolfram Alpha / Wikipedia mash-up. Click for full size.

A hypothetical Wolfram Alpha / Wikipedia mash-up. Click for full size.

There you have it. Wolfram Alpha and Wikipedia can not olny coexist peacefully, they can help each other. No need to argue about who is going to kill who.

Tags: , , , ,

« Previous PageNext Page »