dholm.com
msgbartop
I need this baby in a month send me nine women!
msgbarbottom

05 Jul 05 Power tools for power programmers

Considering what I do for a living it’s high time that I blog about something appropriate for my “programming” category. Today I came upon an appropriate subject for just that purpose, a set of power tools any C++ programmer shouldn’t live without.

Today I read this article which was linked to via OSnews which explains how to use the serialization feature of the Boost C++ libraries. For those of you who didn’t already know it, serialization is the method of converting data into a binary string for storage on a hard drive or transmission over a network medium. In the world of distributed systems the process of serialization is frequently referred to as “marshalling”. This is one of the things CORBA will do for you in order to make your life easier, if you ever choose to use it.
I have not had a chance yet to use Boost’s serialization in one of my own projects. In fact, I didn’t know about it until I read the article mentioned above, so recently I wrote my own serialization routines which were far from being as clean as these are. I have however used Spirit, which is an “object-oriented recursive-descent parser generator framework”. Spirit integrates beautifully with C++ and gives an awesome Extended Backus-Normal Form-representation using nothing but standard ANSI C++ code. You have to see it to believe it.
So what are the advantages of using Boost’s serialization over writing your own routines? There are several advantages, for instance, it has seamless support for serializing STL containers. It is also very easy to use, especially if you are a C++ novice. But the biggest advantage of using Boost, at least in my opinion, is that it really increases readability of your code. The Boost classes that I have used took extremely good advantage of the powers of C++ in order to blend into your code in ways you didn’t think possible.

My advice is that if you haven’t tried Boost already give it a go. It contains powerful tools which will make your life much easier, it is peer-reviewed and comes with plenty of unit tests to maintain high quality and it integrates with your C++ code in a way you didn’t think possible (unless you are really skilled with templates in which case I salute you).

Similar Posts:



Leave a Comment