今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Singleton pattern overview
- [Instructor] Now let's take a look at the Singleton design pattern. There are some scenarios where you want to be able to ensure that there's only one instance of a particular class in your program. The purpose of the Singleton pattern is to restrict the instantiation of a class to a single instance and provide global access to that instance. The Singleton pattern also has other benefits. For example, it allows us to provide what's called lazy initialization of the class. In other words, the class isn't instantiated until it's actually needed. So what are some useful examples where a Singleton object might help? Well, as I mentioned earlier, the Singleton comes in handy when you want to make sure that there's only one instance of a particular class in your application. And some common scenarios where a single object are useful, include things like logging, or application configuration, or telemetry and analytics…
内容
-
-
-
-
(已锁定)
Builder pattern overview1 分钟 52 秒
-
(已锁定)
Builder pattern example9 分钟 58 秒
-
(已锁定)
Factory pattern overview1 分钟 40 秒
-
(已锁定)
Factory pattern example6 分钟 12 秒
-
(已锁定)
Singleton pattern overview2 分钟 10 秒
-
(已锁定)
Basic Singleton pattern example3 分钟 17 秒
-
(已锁定)
Making Singleton concurrent-safe3 分钟 44 秒
-
(已锁定)
-
-
-