ok lets talk about Strategy Pattern.........

a) You have strategies=algorithms to solve a problem
b) context: every algoirhtm is suitable for a particular context
c) you invoke the strategy on the bases of context

example 1:

You can apply strategy pattern to dynamically change your basketball strategy during the game

Whats the context here?
skillset of players
time remaning
score
etc.

Whats the strategy here?
Basketball has strategies like 3-2-1, 2-1-2, 1-2-2

example 2:

You need to sort data in flat file

Whats the strategy here?

Merge sort
Radical sort
Quick Sort
etc

Whats the context?

Size of the file
data separability
etc.

Code:

http://www.dofactory.com/Patterns/PatternStrategy.aspx

Views: 52

Pre-Paid Legal


Twitter Feed

    follow me on Twitter

    Sponsored Links

    South Asia Investor Review
    Investor Information Blog

    Haq's Musings
    Riaz Haq's Current Affairs Blog

    Please Bookmark This Page!




    Blog Posts

    The WWF Championship Belt: From Canvas to Canvas

    The WWF Championship belt, beyond its status as a coveted prize in the world of professional wrestling, has also transcended the ring to become a source of inspiration for various art forms. Its iconic design elements and rich history have served as a muse for painters, sculptors, and even digital artists, transforming the championship belt into a canvas for artistic expression.



    A Champion's Canvas: Paintings and…

    Continue

    Posted by Ben Qadeer on May 17, 2024 at 5:38am

    Global Baby Bust: Pakistan is A Rare Bright Spot Among Most Populous Nations in Asia

    There is an alarming rapid decline in fertility rates in both developed and developing nations, according to the United Nations.  Here is how the Wall Street Journal describes it: "The world is at a startling demographic milestone. Sometime soon, the global fertility rate will drop below the point needed to keep the population constant. It may have already happened". …

    Continue

    Posted by Riaz Haq on May 14, 2024 at 9:30am

    © 2024   Created by Riaz Haq.   Powered by

    Badges  |  Report an Issue  |  Terms of Service