enlightenedby42
Supreme [H]ardness
- Joined
- Jan 19, 2005
- Messages
- 4,412
Was wondering if someone could give me a few pointers on structuring java packages.
What I'm needing to do is create data wrapper objects for database entities for use in a handful of web apps we're working on. The nature of the business is really windows applications for trucking companies to manage their insurance claims and human resources stuff. All the web stuff will be extensions of this functionality (largely for the purpose of varying forms of data exchange such as interfaces to insurance companies for claim submission, etc.)
As such, there's are some pretty clear commonalities between the different flavors of similar data I'd need to be representing that provide good opportunities for polymorphism via interface implementations (I think my OO terminology is correct there).
By way of example, say I want to create an interface or possibly even an abstract class containing method definitions for fetching common data from comman places in the DB (or some implementations in the latter case) for a very basic claim containing, say, a claim number, an occurrence date, and anything else that is common to all claims of all types.
So, then I can create a WorkersCompClaim that implements the interface or abstract class to add government mandated nature of injury codes and such to my existing code. Or add product information in a CargoClaim class. Why reinvent the wheel on fields that are common to all derivatives of an insurance claim?
So in the above example, how would those abstract classes or interfaces fall into the package structure?
Would the interface and it's implementation be on the same "level" in the package structure, or would the derived class be "underneath" the interface?
In other terms, should the package:
contain both the interface and its implementation?
Or should the above contain the interface, and have a subpackage along the lines of:
which contains a worker's comp implementation of the base interface/abstract class?
Am I thinking about this stuff correctly in the first place even?
Sorry for the length....trying to be clear and am new at this.
Thanks.
What I'm needing to do is create data wrapper objects for database entities for use in a handful of web apps we're working on. The nature of the business is really windows applications for trucking companies to manage their insurance claims and human resources stuff. All the web stuff will be extensions of this functionality (largely for the purpose of varying forms of data exchange such as interfaces to insurance companies for claim submission, etc.)
As such, there's are some pretty clear commonalities between the different flavors of similar data I'd need to be representing that provide good opportunities for polymorphism via interface implementations (I think my OO terminology is correct there).
By way of example, say I want to create an interface or possibly even an abstract class containing method definitions for fetching common data from comman places in the DB (or some implementations in the latter case) for a very basic claim containing, say, a claim number, an occurrence date, and anything else that is common to all claims of all types.
So, then I can create a WorkersCompClaim that implements the interface or abstract class to add government mandated nature of injury codes and such to my existing code. Or add product information in a CargoClaim class. Why reinvent the wheel on fields that are common to all derivatives of an insurance claim?
So in the above example, how would those abstract classes or interfaces fall into the package structure?
Would the interface and it's implementation be on the same "level" in the package structure, or would the derived class be "underneath" the interface?
In other terms, should the package:
Code:
com.mycompany.dataobjects.claims
Or should the above contain the interface, and have a subpackage along the lines of:
Code:
com.mycompany.dataobjects.claims.workerscomp
Am I thinking about this stuff correctly in the first place even?
Sorry for the length....trying to be clear and am new at this.
Thanks.