Totally impressed by the language support for design by contract in Eiffel and in total agreement for the need for build-in support for this in modern higher programming languages (like what Eiffel clearly is), I decided to go for the idea and therefore I just started instrumenting all the interface method launchers of tinymail.
Maybe other people have better ideas for this with GObject and C? Please do contact me, as I’m truly interested in fully instrumenting tinymail with DBC contracts for all its interfaces. I started with the TnyDevice one. Interesting are the tny_device_force_online and tny_device_force_offline methods. They must ensure hat the result of the tny_device_is_online query will be either true in case of forcing online or false in case of forcing offline.
Any implementation of TnyDevice that doesn’t do this, is wrong. Since TnyDevice is implementable by the platform specific developer I want to know about their bugs without having to look at their code. Basically making it possible for me to say: look, run this suite and if you have assertions, it means that your implementation is broken. Fix it and come back.
I know that sounds harsh, but application developers whom I’ll ask to implement something will in stead be grateful for these contracts: they’ll very quickly know where there’s a bug in their own code.
Don’t go search the code for Design By Contract assertions yet. I’m adding them right now. You can of course join me on IRC: #tinymail at GimpNET.