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

Rework factory #681

Merged
merged 10 commits into from
Oct 22, 2021
Merged

Rework factory #681

merged 10 commits into from
Oct 22, 2021

Conversation

bouthilx
Copy link
Member

@bouthilx bouthilx commented Oct 6, 2021

Why:

The meta-class factory was confusing and sometimes hard to debug. The
factory should be a separate object that the constructors of the
classes. When calling a class, we expect to receive an instance of the
class, not of a child class. The factory also makes it simpler to add
new features such as fetching class objects based on strings on grouping
singleton instances per factory.

How:

Each class requiring the factory will be using Factory(base_class)
as a factory to instantiate child classes. The explicit method
factory.create() will be used instead of the confusing
MyFactory().

bouthilx and others added 8 commits October 6, 2021 14:31
Why:

The meta-class factory was confusing and sometimes hard to debug. The
factory should be a separate object that the constructors of the
classes. When calling a class, we expect to receive an instance of the
class, not of a child class. The factory also makes it simpler to add
new features such as fetching class objects based on strings on grouping
singleton instances per factory.

How:

Each class requiring the factory will be using ``Factory(base_class)``
as a factory to instantiate child classes. The explicit method
``factory.create()`` will be used instead of the confusing
`MyFactory()`.

Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
Co-authored-by: François Corneau-Tremblay <corneau90@gmail.com>
@bouthilx bouthilx added the enhancement Improves a feature or non-functional aspects (e.g., optimization, prettify, technical debt) label Oct 6, 2021
@bouthilx bouthilx added this to the v0.2 milestone Oct 6, 2021
@bouthilx bouthilx requested a review from Delaunay October 6, 2021 18:37
@bouthilx bouthilx merged commit bb80d53 into Epistimio:develop Oct 22, 2021
@bouthilx bouthilx deleted the feature/rework_factory branch October 22, 2021 17:58
@bouthilx bouthilx mentioned this pull request Nov 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improves a feature or non-functional aspects (e.g., optimization, prettify, technical debt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants