Singletons. Josh Mason. June 1, 2009. Adoption and Orphan. Adoption. Taken ownership of object. Orphan. Relinquish . object. What’s the purpose?. Deciding where to put adoption/orphan functions. Component? Leaf? Composite?. ID: 722357
DownloadNote - The PPT/PDF document "Orphans, Adoption, and Surrogates" is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.
Orphans, Adoption, and SurrogatesSingletons
June 1, 2009Slide2
Adoption and OrphanAdoption
Taken ownership of object
What’s the purpose?
Deciding where to put adoption/orphan functions
Component? Leaf? Composite?
Case by case basis.Slide3
Restricts instantiation of a class to a single instanceSlide4
UsesTo implement other patterns
Singleton - BenefitsSingle Instance
Easily extends to allow for a variable number of instances.
Can assist in making thread safety simpler.Slide6
Singleton - Examples
Stinkleton* - Issues
Why not just use global variable?
Today's Top Docs