I'm currently developing a small component-based framework the Android platform. The framework has some ready for use and some abstract (has some internal logic, but the developer needs to add some code to make it fully functional) components. All communication between the components is satisfied using interfaces. My question is:
Knowing that some components have dependencies, my framework should automatically provide them?
E.g.: I have an A component that "needs" B component. At first, I thought of two solutions:
My framework should create and inject the B component automatically when the developer instantiate the component A. If B is an abstract component, I would create and provide a default instance of it.
The framework should explain in the API that A component needs B component and then, leave to the developer to instantiate B component and pass it as a dependency to A.
In the second solution the developer could also create a new component that respects the contract (interfaces) with the A component and then use it.
Which of these solutions would lead to better maintenance, flexibility, and expansion of both the framework and the developers code? I accept other solutions.