Talk:Memento pattern

From Wikipedia, the free encyclopedia
Jump to: navigation, search
WikiProject Computer science (Rated Start-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Computer science, a collaborative effort to improve the coverage of Computer science related articles on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
 
WikiProject Java (Rated Start-class, Low-importance)
WikiProject icon This article is within the scope of WikiProject Java, a collaborative effort to improve the coverage of Java on Wikipedia. If you would like to participate, please visit the project page, where you can join the discussion and see a list of open tasks.
Start-Class article Start  This article has been rated as Start-Class on the project's quality scale.
 Low  This article has been rated as Low-importance on the project's importance scale.
 

comment[edit]


Also, did someone seriously state on here that C# and Java are "identical languages"? I'm not starting a flame war, but I know both well and they are so fundamentally different that to even suggest that is absurd. Learn more about the history and modifications of the language over the years it has been around and the differences become extreme from that of Java (btw, C# is a mix of Java and C++, however no one compares C# to C++) or just visit this site http://rapidapplicationdevelopment.blogspot.com/2013/10/c-isnt-java-learning-via-katas-part-1.html. Having the Java example stay and the C# example go is baseless (i.e. there is no evidence of superiority of either language neither in usage statistics nor in functionality, they are two completely different languages if you actually know them, and the only reason for C# example to go seems to be because the Java code was written first before the C# code was - which is not a strong reason). — Preceding unsigned comment added by 69.2.35.214 (talk) 17:53, 1 December 2014 (UTC)

Why not just fix the C# example with someone who actually knows C#. That seems like a better solution then just getting rid of it. I helped fix it, but in general it is not functionally equivalent to the Java code. — Preceding unsigned comment added by 69.2.35.214 (talk) 17:43, 1 December 2014 (UTC)

The Java example is correct, the C# example is flawed. The C# example got to go. My personal opinion is that a stack is often a better solution than memento.


Man, the CareTaker can save more mementos, not only of 1 object, and can save a lot of them. —Preceding unsigned comment added by 24.232.232.20 (talk) 15:16, 15 August 2008 (UTC)


I would like to request more information on the role of the CareTaker. From the explanation and the samples, it is not clear as to what the purpose of the CareTaker is. Specifically, why would you store the Memento in the CareTaker and not in the code that contains the instance of the Originator. The CareTaker appears to serve no purpose other than to complicate the design. 64.201.213.84 (talk) 01:50, 21 March 2008 (UTC)


I would use Vector instead of ArrayList in CareTaker, because ArrayList does not take care of sorting. 193.159.228.66 15:06, 11 January 2007 (UTC)

"The caretaker first asks the originator for a memento object."

This is not in accordance with the given code. There the caretaker is passive. It's the controller (main()) that asks the originator for a memento object and hands it over to the caretaker which only acts as a storage. Md2perpe 20:03, 20 September 2006 (UTC)

Yes. The code is ridiculous. The "As3Memento" should just be CareTaker. It would be simpler, and would fit the description of the pattern. 82.230.65.68 (talk) 20:33, 29 January 2009 (UTC)


I think it is ridiculous to post the same (long) code example in two, basically identical languages as C# and Java. One of them should be removed. I don't give preference to any of them, so I'm removing the longer one. --Zigmar 14:33, 31 October 2006 (UTC)


Now the examples are in ActionScript 3, Java, and Ruby. At least one of these should be removed; ideally, only one would be kept, and in the most commonly used language of the three. Dhasenan (talk) 19:18, 21 May 2009 (UTC)


Is every trivial thing now a design pattern? Encapsulating the state of an object into a different object is pretty redundant because an object is defined as its own state plus methods (which are the class’ properties).—☠☢☣[d] 00:02, 6 August 2013 (UTC)

Pseudorandom[edit]

Classic examples of the memento pattern include the seed of a pseudorandom number generator [...] Someone please clarify how the memento pattern is used in this case. Thanks, --Abdull (talk) 21:34, 27 October 2008 (UTC)

I was wondering the same thing. I couldn't find an explanation on GBooks, and a web search turns up websites that cite the Wikipedia for this example. QVVERTYVS (hm?) 08:08, 20 April 2015 (UTC)

question on style[edit]

The memento is marked as public static nested inner class. Its enclosing class is package scoped. Do you think that should be improved? Kind regards.