Re: Re: Re: SourceComment: BItem hierarchy - Removing needless code…

Hi Atul,

The chain of responsibility sounds interesting! I’ll check your patch.

I think we’ll anyway need to know the type because the users of BDecoder like Torrent (file) or TrackerResponse will have to parse the raw data and they’ll need BDecoder for that. Depending on the context a BInt as a BItem or a BDictionary as a BItem may be expected. Using the generalization BItem in the generic BDecoder and then using the specializations at the more specific Torrent or TrackerResponse is IMHO perfectly fine as far as OO is concerned.

So my question is whether there are any arguments against using typeid(). If not than we should better use the language features instead of implementing our own “type system” using the pure virtual type().

Regards,

Peter

Would you like to post a relpy?


This post is a reply to:
Re: Re: SourceComment: BItem hierarchy - Removing needless code…
Hi Peter I think depending on types is going against the OO grain. Then how could we design BItem? Here is one idea... 1. Push the parsing to BItem concrete classes ( So (more...)

No follow-ups yet.