I have two interfaces: Camera and Computer. So far, each interfaces have multiple implementations in my codebase and they are loosely coupled (no implementations of Camera depends on any implementations of Computer and vice versa).
Now I am interested to create a new class called DigitalCamera. DigitalCamera optionally requires input from a Computer to perform its functions. What it needs is a dictionary of integers from whichever Computer I am currently using in my codebase.
I am aware that this usage will break the principle of loosely coupled so I want to explore the best options to minimize pain down the road.
How should I write my DigitalCamera class to support this functionality?
I am using Java if that matters.
=== EDIT ===
To address some of your questions:
- It is only one implementation of Camera that depends on Computer. Not all cameras depend on computers
- The data can be passed in multiple ways: (i) calling DigitalCamera.setData(...), (ii) calling the API method with additional arguments, (iii) passing a CompletableFuture that returns a Map, etc. I haven't decided what is the best way to do this.