A formal approach to the engineering of domain-specific distributed systems