GoF Patterns Problems/Solutions

Software Development Add comments

These are the basic descriptions of some GoF patterns.

Name: Adapter
Problem: How do you resolve incompatible interfaces, or provide a stable interface to similar components with different interfaces?
Solution: Convert the original interface of a component into another interface, through an intermediate adapter object.

Name: Factory or Simple Factory or Concrete Factory (Non GoF)
Problem: Who should be responsible for creating objects when there are special considerations, such as complex creation logic, a desire to separate the creation responsibilities for better cohesion, and so forth?
Solution: You should make a new Pure Fabrication object and call it a Factory. This Factory then handles the creation. Factories are mostly accessed by a Singleton pattern.

Name: Singleton
Problem: We know that only one instance of a class is needed. Hence it is a singleton, how do we restrict this single creation and access point?
Solution: We define a static method of the Factory class, and return the static instance of that Factory object. We should also restrict the constructor of this class to be private.

Name: Strategy
Problem: How to design for varying, but related, algorithms or policies? Furthermore, how do you design for the ability to change these designs or properties based on requirements?
Solution: You should define each algorithm/policy/strategy in a separate class, with a common interface.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • StumbleUpon
  • Reddit
  • Webnews
  • MisterWong
  • Y!GG
Tags: , , , , , , , ,


21 Responses to “GoF Patterns Problems/Solutions”

  1. jdfgjksdhsjdfnsuidh Says:

    hey hot cakes

  2. jdfgjksdhsjdfnsuidh Says:

    I said hey hot cakes

  3. George Costanza Says:

    Who is this?

  4. jdfgjksdhsjdfnsuidh Says:

    Who are you?

  5. George Costanza Says:

    SK…

  6. jdfgjksdhsjdfnsuidh Says:

    SK who?

  7. George Costanza Says:

    SK the person who writes these boring articles…

  8. jdfgjksdhsjdfnsuidh Says:

    Could you blog about hot cakes then?

  9. George Costanza Says:

    No, I can’t blog for a while. Who are you? I need an answer or else I am putting you in my spammers list.

  10. jdfgjksdhsjdfnsuidh Says:

    Are you a hot cake? Why can’t you blog for awhile?

  11. SpaceShip Conductor Says:

    Your face is a hot cake.
    Cuz FatsoFace advised me not to.

  12. jdfgjksdhsjdfnsuidh Says:

    Goodnight

  13. George Costanza Says:

    Goodnight
    mttu

  14. jdfgjksdhsjdfnsuidh Says:

    Morning.

    What happened last night and why did you hang up all of the sudden?

  15. Fatso Says:

    Hey, I felt bad about wasting the card. And you were so safe and sound. :)
    Thanks :)
    Sorry for hanging up.

  16. jdfgjksdhsjdfnsuidh Says:

    So i just woke up few minutes ago and the first thing i did was dialed your number.I tried twice but it kept going on message … don’t get me wrong, i’m glad it is the way it is so you sleep well. My work starts soon in an hour or so.

  17. jdfgjksdhsjdfnsuidh Says:

    Sunlight is piercing through my window blinds, a sight you don’t get to view so often any more. Its so nice to feel the warmth of the sun on your face when you wake up. I’m glad that my room is structured in such a way where i get to meet sun’s extensions every single morning. The joy i get of it cannot be summarized into few lines.

    Morning S.

  18. George Costanza Says:

    Morning, I just woke up and I had such an urge…

    You told me to turn my phone off. I knew I shouldn’t have listened to you. You owe me a morning chat now.

    I took a long long long shower before sleeping last night.

    I am glad you had a good morning. I am actually very glad you feel the way you feel about the sun. Maybe one day I’ll also share your enthusiasm about getting hit by the sunlight on my fat face. Although I don’t see it happening, but I can try.

    Have a good day at work! Hopefully you won’t have to scan stuff like you know what.

    Hey, remember the streaking meteor over Alberta a couple of days ago?

    http://www.cbc.ca/technology/story/2008/11/24/meteor-hunt.html?ref=rss

    Well it was found yesterday.
    http://www.cbc.ca/technology/story/2008/11/28/meteorite.html

    Not a big deal, but the video of it streaking through the sky was pretty cool.
    http://www.youtube.com/watch?v=hBLhEoBTAnc

    Oh and yesterday the Space Station was visible as the brightest star in the sky around 5.30 pm, I tried looking for it but couldn’t see. I need a telescope!

    Ok ok Take care ofyourself!

  19. George Costanza Says:

    You!
    I found this funny:
    http://gizmoave.com/2008/11/30/your-dna-portrait/

  20. jdfgjksdhsjdfnsuidh Says:

    haha.
    Thats something Watson would love for his next birthday. Did i ever tell you how he got his whole genome sequenced on to a dvd for 1 million dollar.

  21. SpaceShip Conductor Says:

    No you never told me, you never tell me anything!
    Just playing.

    And no I am not getting in a discussion with you on who misses who more, we all know the truth.

Leave a Reply

Spam Protection by WP-SpamFree

Forever Excitified
 
web statistics