Talk:Private class data pattern
| WikiProject Computer science | (Rated Stub-class) | |||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
||||||||||||||||||||||
Contents |
[edit] Possible copyright violation
HTML embended in wikicode of this article indicates that article text has been looted from some web page. Googling resulted in just one hit: http://www.novell.com/coolsolutions/feature/11292.html
The strange thing is that the article at wikipedia is older (11 December 2004) then Novel's (18 January 2005). --Alvin-cs | Talk 9 July 2005 13:52 (UTC)
[edit] Copyedit progress
I replaced the (potentially) copyrighted sample code with a better example and organized the article according to the standard Gang of Four (software) documentation structure. There are some missing sections, so I won't remove the copyedit tag yet, but it looks close. The Rod 21:00, 15 November 2005 (UTC)
(Forgot to sign above. Signed now.) I removed the copyedit tag since this article still has a stub tag. The Rod 21:00, 15 November 2005 (UTC)
[edit] C# And readonly
"Although marking attributes of classes as const (or final or ReadOnly in other programming languages) restricts their manipulation, the attributes above are set in the constructor and hence cannot be marked as such."
AFAIK The above is untrue for C# (maybe all .NET?) as the readonly field modifier additionally to initialization allows assignment in constructor bodies and forbids any other assignment. Hence, using the pattern in C# is unnecessary.
- NB the readonly keyword prevents assignment, but does not prevent modification using the variable's methods (unlike C++'s const). 202.89.151.20 08:48, 11 September 2007 (UTC)
- This pattern doesn't solve that issue. The references to the objects in the 'private data object' are still accessible to the methods of the Circle class. They are also accessible to the method that created the instance of Circle. This pattern is rather pointless. Dubwai 13:39, 22 October 2007 (UTC)
The same applies to Java as well. Any member fields marked final can (and indeed must) be initialised either when they are declared or in the constructor. They cannot be set anywhere else. Sampath s (talk) 13:43, 22 September 2008 (UTC)
[edit] Is this a notable "design pattern"? See Opaque pointer
I have added the notability tag because there do not appear to be any references other than this article and its clones. There is an opaque pointer article that covers the same principle, and it's also just an elementary example of object composition. Beyond the question of notability, I am not sure whether to suggest the article be deleted or merged with one of those other two. Maghnus (talk) 08:49, 10 October 2009 (UTC)
[edit] Questionable purpose
Either the subject of the article is not "known as pimpl", or the purpose that is written in the article is incorrect. Read/write access, or other data integrity requirements, is not a purpose of pimpl.
This pattern is often used in C++ to reduce amount of code needed to include for a single compilation unit, which leads to faster compilation (and especially recompilation), and simpler dependency of compilation units.
It also might be helpful to maintain a binary compatibility.
Finally, some people probably use pimpls to keep their know-hows in closed-source libraries.