Technical Interview Question

December 17th, 2009 | Posted by Quixey in Technology - (1 Comments)

Want to be one of Quixey’s earliest employees? We expect to be hiring for a programmer position very soon.

When it comes to engineering our product, we think it’s essential to hire top-notch programmers who know how to architect and maintain a beautiful codebase.

So, pretend you’re working on our production website, and you need to do the following in either Python or JavaScript:

Write a function findInSorted(arr, x). It’s supposed to return the smallest index of a value x in an array arr which, as a precondition, must be sorted from least to greatest. Or, if arr doesn’t contain an element equal to x, the function returns -1.

Email your answer to jobs@quixey.com.

As we’ve mentioned, Quixey uses a JavaScript-centric approach. Our server-side code generates no HTML whatsoever, except for simple stuff we show while the JS-generated DOM tree is loading.

In addition to our class inheritance framework, and of course jQuery, we’ve created our own set of modules that we call The G Framework. Why G? Well, we didn’t want our JS variables polluting the global environment — we wanted to subordinate them all under a single namespace, and we wanted to give it a short name that was easy to type. And if you’re going to type a short namespace name whenever you need to use a variable, then you obviously want to type it with your index finger. So “G” was the obvious choice.

One feature of the G Framework is a solution for keeping track of database data passed in from the server (either through AJAX, or dumped into a script tag that gets evaluated on page load). The basic idea is to have client-side classes that roughly map to database entities, and create a centralized client-side key-based hash of all the data we’ve downloaded and cached.

It’s all powered by the G.data module, which you can see at http://quixey.com/static/js/data.js. It defines a base class, called G.Data, which all other data classes (e.g. G.data.App, G.data.User) inherit from. Check out some of the functionality that is common to G.data objects:

(more…)