architecture - Redesigning a search engine, what design patterns to apply -


i'm stuck here. i'm trying add new database in addition current one. i'm going use factory pattern select right database control this:

private assetstoresfactory assetstoresfactory;  assetstore assetstore = assetstorefactory.getassetstore(query); assetstore.search(search);  public assetstore getassetstore(string query){  assetstore assetstore;  if (qualifiesforstorea(query))   assetstore = new assetstorea();   else    assetstore = new assetstoreb();   return assetstore; }   assetstore ..... results search(assetsearch search) {  assetsearchoperation o = new assetsearchoperationa(search); } .....   assetstore b ..... results search(assetsearch search) {  assetsearchoperation o = new assetsearchoperationb(search); } .....  

now real problem lies here. current approach perform searches this:

                    _______________________                     | basesearchoperation |                     | ___________________ |                     | abstract search()   |                     -----------------------                              ᴧ                               |                      ____________________                      | streamingsupport |                       |__________________|                              ᴧ                               |                      ______________________                     |assetsearchoperation|                     |____________________| 

now there code query current database in of above classes , needs removed , isolated. can't head around how can done. note anonymous implementations of assetsearchoperation override streamingsupport. appreciated! if need more information, please ask!

parametrize assetstore constructor database connection instance , pass specific instance inside factory method.


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -