[Twisted-Python] Need help pulling things together.

Brendon Colby brendoncolby at gmail.com
Fri May 25 19:35:02 EDT 2007


On 5/25/07, Matt Hubbard <m.hubbard at imperial.ac.uk> wrote:
> Hi Brendon,
>
> I'm having a hard time working out what you've got and where you're trying to go.
>
> I think you're asking where you should you place the abstraction between data from lineReceived and executing specific commands based on that data. I shall respond with the caveat that I'm not qualified to speak for the "right twisted way", but I hope I can be of some assistance.
>
> The first answer that springs to mind for most of your questions is "depends on what you're trying to achieve with your project".
>
> Where to place an abstraction layer is something that I often end up hitting my head against, and generally I've found this to be time-wasting vacillation.
>
> I'd honestly recommend you get on and code your management of users and of areas and worry about the abstraction layer later. Sitting around postulating doesn't get any code written and re-factoring small projects doesn't take that long.
>
>
> If it were me and I was writing a telnet-based chat server, I would probably separate chat messages from commands and make this distinction in the protocol. I'd handle command interpretation in the User class.
>
> class ChatProtocol......
>     def lineReceived(self,line):
>         if line[0] == '/':
>             self.user.cmdReceived(line[1:])
>         else:
>             self.user.msgReceived(line)
>
>
> I hope this helps. Please point out if I've entirely misinterpreted your question.
>
> Cheers,
> Matt.

Hi Matt,

You are exactly right. I've decided to just start coding and figure it
out. I've been vacillating for two years! :) Plus I've found a
protocol class that I can model (roughly). Thank you for your input!

Brendon




More information about the Twisted-Python mailing list