Abstract Design Pattern implementation
- by Pathachiever11
I started learning design patterns a while ago (only covered facade and abstract so far, but am enjoying it). I'm looking to apply the Abstract pattern to a problem I have. The problem is: Supporting various Database systems using one abstract class and a set of methods and properties, which then the underlying concrete classes (inheriting from abstract class) would be implementing.
I have created a DatabaseWrapper abstract class and have create SqlClientData and MSAccessData concrete class that inherit from the DatabaseWrapper.
However, I'm still a bit confused about how the pattern goes as far as implementing these classes on the Client.
Would I do the following?:
DatabaseWrapper sqlClient = new SqlClientData(connectionString);
This is what I saw in an example, but that is not what I'm looking for because I want to encapsulate the concrete classes; I only want the Client to use the abstract class. This is so I can support for more database systems in the future with minimal changes to the Client, and creating a new concrete class for the implementations.
I'm still learning, so there might be a lot of things wrong here. Please tell me how I can encapsulate all the concrete classes, and if there is anything wrong with my approach.
Many Thanks!
PS: I'm very excited to get into software architecture, but still am a beginner, so take it easy on me. :)