Which language to choose for a Jabber bot?

I'll be writing an XMPP (Jabber) bot, and I need to decide in which language should I write it. Currently I'm considering Python, Java, and PHP.

Since I'm expecting the bot to be running most of the time (ie 23.5/7), are there some specific arguments for or against using one of these languages? (eg not "$x sucks", but "$y has good daemon library" or "$z leaks memory")

The bot's purpose will mostly be responding to user input.

If none of these languages seem suitable to you, what would you recommend?


I would say Python with the Twisted framework. Twisted is amazing framework for asynchronous networking and most of the time it already has the support for the protocol you are looking for. There's a slight learning curve because of the reactor pattern but once overcome you can do amazing things with the littlest amount of code. As for the IRC protocol twisted already has it, so while I'm not an expert on IRC bots, I would definitely recommend Python and Twisted.

BTW, this is the first one that came up with google: Python IRC bot using Twisted


If you want to service for multiple users at the same time(probably you want), PHP may not be a good choice, since it does not support(or experimentally support) threading, you have to fork a copy of your application for each user.

I recommend Java for this purpose. Sun describes Java as "simple, object-oriented, distributed, interpreted, robust , secure, architecture neutral, portable, high-performance, multithreaded , and dynamic.".

In my opinion with exception of time critical jobs Java best suits for client-server architecture.


Of the options you posted, I would have to suggest Java. PHP, for one, simply isn't going to do what you want it to; it's meant to be a web scripting language, not an anything-else scripting language. Python is capable of doing what you want, but I think Java will provide more out-of-the-box support for the functionality you're trying to achieve.

链接地址: http://www.djcxy.com/p/94044.html

上一篇: 我怎样才能让我的Perl Jabber机器人成为一个事件

下一篇: 为Jabber机器人选择哪种语言?