Diagnostics as a reasoning process: From logic structure to software design