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: 70

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

    Quantum Computing IPO Makes A British Pakistani Billionaire

    Ilyas Khan, the British Pakistan founder of Quantinuum, became a billionaire in the company’s IPO on NASDAQ last week. Khan is a pioneer in the revolutionary field of quantum computing which could speed up computing by orders of magnitude. It will have a huge impact in AI and encryption. Dr. Irfan Siddiqui, a Pakistani-American professor of Physics at University of California at Berkeley, is another top expert in quantum computing. …

    Continue

    Posted by Riaz Haq on June 12, 2026 at 10:00am — 3 Comments

    Ten Pakistanis Among Unicorn Founders in America

    There are ten Pakistani immigrants included among founders or co-founders of unicorns in America, according to  a recent study by the National Foundation for American Policy (NFAP). A unicorn is a startup with a valuation of at least one billion U.S. dollars. Immigrant entrepreneurs of US unicorns are diverse, hailing from 76 different countries. India, with 96 companies, is the leading country of origin for the immigrant founders of U.S. billion-dollar companies. Immigrants…

    Continue

    Posted by Riaz Haq on June 8, 2026 at 6:00pm — 7 Comments

    © 2026   Created by Riaz Haq.   Powered by

    Badges  |  Report an Issue  |  Terms of Service