You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: object-pool/README.md
+98Lines changed: 98 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,6 +15,104 @@ short periods of time it is advantageous to utilize the Object Pool pattern.
15
15
The Object Pool provides a cache for instantiated objects tracking which ones
16
16
are in use and which are available.
17
17
18
+
## Explanation
19
+
20
+
Real world example
21
+
22
+
> In our war game we need to use oliphaunts, massive and mythic beasts, but the problem is that they are extremely expensive to create. The solution is to create a pool of them, track which ones are in-use, and instead of disposing them re-use the instances.
23
+
24
+
In plain words
25
+
26
+
> Object Pool manages a set of instances instead of creating and destroying them on demand.
27
+
28
+
Wikipedia says
29
+
30
+
> The object pool pattern is a software creational design pattern that uses a set of initialized objects kept ready to use – a "pool" – rather than allocating and destroying them on demand.
31
+
32
+
**Programmatic Example**
33
+
34
+
Here's the basic Oliphaunt class. These are very expensive to create.
0 commit comments