Factory
Provides an interface to create objects. Rather than creating new objects using new keyword, we ask the factory to create and return them for us.Factory in JavaScript : method1 (addyosmani) and method2 (carldanley)
Builder
http://www.oodesign.com/builder-pattern.htmlLazy initialization
Creation is deferred until it is first used. Useful for complex objects.C# : http://msdn.microsoft.com/en-us/library/dd997286%28v=vs.110%29.aspx
Object pool
Useful when cost of initializing a class instance is very high. Therefore when requester requires an instance, he can get one of already created instance.Prototype
Singleton
http://stackoverflow.com/questions/327955/does-functional-programming-replace-gof-design-patterns?rq=1
0 comments:
Post a Comment