Pantek Library
Hosting Provided By
CybrHost
High Speed Hosting

Re: Connection::connect() interface is changing

From: Axel Howind <Axel.Howind(at)htp-tel.de>
Date: Mon Jul 16 2007 - 06:35:20 EDT


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

-- 
MySQL++ Mailing List
For list archives: 
http://lists.mysql.com/plusplus
To unsubscribe:    
http://lists.mysql.com/plusplus?unsub=lists@pantek.com
Received on Mon Jul 16 06:35:31 2007
Do you need help?X

This archive was generated by hypermail 2.1.8 : Thu Aug 09 2007 - 19:28:29 EDT


Contact Us  Legal Notices  Order Services Online 
Pantek Home  Privacy Policy  IT news  Site Map  Pantek Library