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

[Feature]: Rethinking package classes design pattern. #20

Open
wiseaidev opened this issue Oct 7, 2022 · 3 comments
Open

[Feature]: Rethinking package classes design pattern. #20

wiseaidev opened this issue Oct 7, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed

Comments

@wiseaidev
Copy link
Collaborator

Description

Hey @nidhaloff, I have a question related to the design pattern followed in this class. For me it looks redundant. Take a look at its usage in the tests:

def rabbit():
return BRabbit()

In order to create an EventPublisher, you have to call the inner class and pass the outer reference, BRabbit, as a parameter to the __init__ function:

publisher = rabbit.EventPublisher(b_rabbit=rabbit,

It kind of looks unnecessary to do so since you already have the outer reference, the BRabbit instance. It looks like a self-reference problem or something of that nature. Also, I think this way it will allocate unnecessary space in memory.

Solution

All Inner classes should be moved outside the BRabbit class for better design.

@nidhaloff
Copy link
Owner

@wiseaidev Good idea. Unfortunately, I can't remember the reason for this design. It has been years since I worked on this. Would you be interested to contribute your ideas? I can add you as a direct contributor to this repo in order to give you more freedom.

@wiseaidev
Copy link
Collaborator Author

Yup!

@nidhaloff
Copy link
Owner

@wiseaidev Done!

@nidhaloff nidhaloff added enhancement New feature or request help wanted Extra attention is needed Hacktoberfest labels Oct 7, 2022
@wiseaidev wiseaidev self-assigned this Oct 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Hacktoberfest help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants