Skip to content

Conversation

gyermolenko
Copy link
Contributor

@gyermolenko gyermolenko commented Apr 7, 2019

I would agree with the creator of #177
As I understand it - Factory method pattern is about class methods.
Such methods should be implemented or overridden by child classes (in languages where there is no other choice and where classes and functions are not first-class citizens)

refs:
https://python-patterns.guide/gang-of-four/factory-method/
https://en.wikipedia.org/wiki/Factory_method_pattern

I would also list Factory method along with Singleton in anti-patterns section (things to avoid).

Changes from this PR:

  • fix: this script is now python2 compatible (it wasn't)
  • rename factory_method.py to factory.py
  • update to use doctests
  • rename some variables to be more readable

P.S.: congratulations on 20k stars! 🌟

@codecov-io
Copy link

codecov-io commented Apr 7, 2019

Codecov Report

Merging #294 into master will decrease coverage by 0.87%.
The diff coverage is 0%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #294      +/-   ##
==========================================
- Coverage   45.51%   44.64%   -0.88%     
==========================================
  Files          41       41              
  Lines        1584     1586       +2     
==========================================
- Hits          721      708      -13     
- Misses        863      878      +15
Impacted Files Coverage Δ
patterns/creational/factory.py 0% <0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 27395d8...a2b90f9. Read the comment docs.

@faif faif merged commit e775d4a into faif:master Apr 7, 2019
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

Successfully merging this pull request may close these issues.

3 participants