Skip to content

Commit 5814bac

Browse files
committed
change 单例 to 单件
1 parent 963debd commit 5814bac

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

02.5-Singleton.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Singleton 单例模式 <Alpha version>
1+
Singleton 单件模式 <Alpha version>
22
============================
33

44
This chapter is an anomaly. Every other chapter in this book shows
@@ -614,7 +614,7 @@ instances of `BulletManager` do you need?
614614
The answer here is *zero*, actually. Here's how we solve the "singleton" problem
615615
for our manager class:
616616

617-
答案是**,实际上,我们是这样解决我们管理类的"单例"问题的:
617+
答案是**,实际上,我们是这样解决我们管理类的"单件"问题的:
618618

619619

620620
```
@@ -641,7 +641,7 @@ There we go. No manager, no problem. Poorly designed singletons are often
641641
that behavior into the class it helps. After all, OOP is about letting objects
642642
take care of themselves.
643643

644-
就这样。没有管理器也没有问题。错误的设计单例通常会“帮助”你将功能添加到别的类中。如果可以,你只需将这些功能移动到它帮助的类中去就可以了。比较,面向对象就是让对象自己管理自己。
644+
就这样。没有管理器也没有问题。错误的设计单件通常会“帮助”你将功能添加到别的类中。如果可以,你只需将这些功能移动到它帮助的类中去就可以了。比较,面向对象就是让对象自己管理自己。
645645

646646
Outside of managers, though, there are other problems where we'd reach to
647647
Singleton for a solution. For each of those problems, there are some alternative
@@ -736,7 +736,7 @@ instantiation is only done at *runtime*. The Singleton pattern, in contrast,
736736
guarantees a single instance at compile time by the very nature of the class's
737737
structure.
738738

739-
这份实现的不足之处在它只在*运行期*检测来防止多个实例。单例模式,相反的,在编译期就通过类结构自然的保证了单个实例。
739+
这份实现的不足之处在它只在*运行期*检测来防止多个实例。单件模式,相反的,在编译期就通过类结构自然的保证了单个实例。
740740

741741
### To provide convenient access to an instance 提供一个便利的方法访问实例
742742

@@ -745,7 +745,7 @@ to get our hands on an object we need to use in a lot of different places. That
745745
ease comes at a cost, though -- it becomes equally easy to get our hands on the
746746
object in places where we *don't* want it being used.
747747

748-
便利的访问是我们使用单例额主要原因。它让我们在许多不同地方得到一个对象变得简单。这种便利也有代价,——它也是的我们在不想使用的地方也可以轻松的得到这个对象。
748+
便利的访问是我们使用单件额主要原因。它让我们在许多不同地方得到一个对象变得简单。这种便利也有代价,——它也是的我们在不想使用的地方也可以轻松的得到这个对象。
749749

750750
The general rule is that we want variables to be as narrowly scoped as possible
751751
while still getting the job done. The smaller the scope an object has, the fewer

0 commit comments

Comments
 (0)