Kartones Blog

Be the change you wanna see in this world

Book Review: Obsequium

Obsequium book cover

Title: Obsequium

Author: Jaume Esteve, José Luis Sanz, Juan Manuel Moreno, Antonio Giner, Manuel Pazos, José Manuel Fernández, Enrique Colinet, José Manuel Braña Álvarez

Editorial: -

Obsequium is an ebook fully dedicated to one game, La Abadía del Crimen.

The first half of the book (until the "day 4" chapter) sadly is a rewrite (sometimes with almost the exact same words) as Ocho Quilates references to the game. After having read it so recently, it is sad to see such lack of fresh content.

Lot's of filling background that I already know and don't care about, what I'm supossed to be reading is a dissection of a specific videogame, not the golden age of spanish 8bit games (again). Also, one chapter is mostly a translation of an english online essay about The name of the Rose. It is mentioned as reference indeed, but... it is just a translation with tiny additions here and there.

Day 4 is where the content gets interesting, with detailed programming hinsights from one of the two spanish experts, Manuel Pazos, who also has done some conversions of the original game by reverse engineering. Here are really cool things, like how compression of texts, maps, graphics and even the AI is performed, some of the tricks to save memory and speed... real retro game dev. Too bad it feels short, as is the kind of content I wished the full book was about.

The remaining chapters are not bad and provide interesting research as for example all remakes and adaptations the game has had (really interesting) or how some of its design decisions stand as of today's standards for games.

Overall, I expected way more details and deep research of the game internals, and found some nice chapters but a general feeling of a merely decent read.


Read this and other reviews at my Book reviews page.

Book Review: Ocho Quilates (La edad de Oro del software español)

Book 1 Cover Book 2 Cover

Title: Ocho Quilates (Una historia de la Edad de Oro del software español) I: 1983-1986 & II: 1987-1992

Author: Jaume Esteve Gutiérrez

Editorial: Star-T Magazine Books


Ocho Quilates is a two-part book that covers the most prolific decade for Spain videogame scene, the era of the 8-bit computers: Amstrad, Spectrum, Commodore and MSX. A decade where many game companies were born and created games that marked our early life.

I am fully biased as I had an Amstrad PCW 8256 and I grew playing those damm hard Opera Soft, Topo Soft and Dinamic games, plus I remember the distributors back then, the magazines my parents bought me, full of those games with incredible covers and sometimes not so cool gameplay...

This books gather as much info and interviews as possible, chronologically ordering them so that we can learn what happened behind the scenes. It also sadly tells how we Spaniards got inside a bubble of rejecting the 16-bits era until it was too late and the Nintendo-SEGA duo eat our national market (also affected by piracy) and killed all spanish game dev companies with few exceptions.

Lots of references (actually hundreds of them!), lots of people mentioned, games and their history... it is the best way to keep the memories of what happened between 1983 and 1992.

If anything wrong with the book, sometimes the references are so abundant two or three are together and thus hard to click in the Kindle. And a few of them of the second book were broken (showing "attr error" instead of the ref. description).

A book you have to read if you lived that era. Nostalgia++.


Read this and other reviews at my Book reviews page.

Non-trivial Rails 3.x routing

Disclaimer: There might be a better solution for this scenario. My expertise with Ruby and Rails is just 6 months. You're welcome to drop me a tweet or a message with better approaches.


At CartoDB, as one of the required steps for the 3.0 version we needed recently to change the URLs from the "classic" format of USER.cartodb.com/whatever to ORG.cartodb.com/u/USER/whatever .

This is a change that usually gives lots of headaches. At a previous job a similar change required a huge refactor of the MVC engine and hyperlink building system. At another was quicker but just because the only solution was to do an (ugly) regex hack deep inside the MVC framework.

Rails is initially all unicorns and rainbows. A magical routing system that allows to reduce written code, that maps automatically verbs to controller actions, that even differentiates between acting upon items or collections... A developer's heaven regarding MVC configuration ease.

Except that for advanced scenarios, this magic fades away and you need to fallback to more traditional and detailed config.

This is great for the majority of typical websites:

scope '/admin' do
  resources :posts, :comments


But now imagine this new rules:

  • Any url might come, or might not, with an additional fragment, including a variable
  • This fragment might be optional, or might be mandatory


How do you specify an optional parameter at the Rails routes file? Like this:

get '(/u/:user_domain)/dashboard/tables' => ...


Looks easy... but remember that the param is optional. It might not be present... so we need to make sure it is always either sent or nil (but defined) so the code doesn't breaks. For this I implemented a before_filter at the base ApplicationController so it is always present.


Then, everything looked ready... until I checked the code and there was a myriad of links bult in all possible Rails ways: relative hardcoded, full path hardcoded, xxxx_path, xxxx_url, redirect_to xxxx, link_to xxxx...
And not only that, I also had to support that optional :user_domain parameter in most URLs, plus other ids or params sent like this sample route:



In the end, I decided to take the following new (and mandatory from now on) approach:

  • Full "literal-based" routes descriptions. They don´t look fancy or like magic anymore but they are practical, work and anybody not even knowing Rails knows what it points to.
  • Always given a name/alias (" as xxxx"). So they can be called from views and controllers with _url/_path helpers without collisions, ambiguity or Rails magical way of autogenerating URLs (that has given some problems and for example don't allow parameters).
  • Every application link has to be built with _url/_path. No more handcrafted URLs.

This makes links to URLs a bit bigger than usual:

<%= link_to tag_name, public_tag_url(user_domain: params[:user_domain],tag: tag_name) %>


But we can be 100% sure that where that public_tag URL will go by giving a quick tool to routes file, we support the optional parameter, and we also ease any possible refactor in the future as searching for every link would be much easier than it was (it took 2 days and some bugfixes to uniformize the codebase).


About the "might be mandatory" part, what I did was adding another before_filter by default in the base Admin-scoped ApplicationController, and then disable it (with skip_before_filter) on those controllers were was optional.
Wherever it is mandatory, if the user is logged in and belongs to an organization, the app will redirect him to the organization-based URL. But for things like APIs we keep both the old and new format to preserve compatibility with existing third-party applications and projects.



Overall, I don't blame Rails for being so easy to reduce code. I understand that for the majority of scenarios it really eases code and speeds up this configurations, so nobody could have guessed this routing changes... But what it is a good practice is to be consistent and, even if you have 5 ways of generating urls/links, decide on using just one that is flexible enough for hypothetical future changes.


Magic has a problem: to use it, you need to be a mage. Now we're a team of (mostly) non-Ruby experts that needs to build lots of features and we cannot rely (at least on a short term) on everybody having deep knowledge of Rals, so we'll instead go more traditional ways but ease the first steps with the platform.

Book Review: The Art of LEGO Design

Book cover

Title: The Art of LEGO Design
: Jordan Schwartz
Editorial: O'Reilly


Books with step-by-step instructions and easy tutorials there are many. This title goes the opposite, providing us with general techniques, hints and ideas, but showcasing the works of many authors along its 13 chapters.

From the basic foundations of how to create smooth surfaces, how to build angles, or keeping always a scale in mind, to advanced and great looking mosaics, scenarios or even monsters and spaceships, this book is not only an eye-opener of how pros create such amazing LEGO structures, but also a nice source of inspiration with the abundant photos.

One might actually desire more details of some specific models; For many the closeup images hint how it might have been built, but for the most complex ones you can only imagine how hard has been to construct. But as there are many small interviews with expert designers (apart from the author itself), you at least get some tips from them on how they approach new projects.

I really liked the theme-based chapter structure, allows for quick reference checks, it includes some (but few) detailed instructions for joints and techniques like studded spheres and for amateurs like me it really provides a great boost to imagination on how to try more advanced designs.


As always, you can find all my book reviews at its section.

12 years working

I entered my LinkedIn to do some cleanup of contacts and I noticed that I've passed the 12 years working mark, so why not a small recap to see how bad life has treated me regarding programming languages?


I've worked at 8 companies since 2001: Alhambra-Eidos, Surfernet, Grupo Raxon, ilitia, Navteq, Tuenti, Minijuegos and CartoDB (current one).

Of those, I did consulting services at two of them, the rest being product development. A bit below 5 years of doing quite varied and interesting consulting projects, but also sometimes feeling Dilbert's strips are so accurate.


Lowest record is 4 months ar Alhambra-Eidos, because was during the summer and they couldn't offer me a part-time job.


Highest record would be Tuenti or ilitia with 4 years, but really the closest one was ilitia, as I left the company just 3 days before the 4th anniversary.


I've coded in*: Visual Basic 6.0, Visual Basic .NET, ASP 3.0, ASP.NET, C++, C#, Java, Javascript, PHP, OO PHP 5.3 **, Ruby.
I'm still in love with C#, Windows might not be the best platform but the language itself is so good that even Java copies its features now.


I've used more or less extensively the following DBs: SQL Server, MySQL, PostgreSQL.
None of them is perfect, all have caveats.


I've used quite a few SCM: Visual SourceSafe, CVS, Subversion, Mercurial, Git.
All of them screw up merges sometimes, but I like Git now that I know a bit and can compare it to Hg.


I've given 18 talks a total of 23 times.
And I still get quite nervous every time I have to do one.



Let's hope 12 years in the future we're not all coding in Javascript. Or maybe we'll be?


* : Only counting professional work of at least a few weeks

** : One thing is coding in PHP and other is writing proper, object oriented, namespaced code