forked from ashishps1/awesome-low-level-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
14 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,23 @@ | ||
# Designing Stack Overflow | ||
|
||
## Requirements | ||
1. Users should be able to register, log in, and log out of the system. | ||
2. Users can post questions, answer questions, and comment on questions and answers. | ||
3. Questions should have tags associated with them for categorization and easy searching. | ||
4. Users can vote on questions and answers to indicate their relevance and quality. | ||
5. The system should have a reputation system based on user activity and the quality of their contributions. | ||
6. Users can search for questions based on keywords, tags, or user profiles. | ||
7. The system should handle concurrent access and ensure data consistency. | ||
1. Users can post questions, answer questions, and comment on questions and answers. | ||
2. Users can vote on questions and answers. | ||
3. Questions should have tags associated with them. | ||
4. Users can search for questions based on keywords, tags, or user profiles. | ||
5. The system should assign reputation score to users based on their activity and the quality of their contributions. | ||
6. The system should handle concurrent access and ensure data consistency. | ||
|
||
## Implementations | ||
#### [Java Implementation](../solutions/java/src/stackoverflow/) | ||
#### [Python Implementation](../solutions/python/stackoverflow/) | ||
|
||
## Classes, Interfaces and Enumerations | ||
1. The **User** class represents a user of the Stack Overflow system, with properties such as ID, username, password, email, and reputation. | ||
2. The **Question** class represents a question posted by a user, with properties such as ID, title, body, author, answers, comments, tags, and vote count. | ||
3. The **Answer** class represents an answer to a question, with properties such as ID, body, author, associated question, comments, and vote count. | ||
4. The **Comment** class represents a comment on a question or an answer, with properties such as ID, text, author, and creation timestamp. | ||
5. The **Tag** class represents a tag associated with a question, with properties such as ID and name. | ||
6. The **StackOverflowSystem** class is the main class that manages the Stack Overflow system. It follows the Singleton pattern to ensure only one instance of the system exists. | ||
7. The **StackOverflow** class provides methods for user registration, login, posting questions, answers, and comments, voting on questions and answers, searching for questions, and retrieving questions by tags and users. | ||
8. Multi-threading is implemented using synchronized blocks and methods to ensure thread safety when updating shared data, such as vote counts and user reputations. | ||
9. The **StackOverflowDemo** class demonstrates the usage of the Stack Overflow system by registering users, logging in, posting questions and answers, voting, searching for questions, and retrieving questions by tags and users. | ||
1. The **User** class represents a user of the Stack Overflow system, with properties such as id, username, email, and reputation. | ||
2. The **Question** class represents a question posted by a user, with properties such as id, title, content, author, answers, comments, tags, votes and creation date. | ||
3. The **Answer** class represents an answer to a question, with properties such as id, content, author, associated question, comments, votes and creation date. | ||
4. The **Comment** class represents a comment on a question or an answer, with properties such as id, content, author, and creation date. | ||
5. The **Tag** class represents a tag associated with a question, with properties such as id and name. | ||
6. The **Vote** class represents vote associated with a question/answer. | ||
7. The **StackOverflow** class is the main class that manages the Stack Overflow system. It provides methods for creating user, posting questions, answers, and comments, voting on questions and answers, searching for questions, and retrieving questions by tags and users. | ||
8. The **StackOverflowDemo** class demonstrates the usage of the Stack Overflow system by creating users, posting questions and answers, voting, searching for questions, and retrieving questions by tags and users. |