{"id":22513894,"url":"https://github.com/emahtab/design-stackoverflow","last_synced_at":"2026-01-07T13:09:06.108Z","repository":{"id":79525433,"uuid":"448164120","full_name":"eMahtab/design-stackoverflow","owner":"eMahtab","description":null,"archived":false,"fork":false,"pushed_at":"2022-01-15T03:48:59.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-02T03:25:59.712Z","etag":null,"topics":["low-level-design","object-oriented-design","system-design"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eMahtab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-15T02:42:53.000Z","updated_at":"2022-01-15T03:49:29.000Z","dependencies_parsed_at":"2023-06-07T19:15:46.491Z","dependency_job_id":null,"html_url":"https://github.com/eMahtab/design-stackoverflow","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdesign-stackoverflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdesign-stackoverflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdesign-stackoverflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eMahtab%2Fdesign-stackoverflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eMahtab","download_url":"https://codeload.github.com/eMahtab/design-stackoverflow/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245952202,"owners_count":20699446,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["low-level-design","object-oriented-design","system-design"],"created_at":"2024-12-07T03:14:58.894Z","updated_at":"2026-01-07T13:09:06.054Z","avatar_url":"https://github.com/eMahtab.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Design Stackoverflow\n\n## System requirements :\n\nWe will be designing a system with the following requirements:\n\n1. Any non-member (guest) can search and view questions. However, to add or upvote a question, they have to become a member.\n2. Members should be able to post new questions.\n3. Members should be able to add an answer to an open question.\n4. Members can add comments to any question or answer.\n5. A member can upvote a question, answer or comment.\n6. Members can flag a question, answer or comment, for serious problems or moderator attention.\n7. Any member can add a bounty to their question to draw attention.\n8. Members will earn badges for being helpful.\n9. Members can vote to close a question; Moderators can close or reopen any question.\n10. Members can add tags to their questions. A tag is a word or phrase that describes the topic of the question.\n11. Members can vote to delete extremely off-topic or very low-quality questions.\n12. Moderators can close a question or undelete an already deleted question.\n13. The system should also be able to identify most frequently used tags in the questions.\n\n\n## Account, AccountStatus, Member, Admin, Moderator\n```java\n// For simplicity, we are not defining getter and setter functions. The reader can\n// assume that all class attributes are private and accessed through their respective\n// public getter methods and modified only through their public methods function.\n\npublic class Account {\n  private String id;\n  private String password;\n  private AccountStatus status;\n  private String name;\n  private Address address;\n  private String email;\n  private String phone;\n  private int reputation;\n\n  public boolean resetPassword();\n}\n\npublic enum AccountStatus{\n  ACTIVE,\n  CLOSED,\n  CANCELED,\n  BLACKLISTED,\n  BLOCKED\n}\n\npublic class Member {\n  private Account account;\n  private List\u003cBadge\u003e badges;\n\n  public int getReputation();\n  public String getEmail();\n  public boolean createQuestion(Question question);\n  public boolean createTag(Tag tag);\n}\n\npublic class Admin extends Member {\n  public boolean blockMember(Member member);\n  public boolean unblockMember(Member member);\n}\n\npublic class Moderator extends Member {\n  public boolean closeQuestion(Question question);\n  public boolean undeleteQuestion(Question question);\n}\n```\n\n# Bounty\n```java\npublic class Bounty {\n  private int reputation;\n  private Date expiry;\n\n  public boolean modifyReputation(int reputation);\n}\n```\n\n# Question and QuestionStatus\n```java\npublic class Question{\n  private String title;\n  private String description;\n  private int viewCount;\n  private Date creationTime;\n  private Date updateTime;\n  \n  private QuestionStatus status;\n  private Member askingMember;\n  private Bounty bounty;\n  \n  private List\u003cComment\u003e comments;\n  private List\u003cAnswer\u003e answers;\n\n  public boolean close();\n  public boolean undelete();\n  public boolean addComment(Comment comment);\n  public boolean addBounty(Bounty bounty);\n\n}\n\npublic enum QuestionStatus{\n  OPEN,\n  CLOSED,\n  ON_HOLD,\n  DELETED\n}\n```\n\n# Badge, Tag, Notification\n```java\npublic class Badge {\n  private String name;\n  private String description;\n}\n\npublic class Tag {\n  private String name;\n  private String description;\n}\n\npublic class Notification {\n  private int notificationId;\n  private Date createdOn;\n  private String content;\n\n  public boolean sendNotification();\n}\n\n```\n# Comment, Answer\n```java\npublic class Comment {\n  private String text;\n  private Date creationTime;\n  private int flagCount;\n  private int voteCount;\n\n  private Member commentedBy;\n\n  public boolean incrementVoteCount();\n}\n\npublic class Answer {\n  private String answerText;\n  private Date creationTime;\n  private boolean isAccepted;\n  private int voteCount;\n  private int flagCount;\n  \n  private Member answeredBy;\n  \n  public boolean incrementVoteCount();\n}\n\n```\n\n# References :\nhttps://www.educative.io/courses/grokking-the-object-oriented-design-interview/m2YWoEq06AR\n\nhttps://www.youtube.com/watch?v=eTB0nxb-j-Q\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fdesign-stackoverflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Femahtab%2Fdesign-stackoverflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Femahtab%2Fdesign-stackoverflow/lists"}