Retiring the Singleton Pattern## Retiring the Singleton Pattern Engineering ## Concrete suggestions for what to use instead CppCon 2020 September 18, 2020 Peter Muldoon Senior Software Developer TechAtBloomberg.com © 2020 Bloomberg com/questions/137975/what-is-so-bad-about-singletons ## Talk outline 1. Examine the Singleton Pattern 2. Refactoring out the Singleton in an example function • Ensuring the callers of that function do not need with groups of Singleton dependencies 8. Stateful groupings of dependencies 9. Review of covered topics & Questions ## Classic Singleton class Singleton { public: static Singleton* instance()0 码力 | 70 页 | 1.59 MB | 1 年前3
Spring Framework 1.2.1 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 39 3.20. Glue code and the evil singleton ..... 40 3.20.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 75 6.2.1. "Singleton" aspects ..... 75 6.2.2. Non-Singleton aspects ..... 76 6.2.3. Gotchas ..... 76 6.3. Using AspectJ pointcuts0 码力 | 244 页 | 1.30 MB | 2 年前3
Spring Framework 1.1.2 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 36 3.18. Glue code and the evil singleton ..... 37 3.18.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 71 6.2.1. "Singleton" aspects ..... 71 6.2.2. Non-Singleton aspects ..... 72 6.2.3. Gotchas ..... 72 6.3. Using AspectJ pointcuts0 码力 | 199 页 | 1.14 MB | 2 年前3
The Book Of Ruby## SINGLETON METHODS class_classes.rb A singleton method is a method which belongs to a single object rather than to an entire class. Many of the methods in the Ruby class library are singleton methods these are singleton methods of the Class object. Indeed, if you evaluate the following, you will be shown an array of method names which match the names of IO class methods: p( IO.singleton_methods ) class: ### def MyClass.classMethod It turns out that you can use a similar syntax when creating singleton classes for specific objects. This time you preface the method name with the name of the object:0 码力 | 425 页 | 2.93 MB | 6 月前3
Spring Framework 1.1.5 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 38 3.19. Glue code and the evil singleton ..... 38 3.19.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 72 6.2.1. "Singleton" aspects ..... 72 6.2.2. Non-Singleton aspects ..... 73 6.2.3. Gotchas ..... 73 6.3. Using AspectJ pointcuts0 码力 | 223 页 | 1.22 MB | 2 年前3
Spring Framework 1.1.1 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 34 3.16. Glue code and the evil singleton ..... 34 3.16.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 67 6.2.1. "Singleton" aspects ..... 67 6.2.2. Non-Singleton aspects ..... 68 6.2.3. Gotchas ..... 68 6.3. Using AspectJ pointcuts0 码力 | 194 页 | 1.12 MB | 2 年前3
Spring Framework 1.2.0 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 38 3.20. Glue code and the evil singleton ..... 39 3.20.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 74 6.2.1. "Singleton" aspects ..... 74 6.2.2. Non-Singleton aspects ..... 75 6.2.3. Gotchas ..... 75 6.3. Using AspectJ pointcuts0 码力 | 243 页 | 1.29 MB | 2 年前3
Back to Basics: Design Patternsare and why you should study them • Pragmatically How to implement/use a Creational Pattern ☐ Singleton in C++ How to implement/use a Structural Pattern ☐ Adapter in C++ How to use a Behavior Pattern are and why you should study them • Pragmatically How to implement/use a Creational Pattern ☐ Singleton in C++ How to implement/use a Structural Pattern ☐ Adapter in C++ ☐ How to use a Behavior Pattern complex objects • Factory method creates objects with • Prototype creates objects by cloning - Singleton restricts object creation for ## Structural | edit | These concern class and object compo • Adapter0 码力 | 96 页 | 2.10 MB | 1 年前3
Spring Framework 1.1.3 Reference3. The bean class ..... 3.2.4. The bean identifiers (id and name) ..... 3.2.5. To singleton or not to singleton ..... 3.3. Properties, collaborators, autowiring and dependency checking ..... 3.3 Creating an ApplicationContext from a web application ..... 37 3.19. Glue code and the evil singleton ..... 38 3.19.1. Using SingletonBeanFactoryLocator and ContextSingletonBeanFactoryLocator ... 6.2. Configuring AspectJ aspects using Spring IoC ..... 72 6.2.1. "Singleton" aspects ..... 72 6.2.2. Non-Singleton aspects ..... 73 6.2.3. Gotchas ..... 73 6.3. Using AspectJ pointcuts0 码力 | 203 页 | 1.15 MB | 2 年前3
Spring Framwork Core Technologies v5.3.36 SNAPSHOTReplacement ..... 49 1.5. Bean Scopes ..... 51 1.5.1. The Singleton Scope ..... 52 1.5.2. The Prototype Scope ..... 53 1.5.3. Singleton Beans with Prototype-bean Dependencies ..... 54 1.5.4. Request ents/7/3/2/3/73231a341eebfdf97c81ce62f5f4f7ab/p22_1.jpg) Bean metadata and manually supplied singleton instances need to be registered as early as possible, in order for the container to properly reason during autowiring and other introspection steps. While overriding existing metadata and existing singleton instances is supported to some degree, the registration of new beans at runtime (concurrently with0 码力 | 485 页 | 6.31 MB | 2 年前3
共 891 条
- 1
- 2
- 3
- 4
- 5
- 6
- 90
相关搜索词
Singleton PatternDependency InjectionSource CompatibilityStateful GroupingsInterdependent SingletonsBeanFactorysingletonprototypelookup-methodSpring FrameworkAOPHibernateRuby编程异常处理模块继承类库DispatcherServletJmsTemplateModelAndView设计模式创建型结构型行为型Gang of FourSpring框架模块化设计依赖注入事务管理Resource InterfaceNull-safety AnnotationsComponent ScanningJSR-330 Annotations













