This article is overrun with examples in 11 different languages; are they really all necessary? The concept is the important part, not the specific implementat
| This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||
This article is overrun with examples in 11 different languages; are they really all necessary? The concept is the important part, not the specific implementation. One well-explained example (pseudocode) is likely sufficient to get the idea across--67.132.11.102 (talk) 19:46, 11 July 2016 (UTC)
The Java code source snippet use double checked locking. While double checked locking may provide a (infinitesimal) performance gain, it is a controversial technique which tends to make the code less readable (Java concurrency in practice, p.213-214).
Much more importantly, the use of synchronization may lead to think that this class is designed to be thread safe: this is not the case.
Access to the HashMap.contains(), HashMap.get(), HashMap.keySet() methods AND iterating over HashMap.keySet() MUST be synchronized in a multi-threaded environment.
Thread safety is a important concern when using lazy initialization, additional precision is required in the article.
In addition, this snippet would be actually be more pertinent for a caching system, which is way overkill to explain how lazy initialization work. — Preceding unsigned comment added by 217.192.238.66 (talk) 12:15, 26 January 2012 (UTC)
The method getFruitByTypeNameHighConcurrentVersion() in the Java code snippet uses double checked locking and is definitely broken. It should be either removed or updated with a working version. — Preceding unsigned comment added by 217.5.150.53 (talk) 08:29, 20 June 2012 (UTC) Here is a reference as to why double-checked locking as implemented here is broken: http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
Isn't this just a special case of Lazy evaluation? Does it really need its own article? —Preceding unsigned comment added by 64.81.170.62 (talk) 08:46, 15 January 2008
Why the map? Isn't lazy initialization just this:
private Item _item;
protected Item item
{
get { return _item ?? (_item = new Item()); }
}
—Preceding unsigned comment added by Doekman (talk • contribs) 19:57, 19 February 2009
Quoting Talk:Lazy_evaluation#merge:
The articles lazy evaluation, lazy initialization, and lazy loading currently don't clearly draw the distinction between them. Is there a clear distinction between them? If so, the articles should be more wp:obvious as to what that distinction is. If not, then we should merge the articles. --68.0.124.33 (talk) 03:33, 4 March 2009 (UTC)
Mark Hurd (talk) 07:09, 4 March 2009 (UTC)
They are the same in the examples as I see. Maybe add a clarification on what aspect each of the subject is dealing with.
Informasi ini disarikan dari Wikipedia dan disajikan kembali untuk tujuan edukasi. Konten tersedia di bawah lisensi CC BY-SA 3.0. Kami tidak bertanggung jawab atas ketidakakuratan data yang bersumber dari kontribusi publik tersebut.