locked
which design pattern shall i use? RRS feed

  • Question

  • User1717843576 posted

    I am not pro in design patterns and need help to understand which pattern shall i use for the below scenario.

    I have create a model design to maintain list of courses. Each course will have courseid, coursename, coursedescription etc (attributes). The courses can be of different types CourseTypeA, CourseTypeB (each course having same attributes as mentioned above).

    I need to be able to build a list of each course types and pass it to the program using these classes.

    I have read using interfaces are the preferred way in designing classes, but i am confused how to go about it. Please suggest. A sample will really help.

    Thursday, May 1, 2014 6:33 AM

Answers

  • User1558924997 posted

    Each course will have courseid, coursename, coursedescription etc (attributes). The courses can be of different types CourseTypeA, CourseTypeB etc; Can you please elaborate your problem in more details. 

    Need to understand if CourseType can also be an attribute? In this case one interface ICourseClass and one class implementation can do the job, list of ICourseClasses can be used as transporter. You need to go for design pattern if based on CourseType each courseClass is going to have different implementation. 

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, May 5, 2014 6:44 AM

All replies