#19: 5 Steps to answer a LLD Interview Problem
Thanks for sharing the valuable content bro 🙌🏻🙌🏻
you are welcome!
I have gone through Code of StackOverFlow. I just wanted to add a suggestion for your StackOverflow class.
Instead of writing all methods below inside StackOverflow class, Create a Multiple Class such as UserService, QuestionService, VotingService , etc.
By moving these methods to respective class , it will be more modular, extensible.
UserService
createUser(username, email): Creates and registers a new user in the system.
getQuestionsByUser(user): Searches questions added by a user.
QuestionService
askQuestion(user, title, content, tags): Allows a user to ask a new question.
answerQuestion(user, question, content): Allows a user to answer an existing question.
addComment(user, commentable, content): Allows a user to add a comment on an existing question/answer.
acceptAnswer(answer): Mark an answer as accepted
Voting Service
voteQuestion(user, question, value): Registers a vote on a question.
voteAnswer(user, answer, value): Registers a vote on an answer.
SearchService
searchQuestions(query): Searches for questions based on a query string.
@Ashish , Let me know if i am thinking in right directions ??
Makes a lot of sense. Thanks for sharing your insights.
It was really awesome to go through.
Glad to hear this, thank you!
Thanks for explaining in a detailed way.
It's very easy to understand.
Great to hear this, thank you!
A good object-oriented design exercise can tell a lot about candidates.
This is a great example, Ashish!
Really Great👍
thank you!
Way of explanation is awesome. Keep continue👍
thank you so much!
Excellent share...
for now in above code we are not using Votable interface, so instead of writing voteQuestion and voteAnswer method we can use single method- addVote(user, Votable, value).
agree.. we can utilize the Votable interface here
Thanks for sharing the valuable content bro 🙌🏻🙌🏻
you are welcome!
I have gone through Code of StackOverFlow. I just wanted to add a suggestion for your StackOverflow class.
Instead of writing all methods below inside StackOverflow class, Create a Multiple Class such as UserService, QuestionService, VotingService , etc.
By moving these methods to respective class , it will be more modular, extensible.
UserService
createUser(username, email): Creates and registers a new user in the system.
getQuestionsByUser(user): Searches questions added by a user.
QuestionService
askQuestion(user, title, content, tags): Allows a user to ask a new question.
answerQuestion(user, question, content): Allows a user to answer an existing question.
addComment(user, commentable, content): Allows a user to add a comment on an existing question/answer.
acceptAnswer(answer): Mark an answer as accepted
Voting Service
voteQuestion(user, question, value): Registers a vote on a question.
voteAnswer(user, answer, value): Registers a vote on an answer.
SearchService
searchQuestions(query): Searches for questions based on a query string.
@Ashish , Let me know if i am thinking in right directions ??
Makes a lot of sense. Thanks for sharing your insights.
It was really awesome to go through.
Glad to hear this, thank you!
Thanks for explaining in a detailed way.
It's very easy to understand.
Great to hear this, thank you!
A good object-oriented design exercise can tell a lot about candidates.
This is a great example, Ashish!
Really Great👍
thank you!
Way of explanation is awesome. Keep continue👍
thank you so much!
Excellent share...
thank you!
for now in above code we are not using Votable interface, so instead of writing voteQuestion and voteAnswer method we can use single method- addVote(user, Votable, value).
agree.. we can utilize the Votable interface here