Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!news-1.dfn.de!news.dfn.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Ian Collins Newsgroups: comp.lang.c++ Subject: Re: Method that only one other class type may access Date: Wed, 05 Oct 2011 21:39:48 +1300 Lines: 35 Message-ID: <9f2jekFaemU2@mid.individual.net> References: <9eufl3F5kfU7@mid.individual.net> <9ev7noFdlfU1@mid.individual.net> <840429b4-ebb0-41ae-ab28-0934af8b91e9@m15g2000vbk.googlegroups.com> <9f1c51F4qnU1@mid.individual.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net 6qlGoJIUD/78MvpIliZeKA2xC+wwVngA1G26NCOGwl7S3UXdsO Cancel-Lock: sha1:+Td2hSlCE+8zvSEmQWMY9fMMtXc= User-Agent: Mozilla/5.0 (X11; U; SunOS i86pc; en-US; rv:1.9.2.9) Gecko/20101021 Lightning/1.0b2 Thunderbird/3.1.4 In-Reply-To: Xref: x330-a1.tempe.blueboxinc.net comp.lang.c++:10675 On 10/ 5/11 09:19 PM, Jorgen Grahn wrote: > On Tue, 2011-10-04, Ian Collins wrote: >> >> Just use the native interface. On one of my projects we had a long >> discussion about this topic and that was our conclusion: KISS! > > I'm repeating myself, but an anecdote: > > A few years back I decided to write The One True C++ Wrapper For BSD > Sockets. I wanted type safety: distinct types for UDP sockets, TCP > listening sockets, "normal" TCP sockets ... with the type system > preventing mistakes such as doing listen() on an UDP socket or setting > UDP-specific socket options on a TCP socket. But at the same time I > didn't want to invent a brand new interface to learn. > > After a while I realized that (a) this was hard work and (b) it was > for the most part not useful work. Any half-decent design in your > application makes most of the mistakes I wanted to eliminate > - unlikely to happen, because you tend to keep different kinds of > sockets apart > - likely to be found quickly if they /did/ happen > > So I threw most of it away. I just kept some read/write buffering code > which had proven useful in real life. At least you had the good sense to give up after only one attempt. I had three goes, over 15 years before realising the error of my ways. > (Disclaimer: I have no experience with Boost.asio; perhaps it forces you > in another direction.) I've only ever seen it end in tears. -- Ian Collins