darthsabbath
December 21st, 2005, 11:19 PM
Hi, all,
I've got a question and I'm not QUITE sure how to put it... so let's just jump straight in... say I'm working with a library, we'll use Python's poplib for this example. Is it better to simply use the methods define by the library directly, such as...
# Let's connect to the host now
session = poplib.POP3(host, port)
session.user(login)
session.pass_(pass)
Or is it better to add another level of abstraction to this mix by grouping all of the POP3 functions into their own class, as in the following?
class POP3Session:
def ConnectHost(self):
self.session = poplib.POP3(self.host, self.port)
self.session.user(self.login)
self.session.pass_(self.pwd)
Functionally, there's no difference. But is it wasteful to do this grouping, or pointless, or does it serve to make the program better organized?
Sorry I haven't been clear... I know WHAT I'm asking, I'm just not quite sure how to ask...
Phil
I've got a question and I'm not QUITE sure how to put it... so let's just jump straight in... say I'm working with a library, we'll use Python's poplib for this example. Is it better to simply use the methods define by the library directly, such as...
# Let's connect to the host now
session = poplib.POP3(host, port)
session.user(login)
session.pass_(pass)
Or is it better to add another level of abstraction to this mix by grouping all of the POP3 functions into their own class, as in the following?
class POP3Session:
def ConnectHost(self):
self.session = poplib.POP3(self.host, self.port)
self.session.user(self.login)
self.session.pass_(self.pwd)
Functionally, there's no difference. But is it wasteful to do this grouping, or pointless, or does it serve to make the program better organized?
Sorry I haven't been clear... I know WHAT I'm asking, I'm just not quite sure how to ask...
Phil