[alicebot-developer] Program# 2.0

mehri foreverlinux at yahoo.com
Wed Dec 6 08:55:22 PST 2006


Totally agree on all fronts Nicholas.

I'd say do what you want to do ultimately.  After all, it is your code base and your project and if it's not fun it's not worth working on ;-).  Everyone else who would want the feature can just download the source and make the mods themselves...hehe :-)

Multi-user, multi-bot enviornment is actually IMHO easier than threading.  With threading you have *so* many different ways/patterns to do it.  Top that with the minute you start walking down that road you wind up with indeterminstic code.  Which leads to bugs that are hard to reproduce.  You also end up with deadlocks too.

Then again threading in any programming language today is horrible.

I'm actually (in my CVS branch) implementing mutli-user, multi-bot first before adding in threading.  multi-user multi-bot doesn't add that much more complexity to the code base.

When I finish that and start heading down multithreading I am going to try to abstract it out so that the top level facade class can manage the threads.  Make it easy for the user to configure the number of threads.  Typically you want one thread per processor on the machine.  So if you have two processors two threads are optimal in most situations.  More importantly if you can tell the interpreter that you want to use only *one* thread then you can go back to deterministic land and determine if it's a bug in the code or with the threading.

Good luck though.

----- Original Message ----
From: Nicholas H.Tollervey <ntoll at ntoll.org>
To: Alicebot Developer Discussion <alicebot-developer at list.alicebot.org>
Sent: Wednesday, December 6, 2006 4:45:21 AM
Subject: Re: [alicebot-developer] Program# 2.0

Hi Mehri,

Thanks for the welcome!

Hmmm... the asynchronous issues are very interesting.

To be honest with you, my development philosophy for Program# has been
to implement (what I see as) the minimum number of features to produce
the maximum potential benefits in the simplest way possible. I see it as
a foundation upon which other developers are at liberty to hack to their
own requirements.

Nevertheless, I agree that the lack of true multi-user support is a
shortcoming. The problem I now face is deciding to what extent I should
implement threading in the library. My current reasoning can be
summarized is as follows:

* I'm not trying to write an AIML bot server like (IIRC) Program D or
somewhere like PandoraBots. It is meant to be a simple class library.
* .NET/Mono already have excellent "server" capabilities baked in that
one can piggyback on (web services etc...).
* I want to enable the bot to work efficiently in a multi-user /
multi-processor environment should the end user/developer require it.
* I am a big fan of KISS (and I don't mean the aging glam-rock outfit
from NY) :-P

My conclusion? Applying simple threading to "regular" user interaction
(i.e. basic chat) should be (heh... notice the use of "should be" *not*
"is" - I'm probably opening a can of worms here) relatively simple with
.NET/Mono's excellent threading libraries/routines. Anything else will
require additional complexity and overheads that I don't think deserve
the effort. I know I'm sticking my neck out here, but I have to draw a
line in the sand somewhere when it comes to how much the library provides.

Anyway, as always, comments, suggestions and good ideas are most welcome.

Regards,

Nicholas.


mehri wrote:
> Hi Nicholas, 
>
> Thanks for the code contributions first of all.  Glad to see you back in the community.
>
> Just a note though.  If you don't have things asynchronus right now where you can tell the interpreter to add a directory and it returns immediately exposing it as a webservice for multiple users would not be that great.
>
> Imagine 5 users comming along and almost simutaneously trying to add the entire annotated alice set at once.  And imagine the 6th user putting in a simple "hi how are you?" to his already constructed bot.  The 6th user will have to wait for the other 5 users' bots to completely load first.  That could be several seconds before he gets his response or even several minutes. 
>
> In a true multi-user,multi-bot,multi-threaded interpreter the user stands a better chance of getting his response a lot quicker.   Also, if you have a machine with multiple processors the bot engine will only take advantage of one processor.  Unless you instantiate a second instance of your interpreter as a process.
>
> My bot currently is *not* a true mutli-user, multi-bot, multi-threaded interpreter.  That's what I'm working on right now and let me tell you....It complicates things exteremly as well as forces you to trade off some speed and memory usage to support it.  But it's fun and challenging to see if you can do it ;-)
>
> Here is one great tip I picked up off of other bot interpreter writers (you might know this) for structuring your node mapper to support multi-user multi-bot and to be more memory efficient.  Make your stack go this way and add user id and bot id nodes:
>
> topic -> [topic] -> that -> [that] -> word1 -> word2 -> wordn -> [userid] -> userId -> [botId] -> botId
>
> So, if you have a user with an id of "woody" and a bot id of "mybot" and he was to add 
>
> <category>
> <pattern>hi</pattern>
> <template>good</template>
> </category>
>
> your stack would look like this
>
> * -> [topic] -> * [that] -> hi -> [userid] -> woody -> [botid] -> "mybot"
>
>
>
>  ----- Original Message ----
> From: Nicholas H.Tollervey <ntoll at ntoll.org>
> To: Alicebot Developer Discussion <alicebot-developer at list.alicebot.org>
> Sent: Tuesday, December 5, 2006 1:53:32 AM
> Subject: Re: [alicebot-developer] Program# 2.0
>
> Jeroen,
>
> The quick answer is a very Zen yes and no. :-)
>
> If you were to expose the library from behind say a web-service then, as
> far as I know, .NET/IIS Mono/Apache will handle multi-threading in terms
> of dealing with requests, queuing them and so on.
>
> With regard to chat-sessions, that is left to the implementer of the
> system to deal with as this is likely to be different from application
> to application. My development philosophy for AIMLbot was to implement
> only the minimum amount of functionality As I'm sure you realise,
> AIMLbot provides a User class to be used to encapsulate a chat session.
> It is capable of holding the chat history and contains an ID attribute
> that should be used as a GUID (session ID?).
>
> As with all new releases, there should be a version 2.1 released in
> about a week where I'll fix some gremlins I missed for 2.0 and add a
> couple of features I just didn't have time to get in for 2.0. One of
> these "features" is adding a means of saving and loading User state via
> XML and/or serializing the object - the developer only need worry about
> how to store such information in a database or file-system for example.
>
> I'd welcome any ideas or suggestions.
>
> Thanks for the positive response,
>
> Nicholas.
>
> botmaster at mariekebot.nl wrote:
>   
>> Well that is just great!!
>> just one - maybe a rather stupid - question:  does it support 
>> multithreading?
>> meaning it handles chatsessions seperately?
>>
>> i looked at the docs but did not find it yet.
>>
>> Jeroen
>>
>> ----- Original Message ----- 
>> From: "Nicholas H.Tollervey" <ntoll at ntoll.org>
>> To: "Alicebot Developer Discussion" <alicebot-developer at list.alicebot.org>
>> Sent: Saturday, December 02, 2006 3:12 AM
>> Subject: [alicebot-developer] Program# 2.0
>>
>>
>> Hi,
>>
>> Just a quick note to say that I've just released a re-written .NET
>> AIMLbot class library and moved the project to Sourceforge (project:
>> AIMLbot). In this age of "2.0"s I thought it only apt that I jump on the
>> bandwagon! :-)
>>
>> The original Program# was written over three years ago and was also my
>> first project in C#. It became a vehicle for me to learn about the .NET
>> platform.
>>
>> Although many people found it useful (it has been downloaded many
>> thousands of times from my homepage) it was slow, not completely
>> reliable and lacking in features.
>>
>> Now that I have lots of experience and knowledge of .NET under my belt,
>> I have re-written this project from scratch to implement several
>> modifications and improvements. These are:
>>
>>     * Better cross-platform compatibility. Support for .NET 1.1, 2.0 and
>>       XNA as well as the open source MONO project (tested under version
>>       1.1). Testing on Windows Vista with version 3.0 of the .NET
>>       platform is pending.
>>     * A completely new modular architecture to make it easier for
>>       developers to extend and add functionality.
>>     * A simpler and more logical API.
>>     * Standards compliant AIML support with the option for custom tags.
>>     * Very small size (currently only 52k).
>>     * Very fast (over 30,000 categories processed in under a second).
>>     * Inclusion of a comprehensive test suite including over 200 unit
>>       tests (based upon NUnit <http://www.nunit.org/>).
>>     * A means of saving the bot’s “brain” as a binary file
>>       (Graphmaster.dat).
>>     * Some simple code snippets and examples for developers to get
>>       started (simple windows and console based applications as well as
>>       a sample custom tags library).
>>     * Appropriately commented code.
>>     * Comprehensive documentation.
>>
>> Sourceforge is useful because it provides bug tracking, documentation,
>> mailing lists, public forums, source control (subversion), file space
>> and project management capabilities (among other things).
>>
>> Downloads, documentation, help and advice on implementing and using the
>> library in your own projects can be found at the Sourceforge project
>> page: http://aimlbot.sourceforge.net/ (Although I have yet to finish all
>> the docs and upload the source to subversion - files are available for
>> download).
>>
>> The project is now covered by the LGPL. As always, comments, suggestions
>> and ideas are most welcome.
>>
>> Best wishes,
>>
>> Nicholas
>>
>> Nicholas H.Tollervey
>> http://ntoll.org/
>>
>> _______________________________________________
>> alicebot-developer mailing list
>> alicebot-developer at list.alicebot.org
>> http://list.alicebot.org/mailman/listinfo/alicebot-developer
>>
>>
>>
>>   
>>     
>
> _______________________________________________
> alicebot-developer mailing list
> alicebot-developer at list.alicebot.org
> http://list.alicebot.org/mailman/listinfo/alicebot-developer
>
>
>
>
>
>  
> ____________________________________________________________________________________
> Any questions? Get answers on any topic at www.Answers.yahoo.com.  Try it now.
> _______________________________________________
> alicebot-developer mailing list
> alicebot-developer at list.alicebot.org
> http://list.alicebot.org/mailman/listinfo/alicebot-developer
>
>   

_______________________________________________
alicebot-developer mailing list
alicebot-developer at list.alicebot.org
http://list.alicebot.org/mailman/listinfo/alicebot-developer





 
____________________________________________________________________________________
Have a burning question?  
Go to www.Answers.yahoo.com and get answers from real people who know.


More information about the alicebot-developer mailing list