Answered by:
which design pattern shall i use?

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
-
User-358979764 posted
You may use facade design pattern...
Thursday, May 1, 2014 8:00 AM -
User1717843576 posted
Sorry, i am not aware of this pattern! Can you please share some reasons why facade pattern? And provide some example.
Thursday, May 1, 2014 9:17 AM -
User521424079 posted
Provide a unified interface to a set of interfaces in a subsystem. Façade defines a higher-level interface that makes the subsystem easier to use.
Reference:
http://www.dofactory.com/Patterns/PatternFacade.aspxFriday, May 2, 2014 2:39 AM -
Friday, May 2, 2014 3:02 AM
-
User459659623 posted
Hello
I think you have to learn more about patterns for practical usage. In that case you can read following book. This is a great book for learning Design patterns and principles. Hope it will help you to solve your any design pattern related problems.
Sunday, May 4, 2014 12:17 AM -
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