Information System of a Maufacture Industry. The Industry build components which comprises of sub-components, while sub-components comprises of sub-sub-components...
Strategy 1: Composite Pattern
In Bussiness Logic layer, components are organized as Composite Pattern.
And in DB, all components details are stored in one table.
Each component record has an "ID" and a "PID" field which indicates the ID of its parent component.
Strategy 2: Internal Code
In DB, each component record has a field "IID" which means Internal ID.
for example: for 3-layer hierarchy
"010000" for the first node of the first layer;
"010100" for the first node of the second layer, its parent id is "010000";
"010200" for the second node of the second layer, its parent id is "010000";
"010101" for the first node of the third layer, its parent id is "010100";
My personal idea is that Composite Pattern strategy is easy to extend and more professional.
While it seems hard to handle if cycle exists in the hierarchy.
Any ideas about it?