- From: Robin Raymond <robin@hookflash.com>
- Date: Fri, 11 Apr 2014 14:13:12 -0400
- To: public-ortc@w3.org
- CC: public-ortc-contrib@w3.org
Currently, we've been using constructors to create objects with new Object pattern. I think we should move to a Factory Method Pattern for object construction. The pros: - works better for abstract interfaces so what internal object (even derived) can be created independent of object - allows more meaningful method signatures, e.g. createWithFooBar(...) or listen(...) - allows easier extensions. There's only so many ways to rearrange parameter orders to get unique method signatures, whereas we can always extend factory method names - allows easier creation of singleton / static helper objects used with other patterns - better encapsulation The cons: - "new" knowingly creates a new instance - consistency with other APIs? - more methods exposed in the interface (but not really since constructor has as well, it's just more implicit) Thoughts? -Robin
Received on Friday, 11 April 2014 18:13:42 UTC