Construyendo y publicando nuestra primera app multiplataforma (II)

In this second session of the Interlat Webinars lecturing I review how the variety of devices on the market, related to brands (and underlying operating system), screen sizes and resolutions, input methods, available sensors, etc…, which is something really good for consumers, constitutes a big problem for those planning to develop an application or game.

The problem is technically called ‘fragmentation’ and appears when we realise all the effort that will be required for our product to run on as many devices as possible.

A possible solution is proposed and it is the use of technologies such as HTML5, CSS, JS and optionally a framework like jQuery Mobile to develop a mobile web application.

Also during the presentation I show a little example of a well-known videogame with a world ranking to show some of the possibilities that this set of technologies gives. Main features are:

  • HTML5 Canvas based 2D game
  • Usage of websockets to obtain updates to the ranking in real time.
  • Usage of Google Maps and a table to display the ranking.
  • Usage of jQuery Mobile to quickly build all pages and UI.
  • Backend built as an API using Grape, PostgreSQL and ActiveRecord and deployed to Heroku.

You can see the source of the project in my js interlat demo app github repo.

Enumerados

Enumerados (Numbered) is, by far, the largest project that we faced at Unkasoft. It is a multiplayer board game which goal is to build simple (+ and -) arithmetical operations by crossing your given chips with the ones that are already on the board (like Scrabble but with numbers).

From the technical point of view it involved three different developments: a backend and two native (iOS and Android) frontends. Particularly I have fully developed the backend where I were almost fully dedicated during the last two years. Lots of iterations, changes, migrations and new features were required to get the final 3.7.1 version.

The backend is fully built using Ruby on Rails, starting at version 3.1 and finishing at 3.2.13. All the infrastructure was held at Heroku where it was using 4 web dynos as average, one single worker dyno and another plugins such as AdeptScale, PGBackups, Scheduler, New Relic, Blitz, RedisToGo and a Crane PostgreSQL Database.

The communication with mobile clients is done through a HTTP REST JSON API and, due to the required evolution on the whole project, the server ended up serving 3 different API versions concurrently.

By far, the most interesting and time consuming part of the development has been the optimisation, at all levels:

  • Database: Mainly using New Relic and Posgres ‘explain analyze‘ command I designed structure modifications, queries optimisations, PL/pgSQL procedures, etc…
  • Application: Again New Relic had a key role in helping spotting the worst performing transactions and bottlenecks along with profiling and benchmarking tests execution in my local development machine and also using Heroku Blitz add-on for load testing. At this level I implemented asynchronous query handling, background pre calculations, cache-based (sync and async) solutions where possible and some algorithms and data structures optimisation. Also improved database usage.
  • API and communication with mobile frontends: At this point, using users feedback and data provided by Google Analytics and New Relic native mobiles plugin we improved the communication layer by modifying (merging/splitting) queries, background preloading some other queries, etc…

Another thing that I am very proud of is the result of the push notifications feature evolution. At the very beginning I started using two different rails gems, one for Apple and for Google integration the other. I decided to go for third party open source gems mainly because I guessed that it would take me longer to develop, test and stabilise a new one from scratch. But after a while using them I started finding bugs and missing features that were important for us, so I began developing a new Rails Push Notifications Gem from scratch that, after some time I open sourced at my Github profile.

Going back to the game itself, here you can find the download links:

Also, here you can see some screenshots on the game.