Gizmox - Guy Peled's Blog

Guy Peled's thoughts on development, and what ever...

  Home  |   Contact  |   Syndication    |   Login
  43 Posts | 1 Stories | 9 Comments | 5 Trackbacks

News

This is a testing of mashup....

Article Categories

Archives

Post Categories

Blogs I Read

Favorites

Resources

Visual WebGUI Related

I am currently working on a MMC like application (over WebGui which is kind of WinForms for web) that is going to be a DNN admin. I am using the observer design pattern through an object wrapper called ItemData which is pretty much a wrapper objects that has events on changes made to the wrapped object.

I have also created a ItemsData class that is a wrapper for a collection of ItemData that has also events on changes made to the wrapped collection. This is way when you have a form that changes a property that is also used to a TreeNode text, when you change the property through the wrapper in one place you get an event in the TreeNode that is used to change the text of the TreeNode.

This design pattern dramatically reduces the amount of spaghetti code that is usually used in this kind of applications, cause you have objects that do what they need to do and the events are used to other objects to do what they have to do without direct interaction between them.

I have taken the design pattern a bit further by providing each data object a referrers counter and that way I can release unused data. Lets say I have a tree like object module and I am using and as I navigate I have a treeview that has sub folders generated from a collection and also a tab of items that is generated from the same collection. When I destroy the tab I want to be able to detach from the collection I have been observing and if it is not referenced I wan the collection to be disposed. That way if I have a treenode that is not expanded and the tab was the only UI element that was observing the collection I know I can destroy that collection.

Any way I am a true believer of the observer pattern... great apps needs to be observed....

  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Monday, April 10, 2006 11:08 AM