Writing contracts for composite components