Repeated code
DLJ7666 opened this issue · 2 comments
DLJ7666 commented
Issue Summary
There are some classes in the twilio/base folder which are basically a copy-paste between each other.
Couldn't just they be implemented in the way TwilioException is, as an abstract interface, which then each of these classes implementing such interface?
I think this would be a better code practice than the currently version is,
tiwarishubham635 commented
Hi @DLJ7666!
Will definitely take a look. Thanks!
miniluz commented
The classes I assume you are referring to (InstanceContext, InstanceResource, ListResource) are only identical because they are empty. They serve as abstract classes to be expanded upon. As a sample:
class ListResource(object):
def __init__(self, version: Version):
self._version = version
Since every class is only 3 lines long, two of them boilerplate, there really is no need to make an interface for them.