std.database a design suggestion

Michal Minich michal.minich at gmail.com
Mon Oct 10 13:09:13 PDT 2011


On Mon, 10 Oct 2011 12:02:13 +0200, bls wrote:

> Hi, what do you people think about using the GoF Factory (design)
> pattern ?
> F.I.

for one, in this case, better to use interface only, and connect method 
can return instance of Database class, saving one factory and one method.


interface IDatabase {
    SqlCommand createCommand ();
}

class MySql : IDatabase {         
    static MySql connect (..specific args,probably connection string);
}

But yes, using factory classes and methods is good approach to this 
design problem.


More information about the Digitalmars-d-announce mailing list