Ok before marking this as a duplicate let me clarify myself. I\'m reading about the visitor pattern and its applicable uses.
I\'ve stumbled upon this post: When should I
you can use the visitor pattern to design a db saver, like shown in this diagram here: class diagram for an object saver in different dbs
you can choose what db to use, the client class will look similar to this:
Visitor mongosaver = new MongodbSaver();
Visitable user = new User();
//save the user object using mongodb saver
user.accept(mongosaver);
Visitable post = new BlogPost();
Visitor mysqlsaver = new MysqlSaver();
//save the BlogPost using Mysql saver
post.accept(mysqlsaver);
you can refer to this also: https://www.oodesign.com/visitor-pattern.html