On 3/14/11 10:38 AM, Jonas Drewsen wrote:
On 13/03/11 23.44, Andrei Alexandrescu wrote:
You'll probably need to justify the existence of a class hierarchy and
what overridable methods there are. In particular, since you seem to
offer hooks via delegates, probably classes wouldn't be needed at all.
(FWIW I would've done the same; I wouldn't want to inherit just to
intercept the headers etc.)
Missed this one in my last reply.
Ftp/Http etc. are all inheriting from a Protocol class. The Protocol
class defines common settings (@properties) for all protocols e.g.
dnsTimeout, connectTimeout, networkInterface, url, port selection.
I could make these into a mixin and thereby get rid of the inheritance
of course.
Use Occam's razor and the path of least resistence to get the most
natural interface.
I think that keeping the Protocol as an abstract base class would
benefit e.g. the integration with streams. In that case we could simply
create a CurlTransport that contains a reference to a Protocol derived
objects (Http,Ftp...).
Or would it be better to have specific HttpTransport, FtpTransport?
Count the commonalities and the differences and then make an executive
decision.
Andrei