task: Explanations and grammar fixes for all the GoF patterns (#1791)
* Grammatical fixes to command pattern * Update bridge pattern readme * Fixes to builder pattern grammar * Update chain of responsibility * Improvements to the composite example * Fixes to headings * Minor updates to decorator pattern * Update facade * Update factory example * Update factory method * Update flyweight * Interpreter explanation * Update iterator readme * Add explanation for mediator pattern * Grammatical fixes to memento * Grammar fixes for observer * Update explanation for the prototype pattern * Proxy pattern grammar fixes * Update singleton * Grammar fixes to state pattern * Grammar fixes for strategy * Grammar fixes, template method * Grammar fixes for visitor * Fix typo
This commit is contained in:
@ -30,20 +30,20 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* classloader instance and provides global access to it.</p>
|
||||
*
|
||||
* <p>One of the risks of this pattern is that bugs resulting from setting a singleton up in a
|
||||
* distributed environment can be tricky to debug, since it will work fine if you debug with a
|
||||
* distributed environment can be tricky to debug since it will work fine if you debug with a
|
||||
* single classloader. Additionally, these problems can crop up a while after the implementation of
|
||||
* a singleton, since they may start out synchronous and only become async with time, so it may
|
||||
* not be clear why you are seeing certain changes in behaviour.</p>
|
||||
* a singleton, since they may start synchronous and only become async with time, so it may
|
||||
* not be clear why you are seeing certain changes in behavior.</p>
|
||||
*
|
||||
* <p>There are many ways to implement the Singleton. The first one is the eagerly initialized
|
||||
* instance in {@link IvoryTower}. Eager initialization implies that the implementation is thread
|
||||
* safe. If you can afford giving up control of the instantiation moment, then this implementation
|
||||
* safe. If you can afford to give up control of the instantiation moment, then this implementation
|
||||
* will suit you fine.</p>
|
||||
*
|
||||
* <p>The other option to implement eagerly initialized Singleton is enum based Singleton. The
|
||||
* example is found in {@link EnumIvoryTower}. At first glance the code looks short and simple.
|
||||
* <p>The other option to implement eagerly initialized Singleton is enum-based Singleton. The
|
||||
* example is found in {@link EnumIvoryTower}. At first glance, the code looks short and simple.
|
||||
* However, you should be aware of the downsides including committing to implementation strategy,
|
||||
* extending the enum class, serializability and restrictions to coding. These are extensively
|
||||
* extending the enum class, serializability, and restrictions to coding. These are extensively
|
||||
* discussed in Stack Overflow: http://programmers.stackexchange.com/questions/179386/what-are-the-downsides-of-implementing
|
||||
* -a-singleton-with-javas-enum</p>
|
||||
*
|
||||
@ -56,7 +56,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
* ThreadSafeLazyLoadedIvoryTower} since it doesn't synchronize the whole access method but only the
|
||||
* method internals on specific conditions.</p>
|
||||
*
|
||||
* <p>Yet another way to implement thread safe lazily initialized Singleton can be found in
|
||||
* <p>Yet another way to implement thread-safe lazily initialized Singleton can be found in
|
||||
* {@link InitializingOnDemandHolderIdiom}. However, this implementation requires at least Java 8
|
||||
* API level to work.</p>
|
||||
*/
|
||||
|
Reference in New Issue
Block a user