It sounds like you might be interested in checking out IEC 61499 Function Blocks - this is a new -ish automation programming standard / domain specific language. It allows for concepts as you are describing them, with communication blocks, basic blocks, composite blocks, etc, deployed to resources and systems.