java - Is this a DAO manager pattern? What are the appropriate class and interface names? -
i have interface, somethingdao
, , implementing class, somethingdaoimpl
. interface consists of 11 methods, each method requires 1 or more complex sql queries.
i broke implementing class several smaller classes, let's call them helper1
, helper2
, helper3
, ... helpern
lack of better names. somethingdaoimpl
has instance of each, , routes method calls each.
public class somethingdaoimpl implements somethingdao { private helper1 helper1; private helper2 helper2; private helper3 helper3; // ... private helper8 helper8; public list<x> getx(...) { return helper1.getx(); } public list<y> gety(...) { return helper2.gety(); } public list<x> getdetailedx(...) { list<x> ds = getx(...); helper6.addto(ds); helper7.addto(ds); helper8.addto(ds); return ds; } }
is there name technique? complex dao has several "worker" bees work it, , manages them?
is dao manager pattern, helper1, helper2, helper3 dao objects? i'm interested in proper naming conventions, in case rename somethingdaoimpl
somethingdaomanager
, , helper
become helperdao
.
i have seen name 'service' used in place, in case somethingdao
interface renamed somethingservice
, , worker-bee classes carry dao
@ end of names.
thanks... think looking naming conventions, , design pattern, associated scenario. implementation clear possible, , having names suggest pattern using helpful.
imo code 'bad code' pattern, more tight coupled code. 8 helpers lot , it's clealry badly designed object. know java , don't have c# extension methods ideally helpers, think way use dependency injection via di container.
every object needing dao or service abstract dependencies, constructor arguments.
public class myobject { public myobject(isomeservice serv,irepository repo){} }
the point is, use objects relevant context , code take dependencies. highly doubt might need 8 helpers anything. if that's case, code way , needs redesigned.
Comments
Post a Comment