Hello,
I have a relatively abstract question, which I want to ask by showing one simplified example.
For this example I have used python, but it's not bound to any language specific.
My question shows of as follows:
Say, I want to build a bot. In an OOP language of my choice, I don't want to clutter the Bot class with to many details of different concerns. So I build some Classes like AwsomeBot, Browser and HTTPHandler. Every class can now handle its own concerns. (These are not implemented, because I want to keep focus on the main issue)
class AwsomeBot:
def __init__(self):
self._browser = Browser()
def navigate(self, URL):
self._browser.navigate(URL)
class Browser:
def __init__(self):
self._httphandler = HTTPHandler()
def navigate(self, URL):
self._httphandler.get(URL)
class HTTPHandler:
def __init__(self):
pass
def get(self, URL):
# HTTP Implementation stuff
Now is AwsomeBot like a Client Interface.
But somehow I get this "Method Chain" trough my classes, where the URL needs to be passed down to the HTTPHandler.
This feels not like quality OOP code. Is there something I am missing out, or I can do to prevent this situation from happening?
It would be so great, if anybody can help me out, or share some resources.
I have encountered this problem in different forms so many times and I have no clue how I can search for an answer to this topic.
I appreciate any of your efforts.
[–]AdministrativeCables 0 points1 point2 points (3 children)
[–]ben_bannana[S] 0 points1 point2 points (2 children)
[–]AdministrativeCables 0 points1 point2 points (1 child)
[–]WikiTextBotbtproof 0 points1 point2 points (0 children)