Google Protocol Buffers
There is a long standing confusion I think, between serialization and messaging.
Serialization
Is generally short-lived and involves passing around objects.
As stated in the article, COM
and CORBA
are well-known examples of its uses.
Messaging
Is about communication between different entities.
The problem is that many people, when they see a messaging problem simply think: serialize and be done with it.
But this is not adapted.
Serialization of an object means being able to 'encode' the object, and restore it... what happens if suddenly you change your ways and what was one object is now 2, how do you deal with backward compatibility ?
The problem here is that if Serialization works pretty well with stable model, any change of the model may be a pain.
Messaging on the other hand decorrelates the message encoding and decoding from the current model, therefore, changes to the model just have to be treated in the encoding and decoding of the message, and the model is freed from the burden of backward compatibility.
Now for a configuration file, you probably want backward compatibility. Then it is in your best interest to elect a Messaging solution.
I suggest Google Protocol Buffers
, because it's sound and proven.
- Forward and Backward compatibility is easy handled
- May generate either human readable or binary format
- A same message can be encoded / decoded in a wide variety of languages
I don't have to present why 1. is important. 2. means that you can simply edit the file manually to tweak it, 3. means that you can easily code a GUI or a checking script.