The situation is this: You have two classes that both implement the same interface and both classes work together to complete some business process.
For example networkUserManager
and localUserManager
implement IUserManager
which has a method getUser()
. networkUserManager.getUser()
puts a request to get a User
on the queue and returns the reply. localUserManager.getUser()
gets a request off the queue, finds the user information in some database, and then replies with the user data.
When I saw something similar to this being done, I couldn't help but wonder if this was bad design. Is this bad design and if not what is an example where doing something like this would be a good idea?
That smells pretty bad to me. Different classes may have methods with the same name, of course, but if they are both implementing the same interface, then there is an assumption that they will be doing the same thing. Here they are doing opposite things!
Perhaps it's a lack of imagination on my part, but I cannot fathom why that would ever be a good idea.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With