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.