-
Notifications
You must be signed in to change notification settings - Fork 15
Factory versus new
construction
#6
Comments
The one substantive argument for factories over |
I think that in addition to the point about pooling you bring up, there are also some other benefits to using a factory(e.g. being able to bind whatever context you want to a factory function in case you don't want 'this' to reference the new object, and the fact that with |
👍 |
@maier49 I think you summed it up...
I will keep this open for a little bit longer, just in case anyone else wants their 2¢. |
Discussion seems complete, so closing. |
As we were doing the proposal, it was discussed about doing a full factory implementation or following the constructor function pattern and utilise
new
for instantiation. I got involved in a side conversation at the request of one of the community and @ericelliott took some time to provide some feedback on whynew
is limiting and a challenge.I think it is worth considering adopting a factory function as it does give a level of flexibility to the consumer and actually aligns to some of the patterns we were trying to promote anyways.
The text was updated successfully, but these errors were encountered: