In one of the project I am working on, I am facing a problem in terms of creating an object with a dependency that sits at a deeper level in the class composition. Following diagram shows the class composition.
The problem I am facing is as follows:
- The IFrameGrid object contains 'IBracings' object at a deeper level in the class composition.
- Creation of the object 'IBracings' requires 'INodeEnvelope' which is a struct consisting of 4 Node (a geometric Point) objects.
- IFrameGrid requires the IBracings to be instantiated as soon as the UI is displayed to the user so that the user can change IBracings type based on the need. However, for IBracings to be instantiated the IFrameGrid should have been instantiated already since the INodeEnvelope is dependent on the root level user input.
UI looks something like this:
I have a feeling that, this is a design problem and I could not figure out as to what changes should be made to resolve this issue and honestly I am not a software developer.
I hope the description and the images above gives a fair understanding to convey my issue.
Can someone help me in identifying and resolving this and is much appreciated if it is elaborated instead of using some specific software terms which are known to the people working in a professional development team(s).
I tried to refactor this by introducing some AbstractFactories but no success as the ConcreteFactory implementation for creating the IBracings has a dependency on INodeEnvelope which can be acquired only after IFrameGrid object is available which itself has an indirect dependency on IBracings.
I also tried to find a solution in the web. Unfortunately I could not find anything relevant.
Looking forward for:
- If AbstractFactory is the solution for this kind of problem, can anyone explain may be by an example or by a diagram similar to the one attached herewith?
- If solution is by some other means, what would that be? An elaborated example can save a lot of brain storming.
PS: The title may not be apt for the question I am posting and I am not sure about what other title could be apt.
Aucun commentaire:
Enregistrer un commentaire