Build C++ project with Gradle

Introduction

I am more and more worried about building, dependency management and distribution of my projects. I'd like to find a tool unifies those processes with independence of the language. I know several tools those almost fit to what I'm looking for, like I know several tools those almost fit to what I'm looking for, like SCons, Autotools, Ant, Maven and lately Gradle.

I've made several projects with Gradle, but always I was focused in Java and Android projects. In Java projects I've found a Maven replacement, because it is faster, easier and less verbose. About Android projects I suffered the early adoption of Android Studio + Gradle, although currently I think the are more mature and they work fine.

First of all, I have to say: building C/C++/Objective-C projects with Gradle is in incubation phase, although now we can perform advanced tasks like:

  • Generation several artifacts within same project (libraries and executables).
  • Dependency management between artifacts (no versions).
  • Different "flavors" of the same software, e.g: we can generate a “Community” release and other one with more enabled features called “Enterprise”.
  • It allows multi-platform binary generation.

As I said, this plugin is still having limitations although they are working on it: Gradle C++ roadmap. If they achieve it I'll leave Autotools (I'm going to regret saying that).

Read more…

Bases de Datos Embebidas Java: Comparación de Rendimiento

Bases de datos embebidas

Se trata de bases de datos que carecen de servidor, están inscrustadas en la propia aplicación y suelen estar almacenadas en ficheros locales. Esto último unido a que suelen tener un modo de funcionamiento en el que mantienen los datos en memoria hace que puedan tener un rendimiento muy alto.

Eso sí, este gran grado acoplamiento a la aplicación, hace que tengan peor rendimiento cuando se comparten entre varias aplicaciones debido a colisiones de acceso.

Otra ventaja es que no tenemos que encargarnos de mantener y gestionar un servidor de bases de datos.

Voy a hacer una comparativa de rendimiento entre 3 bases de datos embebidas ACID (transaccionales), las NoSQL no entran en esta comparativa que están en otra liga de rendimiento.

Read more…

Java serialization ways: Performance Comparison

Recently I've had to serialize/deserialize some data in Java binary format. Lately I use JSON or XML formats.

I remember that to serialize Java objects they must implement the Serializable interface, but I had also read in Internet other way, implementing the Externalizable interface, then, which interface must I implement? It depends on what you want such as everything in the life.

Read more…

Mutex C++

C++11 has added many improvements to help us developing multi-thread systems. I'm going to talk about mutex.

In previous C++11 compiler versions, we can get a pthread mutex, but we must initialize and destroy in C style; in the end you must do more things than just lock/unlock.

C++11 provides mutex class, we just lock/unclock the object. I recommend you take a look at C++11 mutex class.

If you still work with previous C++11 compiler versions, a time ago, I made a wrapper class that helps to work with pthread mutex. You just lock/unlock the Mutex object.

Then I leave my code proposal (Gist code).

Read more…