From: Warren Young Date: June 14 2005 6:42pm Subject: Re: v2.0 release plan List-Archive: http://lists.mysql.com/plusplus/4532 Message-Id: <42AF2515.4000502@etr-usa.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Chris Frey wrote: > Connection con; > Connection con2; I'm not sure templatizing Connection is required. You could just add a parameter to the ctor: Connection con(new MySQLDriver, ...) The semantic difference is that Connection has-a driver, it is not implemented-in-terms-of-a specific driver type. (Connection clearly could be implemented in terms of a generic driver type, which implies inheritance, not templates.) One benefit of my way is that you don't duplicate the code of Connection in the binary for each concurrent driver type you use. Another benefit is that a program could switch database types without being rebuilt. It could have a preference file of some sort, saying which database server is on this particular system. The program would just pass a different DatabaseDriver subclass instance when creating the Connection object. The only advantage to the template method is that you wouldn't have a pointer indirection when calling the driver. But since almost every driver call involves a database server interaction, optimizing call times pointless.