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

    Pakistani-American Professor Publishes Landmark Genomic Research on Pakistanis

    Dr. Danish Saleheen, a Pakistani-American professor at Columbia University, and his fellow researchers have published a comprehensive analysis of 173,303 genomes from Pakistan, one of the largest genomic studies ever conducted in South Asia. This landmark work is upending how scientists understand human genetics and drug development. "South Asians have been severely underrepresented in genome studies—comprising just 2% of global genomic databases despite representing 25% of…

    Continue

    Posted by Riaz Haq on June 26, 2026 at 7:30pm

    Does Pakistan's Real GDP Exceed One Trillion US Dollars?

    A 2024 joint study of the International Labor Organization and the Small and Medium Enterprise Development Authority  (SMEDA) estimated Pakistan's undocumented economy at $457 billion. While other South Asian nations, particularly Bangladesh and India, do include estimated undocumented GDP figures in their official GDP, Pakistan's official GDP figures do not include such estimates. If the Pakistani government decides to include estimates of the informal economy in its official…

    Continue

    Posted by Riaz Haq on June 19, 2026 at 7:30am — 5 Comments

    © 2026   Created by Riaz Haq.   Powered by

    Badges  |  Report an Issue  |  Terms of Service