Using Observer design pattern to notify multiple class on change

Hi,


Many times when programming we come across situation where by change in one change needs to be updated in multiple object. For example if a parameter is used to make multiple calculation in different objects then on change of that parameter all the objects need to be notified of the change.  Or for example when the windows (operating system) or Dot Net framework shut downs or closes then it notifies all the application running on it to close so that it can make a clean close.

 

For this kind of situation the observer pattern was designed. In observer pattern there is a subject (also called observer) which maintains the list of all the dependent objects. In case

Continued...

Using Lazy Loading Design pattern to load data when required

Hi,

Some time when you are working with large objects where some of the data (properties in the object) is not required frequently, the use of Lazy loading is the best.

 Let’s say you have an Object which contains many properties along with a property for exposing long XML string. The long XML string is only required to be shown only a few times when you are also showing the details of the object. At this point when we are loading a list of this object to display (where by XML string will not be displayed) its not a good practice to also load the XML string in the object. Since this would take lots of extra Network bandwidth and memory space.

In these kinds of circumstances we can use the Lazy Loading Object relational pattern. In Lazy loading pattern the

Continued...

Creational design Pattern – Implementing Singleton using Dot Net

Hi,

Singleton in one of the most important of the creational design pattern. Lets start with what is a creational design pattern. Creational design pattern are design pattern which are related with the creating of objects. They define the design for the creation of an object for various usage.

[Note: you can check this previous post of mine on why to use design patterns.
http:////www.vikramlakhotia.com//A_word_about_Design_Pattern.aspx ]

The main thing about the singleton design is that a class has full control over its instance creation. The class itself creates its instance and no outside object can create an instance of the class.

Often while developing an application we come across situation where the instance of a class is needed only once (or a few number of time) throughout the application. The main point is that there

Continued...

Design pattern – What can they mean?

Hi

A few days back when I wrote the blog on design pattern a small but interesting question came to my mind. How and why did the design pattern started. So I started hunting in the google for my curiosity and found some interesting stuff. So I thought I would share them with you.

A repeatable solution for commonly occurring problem in the software programming is called design pattern. Design patterns are not finished designs for the problems, but are template and description on how the solve the problem, which might occur in different situations.  Design patterns commonly show relations and interaction of different class or objects or types. They do not specify the final class or types that will be used, but give an abstract view of the solution.

As design patterns provide tested and proven development paradigms, they can speed up the process of development. For a design pattern to be effective, it

Continued...

A word about the observer design pattern

Hi,

A few days back on of my senior talked about different pattern and how useful they can be in the process of development. We were talking about the observer pattern. So I thought I will write a bit about the observer design pattern.

Based on the principal of implicit invocation, Observer design pattern (also known as publish Subscribe) is used in programming to observer the state of and object in a program. In many programming language the issue of this pattern are handled in native event handling syntax.

The bottom line of the pattern is that one or more listeners or observer (objects) register themselves to observer an event, which is raised by the subject. The object that raises the event maintains a collection of all the observer or listeners. We can also say that the pattern defines a one to many dependencies between objects so that one the state of a object is changed all the dependent are notified and

Continued...
 
Copyright © 2006 - 2012 Vikram Lakhotia