i have problem about design a module of my project.
Lets say, you have two classes which both of them almost doing the same thing. You can think like DeviceManager.
Both of them connect/disconnect/parse exactly the same way. After parse the message from device they need to do different things like one of them print a message, the other one pass it to somewhere else.
I need to design this structure best as oop allows maybe with inheritance,interface,abstract etc. but i am not sure what is the best way to approach this problem.
Note: I dont want to violate any SOLID principle.
Thanks.
Example:
// lines exactly same code
** line different code
class DeviceMessageNavigator
{
//connect
//wait message
//parse message
**//NAVIGATE MESSAGE(Pass it to somewhere else)**
//disconnect
}
class DeviceMessagePrinter
{
//connect
//wait message
//parse message
**//PRINT MESSAGE**
//disconnect
}