﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Dave commented on Can you justify your actions with regards to this pattern?</title><description>So, patterns add some level of complexity. So What? Separating code from presentation often also adds more complexity. Does that mean we don't use abstraction layers? Ofcourse not. The trick here is to find a good balance of using patterns.  
  
  
However I go totally ballistic when I see a developer try to write it's own implementation of the observer pattern. That one comes with the .net framework for free and it's called events (subject is the holder of the event, observer is the listener).  
  
  
You know what really adds unneeded complexity? Features in a program that no one will ever use of trying to keep everything generic of 'universal'. If you ask why, you always get the answer that it would make later modifications easier. My response is than often: "Are you psychic? You know already what clients what in future?" 
  
  
You ask: can you justify the used pattern, I always ask a developer if he can justify (almost defend) the way he/she wrote the code. And we have public executions (code reviews) ;-)
  
  
My most used pattern? I keep everything SOLID.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment11</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment11</guid><pubDate>Fri, 22 May 2009 07:32:01 GMT</pubDate></item><item><title>Min H commented on Can you justify your actions with regards to this pattern?</title><description>I have to agree with what Matt T wrote. There are few examples of good object oriented design that are distilled for learning. The principles are great, but I tend to learn by example. Design patterns helped my understanding of applying OOP principles by giving me examples of where and how to use those principles effectively.
  
  
I honestly think the main thing people forget is that design patterns are solutions to specific problems. A huge mistake would be trying to shoehorn a problem into a design pattern. I think that design patterns should emerge natrually from a codebase rather than being enforced upon them.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment10</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment10</guid><pubDate>Thu, 21 May 2009 23:45:04 GMT</pubDate></item><item><title>Steve commented on Can you justify your actions with regards to this pattern?</title><description>Your timing is impeccable.
  
  
After 3-4 days of muddling through my own 'highly engineered' solution to a problem that was actually just too complex - I realized I was really losing sight of the end goal of the problem I was solving.
  
  
'Too complex' to start I decided.
  
  
I scratched it, took my lessons learned and painfully started over.  
  
  
However, it's cleaner &amp; more to the point - easier to follow and understand.
  
  
I guess in my thinking - later if I need to refactor it to add a new layer, etc... then do it then, but for now - I made it work, it's clean and most importantly.... it's much SIMPLER.
  
  
So, KISS right?  :)
  
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment9</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment9</guid><pubDate>Thu, 21 May 2009 17:15:23 GMT</pubDate></item><item><title>Dmitry commented on Can you justify your actions with regards to this pattern?</title><description>Windows Forms data binding makes use of the IEditableObject interface which allows to save and restore object state. That's how it implements the Cancel/Undo button.
  
  
The easiest way in .NET to implement the Memento pattern is to serialize the object and deserialize it back when necessary. Things get more complex if the object is not serializable or has events that are used by non-serializable objects such as windows forms/web pages.
  
  
The point here is new platforms often have better ways to implement functionality that used to be implemented with more traditional design patterns. Another example of this is events/delegates vs. the Observer pattern.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment8</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment8</guid><pubDate>Thu, 21 May 2009 16:27:10 GMT</pubDate></item><item><title>Matt T commented on Can you justify your actions with regards to this pattern?</title><description>i think the biggest problem is that patterns go a step beyond the principles, most bad applications of patterns ive seen are where the developer doesnt understand the underlying principles e.g. strategy is all about programming to an interface bridge uses composition to detach the interface from the implementation. I think understanding the underlying principles of patterns is much more useful. Most patterns are based on leveraging the principles of encapsulation, inheritance, composition and programming to interface rather than implementation, i think maybe if the principles were hammered home first (why they are good, what they get you) and then patterns were discussed in terms of the principles would be a big step. As for memento, i dont remember using that pattern :)
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment7</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment7</guid><pubDate>Thu, 21 May 2009 14:08:07 GMT</pubDate></item><item><title>Justin Etheredge commented on Can you justify your actions with regards to this pattern?</title><description>The simplest use of Memento would be a transactional object. Essentially resetting the objects state is the memento pattern. It is a little bit more involved than that, I believe. It is a rarely used pattern in business apps, because usually when we need to reset the state of an object, we just throw it away and then retrieve a new copy from persistence.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment6</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment6</guid><pubDate>Thu, 21 May 2009 12:01:37 GMT</pubDate></item><item><title>Paco commented on Can you justify your actions with regards to this pattern?</title><description>With an undo button?
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment5</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment5</guid><pubDate>Thu, 21 May 2009 10:23:28 GMT</pubDate></item><item><title>Ryan Roberts commented on Can you justify your actions with regards to this pattern?</title><description>Sorry for the apostrophe abuse.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment4</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment4</guid><pubDate>Thu, 21 May 2009 10:17:22 GMT</pubDate></item><item><title>Ryan Roberts commented on Can you justify your actions with regards to this pattern?</title><description>Memento is usable when the persistent version of an object may not be valid when restored. Say an ecommerce basket or wishlist where the products may no longer be available to the customer. There's usually going simpler ways to implement that than using an actual memento however.
  
  
I believe Uri's are considered to be a form of the memento pattern too.
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment3</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment3</guid><pubDate>Thu, 21 May 2009 09:52:15 GMT</pubDate></item><item><title>configurator commented on Can you justify your actions with regards to this pattern?</title><description>Can you think of an example where you'd actually use the Memento pattern?
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment2</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment2</guid><pubDate>Thu, 21 May 2009 09:13:13 GMT</pubDate></item><item><title>Jacob Stanley commented on Can you justify your actions with regards to this pattern?</title><description>Can you think of an example of a situation where you've seen people use the Memento pattern, but something simpler could have been done instead?
</description><link>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment1</link><guid>http://ayende.com/4027/can-you-justify-your-actions-with-regards-to-this-pattern#comment1</guid><pubDate>Thu, 21 May 2009 07:06:46 GMT</pubDate></item></channel></rss>