List:MySQL++« Previous MessageNext Message »
From:Axel Howind Date:July 16 2007 10:35am
Subject:Re: Connection::connect() interface is changing
View as plain text  
Warren Young schrieb:

> I've given up on the reordering change that can cause silent breakage.
> 
> But you must accept that I do intend to break things.  If I am not 
> allowed to break anything, there's no point to v3.

No problem with that, but if you break it, make it obvious.

>> Personally, I even think it is no good to have default parameters for 
>> setting up connections at all: this is something where I always want 
>> the developper to better think twice than just proceed using the 
>> default values.
> 
> I can understand that to a point.  But surely you can't be in favor of 
> candy machine interfaces?  This one interface allows you to specify four 
> completely different underlying implementations.  Taking your thought to 
> its extreme, you need to explicitly deal with three wrong choices in 
> order to select the one you do want.  That's a mess.

Why not have different interfaces for the different implementations?

Make the default (and possibly copy-) constructor private and have 
factory methods as public interface, like:

static Connection Connection::connectTCP ( host, user, port, ... );
static Connection Connection::connectNamedPipe ( ... );
static Connection Connection::connectDomainSocket ( ... );

Then use like this:
Connection con = Connection::connectTCP(...);

Or create a new connection factory class for this.

Axel
Thread
Connection::connect() interface is changingWarren Young13 Jul
  • Re: Connection::connect() interface is changingDrew M.13 Jul
    • Re: Connection::connect() interface is changingWarren Young13 Jul
  • RE: Connection::connect() interface is changingYuantu.Huang13 Jul
    • Re: Connection::connect() interface is changingWarren Young13 Jul
      • RE: Connection::connect() interface is changingJoel Fielder13 Jul
        • RE: Connection::connect() interface is changingWilliam F. Dowling13 Jul
        • Re: Connection::connect() interface is changingWarren Young14 Jul
          • Re: Connection::connect() interface is changingWarren Young14 Jul
            • Re: Connection::connect() interface is changingAlex Burton15 Jul
              • Re: Connection::connect() interface is changingPeter Garner15 Jul
              • Re: Connection::connect() interface is changingWarren Young16 Jul
          • RE: Connection::connect() interface is changingJoel Fielder16 Jul
            • Re: Connection::connect() interface is changingWarren Young16 Jul
              • Re: Connection::connect() interface is changingAxel Howind16 Jul
                • Re: Connection::connect() interface is changingWarren Young16 Jul
  • Re: Connection::connect() interface is changingAxel Howind13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul
      • Re: Connection::connect() interface is changingAxel Howind16 Jul
  • Re: Connection::connect() interface is changingAlex Burton13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul
  • RE: Connection::connect() interface is changingJim Wallace13 Jul
    • Re: Connection::connect() interface is changingWarren Young14 Jul