开发者

Module oriented code & messages between

This is more of a design question that others may have had similar experience with & know of good solutions.

The general problem here is say you are building a modular framework, each module has a set of inputs and outputs (possibly s开发者_开发知识库tructured). Is there any good definition language for the inputs & outputs (protocol buffer like) that would allow these to be defined in say a separate file and the module would then use say the generated code for interactions with the outside world.

Thoughts came to mind of using protocol buffers but the serialization capabilities of it seem unnecessary since this is intermodule (in the same process, currently). Any thoughts would be great.

I was thinking of something like the following:

interface input Person {
  required readonly int32 id;
  required readonly string name;
  optional readonly string email;
}

And for output:

interface output PersonScored {
  required read-write int32 id;
  required read-write int32 score;
}

Its like how protocol buffers works but would be useful for generating module interfaces in either C++ or Java.


Sounds like you're interested in interface description language (IDL). Select from the list whatever suits your needs the best:

http://en.wikipedia.org/wiki/Interface_description_language

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜