开发者

Event-driven console user interface

I'm writing a server-client application with console based user interface (on the client side). The user is presented with a prompt and has the possibility to type in commands. Also, from time to time, the server will send out a message that the client should process and print out information about. Could you give me a piece of advice as to how go about modelling/implementing this type of user 开发者_开发问答interface or share a link to a tutorial?


For prompt related tasks I suggest jline, it provides history, autocompletion etc...

Other considerations might include: how complex are the commands? Draft some grammar. Do you need a proper parser to implement them, or regex would suffice? Even if you need a parser is some hand written one OK for the job?

How are client and a server connected? What protocol sits between them? Draft spec of what could be set each way. I would recommend Netty for implementing network protocols, but maybe you could go with some of the shelf RPC's (Protobuff, Thrift, Avro)

What part of work is done where? Making a client as lightweight is probably good idea, but maybe some performance/bandwidth considerations call for a bit smarter client?


Maybe this library - http://www.pitman.co.za/projects/charva/index.html could be interesting for you.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜