Method of designing modular communication protocols in which separate functions are abstracted from their underlying structures