I am new to OOP and have run into this OOP design problem and I have a hard time reasoning the best possible solution to. I have attached a picture of my current design. Basically I have 2 sets of hardware which have 2 different data types for identifying them. I am trying to filter some string data and based on what is inside that data I will notify the correct piece of hardware. I have created a separate family of classes implementing the DataFilterWorker interface due to the fact that the filter data method is expected to be extensible based on where the data is coming from.
See OOP design here please.
Based on my picture this would be an example of some code that might be written:
HardwareA_DataFilterWorker worker HardwareA_DataFilter dataFilter(worker); dataFilter.FilterData(someData);
Here’s what the FilterData method might look like:
filteredData = my_hardwareADataFilterWorker.FilterData(someData); hardwareAGuid = my_hardwareADataFilterWorker.GetFilteredHardwareId() NotifySubscriber(hardwareAGuid, filteredData);
My question is whether someone could provide me with critique on what I could do better for this design as it seems like I am introducing very tightly coupled subclasses and I know that general advice is to avoid that if possible. I am happy to provide more info if requested. Thanks!
Noah Zinn is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.