Go4Expert

Go4Expert (http://www.go4expert.com/)
-   Engineering Concepts (http://www.go4expert.com/articles/engineering-concepts-tutorials/)
-   -   Design Pattern in Simple Examples (http://www.go4expert.com/articles/design-pattern-simple-examples-t5127/)

sanc.pec 2Jan2009 21:24

Re: Design pattern in simple examples
 
Hi shabir,
I cannot change any implementations in the existing classes [as i already said they are in LIVE !!].
The scenario for me is like this..

OBJECT1
ATTR1
ATTR2
LIST<OBJECT2> [it may also have list of objects like this]

OBJECT2
ATTR3
ATTR4

I need a generic class called
OBJECT3
Where it should have only attributes of OBJECT1 , when i initialise OBJECT3 with some requirments. I can just go with Fatory creation pattern, but the problem is how to create this object automatically and how to make my code to access only ATTR1 & ATTR2 & List<OBJECT2> when i need my OBJECT3 to act as OBJECT1.

Am i clear ? :baby:

shabbir 4Jan2009 03:29

Re: Design pattern in simple examples
 
As I can think you cannot apply it in the mid of something but yes you should not touch the existing code and so best form can be to use some creational pattern to create the needed object and give the object to the accessible methods.

shae marks 24May2009 21:25

Re: Design pattern in simple examples
 
An element of a page, for instance a title, is shown as it would normally appear viewing the page without admin rights. However, once the logged in user has his mouse over the element, its background color is highlighted and a tooltip is shown prompting the user to click the element to edit it. Once the user clicks the element, it is transformed into an input field (text, dropdown, etc.) as well as a save button and a cancel button. Often, the input field matches the styling of the original element. So that if the original element was a header written in size 20pt, the size of the font in the input field would also be 20pt. This styling is made to ensure that the user can connect the original element with the new replaced editable element.
The user can then edit the value of the input field (which is the same as the original elements value) and click save or cancel. If ‘save’ is clicked, the value is saved through and AJAX call to the underlying database, and the view of the element is changed back to the original (for instance the header without the edit input field), but now with the new value. If cancel is clicked, the view element is changed back to the original without any changes that might have been written in the edit input field.
This pattern is often combined with an the AJAX technique, which is an asynchronous call to the server through javascript, that does not require a refresh of the page. There are many javascript libraries out there, that delivers ready-to-use inplace editors.
Rationale

An in-place editor provides an easy way to let the user edit parts of a page without having to be redirected to an edit page. Instead, the user can just click around on a page an edit the elements he or she wishes to change – without reloading the page.
The pattern is often associated with web 2.0 websites.

shobhaaradhya 3Jun2009 14:51

Re: Design pattern in simple examples
 
Hi Shabbir,

Excellent article. I found the article very usefull. I was struggling to understand the design pattern concepts. You have explained in a simple and understandable way also with examples.

Thanks a lot.

Regards,
Shobha

shabbir 3Jun2009 20:30

Re: Design pattern in simple examples
 
The pleasure is all mine.

binclintonusa 13Jun2009 08:42

Re: Design pattern in simple examples
 
Thank you very much for the lesson. I knew that I can do this in better way.

WaibelRD 1Sep2009 05:23

Re: Design pattern in simple examples
 
Outstanding!

I think I have been doing this for years but never realized there were "names" and "functionality" associated with what I was doing.

Great Job and THANK YOU!

Rob Waibel

shabbir 1Sep2009 09:04

Re: Design pattern in simple examples
 
Thats the beauty of Design Pattern and we use them more often without actually knowing them

tsnany115 5Sep2009 09:01

Re: Design pattern in simple examples
 
Hi all, I am a new member of forum

praba_expert 22Sep2009 14:11

Re: Design pattern in simple examples
 
good work shabbir:nice:


All times are GMT +5.5. The time now is 00:01.