- From: Dave Longley <notifications@github.com>
- Date: Thu, 05 May 2016 09:16:12 -0700
- To: w3c/browser-payment-api <browser-payment-api@noreply.github.com>
- Cc:
Received on Thursday, 5 May 2016 16:16:40 UTC
@adrianba, > In my mind, factory methods are useful in two key scenarios. 1) When creating an instance of the object binds that object to some internal state that isn't exposed to calling code. The factory method implicitly retrieves that state and binds it to the instance; or 2) when the creation of the object causes some significant processing to occur. The factory method makes it clear in that case that this isn't simple object creation. 3) When you want to override the factory method to return back a subclass of the original class that extends the original behavior in some way. In this case, no code that uses the factory needs to change, only the factory method gets updated. I also like the idea of keeping new classes out of the global namespace (but this is not specific to factory methods). --- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/browser-payment-api/issues/16#issuecomment-217198898
Received on Thursday, 5 May 2016 16:16:40 UTC