Introducing ZXDB

Lately I have been playing a lot with some cool technologies. I had a lot of fun, so I want to share some of it and at least point you to the interesting pieces of technology to check out. And it also inspired me to my new project which I would like to introduce with this blog post.

ZeroMQ & friends

Lets start with ZeroMQ. It is lightweight messaging library with really nice API. And the tools around it? CZMQ brings even nicer API and there is also zproto which let’s you generate protocol handling code and even state machines easily. You just describe it and zproto will generate all the code for you. I know that you might think that code generation is evil. And quite some time it is. But this one is not 🙂 Generated code is nice, readable and it really helps with productivity. You don’t have to write copy&paste code and drown yourself in writing stuff that was written thousand times before already. You can concentrate on the logic of your application – the only important part – and disregard all those irrelevant boring processing functions. So ZeroMQ in combination with zproto is one of the interesting stuff I’ve been playing with lately. And I would recommend you to do so as well 🙂

TNT

Other interesting opensource project I’ve been playing with is TNTNET, TNTDB and CXXTools. It’s actually three different libraries, but they are under one umbrella. They also have a really nice API, this time C++ compared to C one in ZeroMQ.

TNTNET is a way how to write web applications in C++. And as most of the we b applications need database, TNTDB is database abstraction layer that let’s you write applications that can easily be deployed against SQLite or MySQL or even PostgreSQL without any modifications to the code. And CXXTools is just a collection of handy utilities that doesn’t fit in neither, but can be used and are used by both.

ZXDB

Now let’s introduce my new project – ZXDB. It combines both. As I was writing some web application (in C++), I found it quite boring dealing with database and doing all those selects, keeping data somewhere, doing updates and stuff. As it is boring and copy&paste and boring, I thought about the abstracting it a little bit and I wrote initial gsl (templating system zproto uses) template, that will generate all the boring code for me.

Now I’m able to easily add or remove properties, I don’t have to deal with database directly as I have a nice class based abstraction on top if and this generated abstraction is using TNTDB to be database independent. I was quite excited when I started playing with this. So much that now I’m even generating unit tests for those generated classes 🙂

It is far from perfect and it is missing plenty of features, but it already does something, so it is time to ship it (it compiles at least for me 🙂 ). I put it on GitHub alongside with some instruction. If you are interested, go take a look. And if you will get interested even more, patches are welcome 😉