Re: Where to start

Hi Atul,

I don’t remember the exact example from the GoF book but I think that State won’t suit our case so good. The reason is that QAbstractSocket already abstracts some of the details. For example, the disconnected signal is emitted by QAbstractSocket when recv returns 0. Additionally, if you look at the implementation of SocketTransport, you’ll see there are actually no switches that a State would eliminate.

I’m glad you like the decorator idea! I’m thinking about an alternative - add a setCodec() method to the Transport interface, or extend it to a new EncodedTransport interface?

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: Where to start
Hi Should SocketTransport be implemented as STATE? GoF takes a similar example to illustrate STATE ( TcpConnection )... Then only the connectedToHost can have correct read/write implementations... Actually the base class would be (more...)

Follow-ups:
Re: Where to start
Hi Peter, sorry, for late writing. Thank you for your long mail. Normally I want to write code with vim to get a better understanding how it work. The same I (more...)