Thread: Design guidelines advice - IRC Bot class

  1. #1
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477

    Design guidelines advice - IRC Bot class

    I'll start of by saying that I'm a C programmer going to C#. That is, procedural and imperative to extreme OOP and generic programming.

    Therefore I come here to seek advice.

    I'm working on an IRC bot class. Obviously, coding an irc bot is not hard at all, but coding it so it is generic and not specific to my application is something much different. I have not really sat down and spent time on trying to program something generic, so I thought this could be a good exercise.

    I have a few ideas that might be good:

    • Use events to handle stuff - connection failed, connection succeeded, perhaps even data received..
    • Create some kind of an interface to add commands, using classes
    • Use exception handling to deal with failed stuff, which then call the event handlers for that event.


    I had a few more, I think, but they fell out. Any ideas, suggestions, etc? I don't want to start coding too much before I know what's good to do and how far I should go to implement stuff etc.

    All input greatly appreciated.

    EDIT:

    Just to clarify, the hard part in this for me is knowing where to draw the line between application specific and class specific. Eg. I can't implement a method in the class that sends stuff to my WPF controls; I should rather let the user handle the events and then he can deal with the output himself - right?
    Last edited by IceDane; 12-04-2008 at 01:34 AM. Reason: Clarification
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Quote Originally Posted by IceDane View Post
    Just to clarify, the hard part in this for me is knowing where to draw the line between application specific and class specific. Eg. I can't implement a method in the class that sends stuff to my WPF controls; I should rather let the user handle the events and then he can deal with the output himself - right?
    I think you're answering your own question here... Start defining interfaces, not classes.

    * Interfaces which your bot implements and other code can use
    * Interfaces your bot can use and which other code implements

    Look at the COM framework for some stimulus. In fact, while you're at it you might as well define COM interfaces for your bot.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Quote Originally Posted by brewbuck View Post
    I think you're answering your own question here... Start defining interfaces, not classes.

    * Interfaces which your bot implements and other code can use
    * Interfaces your bot can use and which other code implements

    Look at the COM framework for some stimulus. In fact, while you're at it you might as well define COM interfaces for your bot.
    I have zero experience in using the COM, but maybe starting getting some now is as good a time as any. Thanks.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Need some help with making irc bot
    By kazz in forum C++ Programming
    Replies: 6
    Last Post: 11-23-2007, 11:47 AM
  3. IRC, reading the stream
    By Iyouboushi in forum C# Programming
    Replies: 6
    Last Post: 08-03-2006, 05:34 PM
  4. Help me design a class project!
    By codegirl in forum A Brief History of Cprogramming.com
    Replies: 6
    Last Post: 03-17-2004, 08:19 PM
  5. class design and operation overload
    By Unregistered in forum C++ Programming
    Replies: 1
    Last Post: 12-03-2001, 10:49 PM