In my design, I create a DataAccess Interface, two classes LocalDataAccess and RemoteDataAccess implement the interface. The LocalDataAccess passes on the calls to Data while the RemoteDataAccess passes on the calls to remote interface. My first question is: I believe I use the Factory pattern but I am not sure it is Factory Method or Abstract Factory ? Because I have some confusion on them. My second question is: is there any other design patten appear in my design?
Nobody can tell whether you are using the Abstract Factory or Factory Method pattern unless you tell us how are you instantiating the DataAccess object (LocalDataAccess or RemoteDataAccess). Check out this site: http://www.dofactory.com/patterns/patterns.asp#list They have brief descriptions of both the Abstract Factory pattern and Factory Method pattern.
Nobody can tell whether you are using the Abstract Factory or Factory Method pattern unless you tell us how are you instantiating the DataAccess object
There is an attribute named db in LocalDataAccess and RemoteDataAccess. For LocalDataAccess, db connects to local data file while for RemoteDataAccess, db connects to remote data base. A class named Service has an attribute named db of DataAccess Interface,when user chooses the connection mode, a method in service will instance the specific child class. [ September 11, 2002: Message edited by: Jane Wang ] [ September 11, 2002: Message edited by: Jane Wang ]