Комментарии:
Thank You So Much for this wonderful video................🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻
ОтветитьGreat tutorial! Just one question:
Shouldn't the <QuestionType>Question classes not know the printing behavior i.e printQuestionChoices()?
It might sound better to say rangeQuestion.getChoices(), which returns an array of the choices and then:
printQuiz(quiz) {
quiz.getChoices().map((choice) => console.log(choice));
}
Just an idea :D
Its a bit difficult to immediately understand the benefit of this approach.
What if business decides to introduce a time limit for each type of questions(different types would have different time limits)?
You would need to update all the components separately but you would also need to update 'printQuiz' as well to call for the relevant method each time....
The explanation is brilliant
ОтветитьUmm, what if the questions is come from external sources like database.
For each data we got, we still need if statements to construct the class correctly.
Let say,
if type === "multiple" then new MultipleChoice()
else if type === "single" then new SingleChoice()
does this violates the ocp rules?
pardon for my noob question 😊
wow the best ive seen so far !
ОтветитьSuppose you're fetching these details from a mongoose collectiion . The result is an array of objects with type and all details . How would one implement this principle then ?
ОтветитьThis is quality content
ОтветитьBrillaint!
ОтветитьBest explanation of the concept, and I searched quite a bit.
Ответитьthanks for the great example explaining open closed principle.
the following question is what about c++ example since c++ cannot put objects of different classes into an array?
Excellent Explanation.
ОтветитьI understood and I liked how you explained with js and one bad point that I can see with js is because we cannot declare interfaces to be implemented and then we need to make sure that the name of the method is really the same between those classes and having an interface to declare this method would be better because we could create RangeQuestion class implementing idk "PrintableOption" class in order to not worry about writing the method with the same name
Ответитьthanks
ОтветитьI need source code Please
ОтветитьHi Kyle, but what if another new question has to output more than description and choices. How to implement that within the printQuiz() ?
Ответитьi really appreciate your efforts !! thanks a lot
ОтветитьExcellent!
ОтветитьI think I finally understand this principle after reading about it numerous times over the years and watching other videos. Good example, thanks!
ОтветитьNice video! already a subscriber!
But could you also include in the SOLID videos how to solve the same problems but in FP not only OOP, just for curiosity.
Nice!
Good Stuff.
I figure a case where if statements are not in violation is in, for instance, algorithms, where you may be comparing index or key values, etc. for for instance sorting operations.
One concern I have in regards to Solid thus far is that it seems to create redundancies, which in turn may lead to more changes being needed. If, for example, two classes use an identical implementation of the same function, if you modify one, you're likely to want to modify the other...
You are very good 👏
Ответитьjs is stupid
ОтветитьBest explanation ever!
Ответитьyou are not the one should thanks us , we are
ОтветитьWhat if the method requires different arguments to achieve its functionality? Then how would we implement that? Surely we wouldn’t know what to pass in ? Your great btw Kyle.
ОтветитьI have a problem doing this in MVC pattern because a lot of my else if statements target and mutate models in seperate classes, which means my version of the printQuestionChoicr relies on three other classes. It’s a game of monopoly I made. E.g my polymorphic method would each call methods of other objects and since my objects are instantiated inside the controller !
ОтветитьHi Kyle! Is there a repository of the SOLID code? I couldn't find it in Github! :(
Thanks for the content!
Great
ОтветитьThis is a good explanation of O/C principle
ОтветитьMain line was: This principle allows you to extend some code without actually making changes to the code being extended.
Ответитьthis channel and net ninja have changed my programming life
Ответитьthank you so much, that makes it so much easier to understand.
If I understand correctly, that means your program should be able to be extended without modifying it. As modifying a class can modify it's functionality with other dependencies, but if we just extend the class, it will not affect those dependencies.
This was really well explained, thank you so much for the clear explanation. I am definitely going to watch the remaining videos you did on SOLID
ОтветитьYou are an excellent teacher.
Ответитьawesome video, thanks author.
ОтветитьGreat example and explaining
Ответитьcan I give this video a thousand likes???????
ОтветитьI have been programming like that without knowing the open close principle
ОтветитьAs I understood the open/closed principle: Open for new "data", closed in behavior.
ОтветитьAmazing 😀 thank you 😊
ОтветитьIs it just me or does this seem more like a Liskov Substitution sample? I think Open-Close is more for extending the functionality of a call without changing the main class. For this, I'd make use of the "extends" key word. Still this was really well explained.
ОтветитьWhat’s the difference between this and the Command Pattern?
ОтветитьThat's a genius explanation!!
ОтветитьThis is really good. Thanks for sharing 👌👌
ОтветитьMakes no sense. You had to do more work following the open-close principle. Downvoted.
ОтветитьEverytime i want to make my code cleaner and simplier, I go to WDS. Thanks Kyle!
Ответить