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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T13:24:19+00:00 2026-05-11T13:24:19+00:00

You’re writing an application that manages online courses. A course is completed in many

  • 0

You’re writing an application that manages online courses. A course is completed in many different ways. A user must do one or more of the follow to complete the course:

  • spend x amount of hours in the course
  • take a test, and pass the test (a passing score could be different for every course)
  • take all the lessons in a course
  • some other requirements you don’t know about yet

When a course is completed, some event needs to happen. The event depends on the course. One or more of the following may need to happen:

  • A custom certificate is created for the user
  • An organization is alerted via email, HTTP callback, or something else
  • some other requirements you don’t know about yet

Many of the courses are almost identical with respect to their requirements, but some are completely unique. There are a lot of courses, upwards of 50, and more are always being added.

How would you design an application like this? Is there a design pattern you can use to eliminate redundant code, and make it easy to add/edit courses?

  • 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. 2026-05-11T13:24:20+00:00Added an answer on May 11, 2026 at 1:24 pm

    Here how I would start sketching it out…

    You have a Course object which accepts a Requirements object and a OnCompleteActions object in its constructor… granted I would make the constructor internal and Create a CourseBuilder that will know how to build all of the different courses but…

    When ever the Course is updated it checks if the Requirements are met by passing itself to the Requirements object. If it meets the requirements it then passes itself to the OnCompleteActions.

    private void OnCourseUpdate() {         if (this._Requirements.AreMetBy(this))         {             this._OnCompleteActions.Execute(this);         } } 

    Requiremetns object is nothing but an aggregate list of IRequirement which you could fine tune based on the Course that you create… the AreMetBy method simple enumerates all of your IRequirements in the list and checks to see if your course satisfies them all…

    interface IRequirement  {     public bool IsMetBy(Course course); } 

    Then you could have all sorts of different Requirements that implement IRequirement…

    class CourseHoursRequirement : IRequirement {     public CourseHoursRequirement(int minimumHours)     {...}      public bool IsMetBy(Course course)     {         return course.NumberHours >= this._MInimumHours      } } 

    Same idea for the OnCompleteActions would have a list of one or More IOnCompleteAction that would execute each one. ex. CreateCertificateOnCompleteAction, SendEmailOnCompleteAction, etc.

    By encapsulating each possible Requirement in its own class you can then Build a course that would have a MinimumHourRequirement, a PassedAllTestRequirement, etc. You could easily add new requirements as you go because they are all implementing the same interface. You probably have to add some limit properties as you go (like minimumHours) but the real work is done inside of the IsMetBy() method…

    Good luck!

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a

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.