Skip to content
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

Rollback dataclass approach #184

Open
henhuy opened this issue Aug 30, 2024 · 1 comment
Open

Rollback dataclass approach #184

henhuy opened this issue Aug 30, 2024 · 1 comment

Comments

@henhuy
Copy link
Collaborator

henhuy commented Aug 30, 2024

This came up at #180 (comment)

Idea:
I came to the conclusion, that we should rollback implementation of dataclass facades. I do not vote going back all the way to kwargs, but instead make a mix of required, keyword-only arguments, optional arguments and kwargs.

Explanation:
The whole dataclass approach makes it very hard for inheritance (even if it was my idea originally to introduce them).
Spend way too much time to get it working last time.
The problem with dataclasses is, that they don't allow kwargs.
but we wanted to allow them in facades, so we implemented dataclass_facade which takes all parameters compares them with original dataclass parameters, puts the diff aside, initializes dataclass and adds kwargs from diff afterwards.
The problem with a child facade is, that once we added new parameters in child facade, the algorithm from above is not working anymore and initialization gets more and more complicated (decorator of child class -> init child class ->decorator of parent class -> init parent class) and it is very hard to debug.
For some reason decorator from above (see comment from above) worked, instead of dataclass_facade, but right now I cannot remember why.

@Bachibouzouk
Copy link
Collaborator

This is exactly what I struggled with, wanting to use inheritance for a Facade ^^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants