-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move Message classes to class variables #631
Comments
@schlenk Any objections or thoughts? |
Sounds halfway reasonable. I see mostly pairs of request/response classes there, sometimes the response classes are hidden from sight one layer deeper. Most end up in parse_response() or construct_request() one way or the other, so this smells a bit like a pair of factories that could be extracted into their own classes. A bit like have a factory class, register the message pairs (request/response) under some symbolic name and use those in client/server where needed. Then pass in the factory into the constructor somewhere. |
The coupling of request/response cls makes sense. My idea was to have a dictionary with mapping of message type to class and pass that as a single kwarg to provider/server/client. It might not necessarily be a dictionary, but an object with attributes. The value in the mapping can be a tuple with request/response as elements. |
Many methods on
Server
andClient
takeMessage
class as akwarg
. This creates a need to override the method if we need to change the class (especially forProvider)
.It might be beneficial to make them a class variable and allow to override them in
__init__
perhaps by parsing a dictionary in order to not clutter the kwargs on the init method.The text was updated successfully, but these errors were encountered: