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?