Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 946899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:59:42+00:00 2026-05-15T22:59:42+00:00

I am implementing a few strategies (Strategy Pattern) which have some common behavior and

  • 0

I am implementing a few strategies (Strategy Pattern) which have some common behavior and am undecided where the common operations should live.

  • Assuming I 1 context and 3 strategies, some of the operations used in the strategies are shared, some are needed only by 2 others just be 1 of the strategies.
  • There is no member level state shared, therefore the only operations are effectively stateless.
  • The intention of the operations are to support the formatting of state to a file, like a view helper.

Option 1: Make an AbstractStrategy class

  • I’m using Java so this immediately
    takes away using this feature in the
    future.
  • Inheritance tends to result.
    in a ridge structure.
  • Operations would be final.

Option 2: Create a Util class of static helpers

  • Flexible, but feels like a code smell for some reason.
  • Not ridged.

Any recommendations or preferences?

Note the level I am working at is the Strategy level, not the Context level (see wikipedia link).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:59:43+00:00Added an answer on May 15, 2026 at 10:59 pm

    There is one reason… one huge reason… to use a static Util class over an abstract class or interface.

    So you can add more methods at a later date.

    With an abstract class or interface, any change you make to that class/interface has to be changed in all classes that inherit from it. This is especially problematic if you’re writing a public API.

    The Java framework has util classes with static methods scattered throughout. The most well known ones are in the java.util package: Collections and Arrays.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently implementing the Factory design pattern in Python and I have a few
So I have a few questions about implementing the Android action bar. Up to
I've an ASP.NET MVC 3 project and have been tasked with implementing a few
I have a few basic questions about the Dispose Pattern in C#. In the
When implementing models using the MVC pattern, how complex should my models be? Let's
Let's say I have an interface IAutoTask and few other classes implementing that interface,
I'm implementing some rudimentary SQL Server monitoring to watch for excessive blocking. I have
I have a few fields in a webforms and currently I'm not implementing any
I am implementing In App Purchase.In the in app product list,I have configured few
I have a question about implementing a few specific behaviors in NSTableViews/NSOutlineViews. WHAT I'M

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.