Design Patterns in Simple Examples

Discussion in 'Engineering Concepts' started by shabbir, Jul 5, 2007.

  1. sanc.pec

    sanc.pec New Member

    Joined:
    Dec 31, 2008
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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:
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    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.
     
  3. shae marks

    shae marks New Member

    Joined:
    May 24, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    self employd
    Location:
    usa
    Home Page:
    http://www.mielofon.com/model/shae_marks/
    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.
     
  4. shobhaaradhya

    shobhaaradhya New Member

    Joined:
    Jun 3, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The pleasure is all mine.
     
  6. binclintonusa

    binclintonusa New Member

    Joined:
    Jun 13, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Thank you very much for the lesson. I knew that I can do this in better way.
     
  7. WaibelRD

    WaibelRD New Member

    Joined:
    Sep 1, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    Software Engineer
    Location:
    Phoenix
    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
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Thats the beauty of Design Pattern and we use them more often without actually knowing them
     
  9. tsnany115

    tsnany115 New Member

    Joined:
    Sep 5, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi all, I am a new member of forum
     
  10. praba_expert

    praba_expert New Member

    Joined:
    Sep 22, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    good work shabbir:nice:
     
  11. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The pleasure is all mine
     
  12. bharathi_rg@yahoo.co

    bharathi_rg@yahoo.co New Member

    Joined:
    Dec 4, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    simple and easy understand !!
     
  13. Rajneeshgarg

    Rajneeshgarg New Member

    Joined:
    Dec 14, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Thanks shabbir, From where i can get these examples in C++, actually i have no knowledge of java. please inform ASAP.
     
  14. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    I have them in C# and not in Java and language is pretty simple and examples also does not take much of C# into account. I am also not an expert at C# BTW
     
  15. mmagdy

    mmagdy New Member

    Joined:
    Dec 31, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    thank you ,this is really very helfull:)
     
  16. jameschowdary

    jameschowdary New Member

    Joined:
    Feb 12, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    A sample of 2 methods implement 3 tier or entire applying design patterns
    that will helpful to understand
     
  17. nosizejosh

    nosizejosh New Member

    Joined:
    Mar 30, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    thanks man! i am a beginner programmer and i think i im more comfortable with java, currently learning design patterns and i stumbled upon this article, it is really helpful so thanks a lot.

    anyway i have a project to design and implement a memory game using java and im wondering if any of these patterns can be helpful in my design

    thank you all!
     
  18. elhassane

    elhassane New Member

    Joined:
    Mar 30, 2010
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    student
    Location:
    ouarzazate
    thnx friend for your lesson it's very very interessent
     
  19. mvmmk78

    mvmmk78 New Member

    Joined:
    May 27, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi This is Murali. I downloaded the DesignPatternCodeSample.zip . and I am trying to open the project using VC 2005 editor. I am not able to open the project. Inside the folder there is only one file without any Ext (file name : DesignPatternCodeSample). Could you please help me or mail me those sample project if possible. My Email id is mvmmk78@gmail.com
     
  20. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Download it once again because there are many files in the zip file
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice