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 8302401
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:16:56+00:00 2026-06-08T17:16:56+00:00

I have designed the sorting mechanism for my site as : Now due to

  • 0

enter image description here

I have designed the sorting mechanism for my site as :
Now due to change in requirement, I need to add some variables which are common to all Strategy i.e ByDate, ByConsuption, By Demand.

Also I need to modify the sorting string, based on output of a function
for example if a function returns available then,

  1. SORT BY DATE DESC => sort by available desc, DATE desc
  2. SORT BY DEMAND DESC => sort by available desc, DEMAND desc

Question:

If I have some common variables/functions how can I include at one point and still it can be accessible in all classes?

  • 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-06-08T17:16:58+00:00Added an answer on June 8, 2026 at 5:16 pm

    I’d use a SortStrategyBase or SortStrategyAbstract class which will would have the common functionality, and then have the factory inject whatever property is required. All SoryByWhateverStrategy classes would then extend the base/abstract.

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

Sidebar

Related Questions

I have designed a Report in my ASP.NET web site now i need to
I have designed some classes using Visual Studio class diagramming. Now I would like
I have designed a site and my CSS is not loading in FF and
I have designed this gui in netBeans which has a canvas , a couple
I have designed a new web site. I have hosted it online. I want
I have designed my UITableViewCell in iPhone. Unfortunately I need to redesign the Cell.
I have designed a standalone application using swings which can read data from HID
I have designed a form where the user can enter his comment using Add
We have designed an API which exposes a series of interfaces written in C#.
I have designed a weighted graph using a normalized adjacency list in mysql. Now

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.