The article originally claimed the pattern "...was first published in the Pattern Languages of Program Design book series.[1][year needed]". The year associated
| This article is rated Start-class on Wikipedia's content assessment scale. It is of interest to the following WikiProjects: | ||||||||||||||
| ||||||||||||||
The article originally claimed the pattern "...was first published in the Pattern Languages of Program Design book series.[1][year needed]". The year associated to the referenced publication is 1998. There is an earlier paper from Nov. 1997 "[The Null Object Pattern]" by Woolf. An even earlier publication is "[Nil and None considered Null and Void]" published in 1996 (WOON'96, St. Petersburg, Russia). The latter publication uses "Void Value" as the pattern name, but the pattern described is equivalent to "Null Object". ClassA42 (talk) 02:18, 21 April 2022 (UTC)
This article is - like others have commented - not of high quality. The pattern has loads of better descriptions online. Howerver, the advantage statement is confusing and does not - IMO - speak of the key purpose (see the references from the article). I left it there, but I added a key purpose statement. Chipbite-mawi (talk) 09:00, 13 September 2023 (UTC)
Kasterma (talk) 17:48, 2 October 2014 (UTC)
This article should mention the Qt framework. AFAIK, It is the only widely-used C++ library that implements null objects consequently. Ever wondered why the Qt framework uses neither exceptions nor C-style error codes? It is solely because of proper use of Null objects. Vog (talk) 16:23, 4 June 2014 (UTC)
This article is completely wrong. Null pointers and Null variables have little or nothing to do with the Null Object design pattern. http://www.cs.oberlin.edu/~jwalker/nullObjPattern/
I think a better example is that of a logger. Often you see code if logger != null then logger.log ( message ). With the null object pattern you then have a NullLogger which just ignores the input and you get logger.log ( message ). Also, often these null subclasses are singletons (since ignoring everything is often stateless). CaptainPinko (talk) 19:29, 10 May 2010 (UTC)
It looks like the article has been updated, as the content is correct now. The examples are still bad, though. The C example misses the concept entirely (the pattern requires the concept of objects, so I don't know that this pattern can be implemented in C) and while an empty C# array may exhibit similar behavior to a null object, it certainly isn't a good example of the practical use of the pattern. Bgano (talk) 22:35, 18 April 2011 (UTC)
I have not read "Fowler, Martin (1999). Refactoring pp. 261", but the "Critisism" section is very weak and lacking of any actual criticisms. There is no value in saying "this may cause bugs, as references this source". 202.65.14.164 (talk) 22:05, 12 March 2013 (UTC)
Can someone direct me to programming languages where exactly this or a very similar implementation is possible?
Thanks. — Preceding unsigned comment added by Brusinsky (talk • contribs) 12:55, 14 May 2016 (UTC)
function tree_size(node) {
return 1 + tree_size(node.left) + tree_size(node.right)
}
function tree_size(null_node) {
return 0
}
This separates normal logic from special case handling and makes the code easier to understand. 76.33.14.118 (talk) 00:08, 26 October 2024 (UTC)
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.