educative.io

Educative

Question implements Search interface?

How is Question class implementing the Search interface? If it should be something like SearchForQuestions (as per code), should we have a separate class doing that? @Design_Gurus

@Design_Gurus kindly reply

I had the same question. I think it makes much more sense to have a “Catalog” or “QuestionBank” class which maintains a Collection of Questions and implements the Search interface.

Additionally, it seems like each of the post types (Question, Comment, Answer) are logically similar and share functionality (voteCount, flagCount, creationTime, etc). It seems like a way cleaner approach to unite these under a “Post” abstract class, then extend into separate Question, Comment and Answer classes.

The first few designs in this course were pretty good, but I was a little disappointed by this one and the explanation.

I definitely agree with having a Post or CommunityContent class, I’m glad I was not the only one to think of it. It’s annoying, I am learning this topic for interview purposes and consider this course to be a source of truth but it seems rushed

@Design_Gurus wrote 4 posts this year so I think it’s optimistic to expect feedback on anything at this point