Monthly Archives: November 2012

You could be an awesome developer or a really bad one, it doesn’t matter, a job interview is something different. It’s like doing a crossword for a writer or a drive license test for a f1 driver, they should do it just ok, but a bit of practice before won’t hurt.

Things I’d recommend:

To code something while other people are watching you (if you have a blackboard, the better): I don’t know about you, but I get really nervous if someone is looking at my screen, I start to do a lot of typos, even with really short shell commands and don’t even try to think and write logical stuff. One thing sort of work for me is to (try to) think out loud in those situations.

Remember basic data types: Nowadays we got into bad habits of using a lot of libraries so we forgot about really basic stuff, do you know how to write a basic “set” date type from zero? a list? a balanced tree? 10 years ago I knew it, right now probably it would take me much more time.

Algorithm’s costs: more of the same. It’s quite easy, but you should remember and take a look into this, again.

Learn name of things: once thing is to have an anonymous function without being bound to some identifier and another different thing is to have a lambda. It’s not the same to have a class that exposes the functionality that to have a façade. Well, in fact those things are the same, but it helps if we speak the same language.

Let’s start with the basic. What are bindings? It’s a way to call low level libraries (normally in C or C++) from another language (high level one, like ruby, java or whatever). This simple step requires two important things: 1) first, to know how we should call the method itself and 2) second, how to map the type from the high level language to C primitives types. To accomplish this, we have what is called foreign function interface which trivialize this task.

In ruby/jruby world we are gonna need ffi gem (jruby also has a compatible ffi gem), besides that the most important part is to have a clear interface in C. You can do bindings for a C++ library if you create a C interface first (because the bindings between C++ and C are free, the compiler knows how to do it by itself). So let’s cut the crap and write some code

So, if you have read until now, probably you just want something working, say no more. Download this tar.gz, and see all this by yourself. In the tar you have the code split into c/h cpp/hpp files as it should be, in the post I’ve put all together to simplify things. Just execute make test and if you have ruby, ffi gem and g++ installed on your system, you’ll see something like: