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

  • Home
  • SEARCH
  • 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 8866667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:50:57+00:00 2026-06-14T16:50:57+00:00

Suppose I have very basic Task class as follows: public class Task { string

  • 0

Suppose I have very basic Task class as follows:

public class Task
{
    string Title { get; set; }
}

Now I want to add Planning “behaviour” to SOME of my tasks. Obviously I will have to have something like:

public interface IPlannable
{
    public void CalculatePlan();
    public DateTime Start { get; }
    public DateTime Finish { get; }
}

and two concrete algorithms, each with different input parameters:

public class PlanStrategyA : IPlannable
{
    private int parameter1;
    private int parameter2;
    private DateTime start;
    private DateTime finish;

    public PlanStrategyA(int p1, int p2)
    {
        parameter1 = p1;
        parameter2 = p2;
    }

    public void CalculatePlan()
    {
        // ... uses parameter1 & parameter2
        // ... to calculate start and finish
    }

    public DateTime Start { get { return this.start; } }

    public DateTime Finish { get { return this.finish; } }
}

public class PlanStrategyB : IPlannable
{
    public int parameter3;

    // ... the rest is similar to PlanningStrategyA

}

Question is :

What is best design pattern to use to connect base Task class to concrete Planning strategy as OPTION, meaning that not all Tasks is required to be planned, ie. to have Planning behaviour ?

User should have possibility to “promote” task to be planned, and also to “remove” this behaviour from particular task.

How all this applies to persisting to Database via EF, or other ORM, particularly when reading from database ? What pattern will best fit reading from DB and creating back my task objects ?

  • 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-14T16:50:59+00:00Added an answer on June 14, 2026 at 4:50 pm

    Seems that you have 2 distinct issues here.
    One is the strategy algorithm for plannable tasks – you can use a Strategy pattern for handling this.
    Regarding the tasks that aren’t plannable, I see 2 possible approaches:

    1. Exclude it from scope of design pattern. It’s perfectly ok, patterns shouldn’t be forced upon your design if not needed.
    2. Have a 2-level strategy – upper level to choose whether task is plannable or not and lower level (for plannable only) to apply your strategy.

    The other one is a set of possible behaviors for each task. This can be tackled with Composite pattern. No behavior is also a behavior.

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

Sidebar

Related Questions

I have a very basic question... Suppose I can get a closing price for
suppose I have the following class: class MyInteger { private: int n_; public: MyInteger(int
This is a very basic php question : suppose I have 3 files, file1,
I have a very basic doubt. Suppose we heve two after insert trigger TR1
I have a very basic confusion about grep. Suppose I have a following file
I have a very basic question on updating a mongo collection. Suppose I have
This a very basic database design/normalisation question. Suppose I have a Books table with
Probably this is a very basic question for shell programmers. But suppose I have
I have a very large list Suppose I do that (yeah, I know the
Suppose I have a static method of my class that returns an object of

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.