oop - Java adding static methods to a class -


ok guys,

here's question more of principle of fact.

i have data-structure used on both client , server.

however, on server end, want functionality create client sort of datastore (at moment sql, used serialized data, doesn't matter).

originally had giant class called 'datastore' had static methods retrieving stored object.

while not terrible, that's not oo, , it's not scalable.

so considered moving these static methods datastructures themselves. however, mean shared client libraries knew how retrieve objects datastore - kind of silly.

so i'm creating new classes each object in new datastore package, each of holds static methods retrieving 1 object datastore.

my question is, how signify relationship between these data manager classes , objects retrieve?

functionally, doesn't matter. static methods work fine. want indicate future me , other future developers data retriever class , object class tightly linked.

my first thought make data retriever extend data structure. however, require declaring default constructors , implying class instantiated - can, why you?

my second thought make data retriever extend data structure, abstract. flag tight relationship other developers, , make clear new methods being added, no new fields.

however, extending concrete class abstract class seems strange, , java still make me create default constructors.

my question is, how signify relationship between these data manager classes , objects retrieve?

this standard industry problem: how data database application. common solution use dao pattern, have data access object (dao) responsible retrieving object database.

if retrieving employee's personal information, salary, etc., have employeedao class retrieve appropriate table. if retrieving company's profits, locations, number of employees, have companydao class retrieve object database.

on top of service layer, performing business logic; also, dao manager, instantiating daos , returning references whatever classes need them.


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -