Design stack overflow

Requirements:

  • Any non-member (guest) can search and view questions. However, to add or upvote a question, they have to become a member.
  • Members should be able to post new questions.
  • Members should be able to add an answer to an open question.
  • Members can add comments to any question or answer.
  • A member can upvote a question, answer or comment.
  • Members can flag a question, answer or comment, for serious problems or moderator attention.
  • Members will earn badges for being helpful.
  • Members can vote to close a question; Moderators can close or reopen any question.
  • Members can add tags to their questions. A tag is a word or phrase that describes the topic of the question.
  • Members can vote to delete extremely off-topic or very low-quality questions.
  • Moderators can close a question or undelete an already deleted question.

My solution:

public enum AccountStatus {
    ACTIVE, CLOSED, BLOCKED;
}

public enum VoteType {
    UPVOTE, DOWNVOTE, DELETEQUESTIONVOTE, CLOSEQUESTIONVOTE;
}

public enum BadgeType {
    BRONZE, SILVER, GOLD, PLATINUM;
}

class User {
    private int guestId;
    Search searchObj;
    public List<Question> getQuestions(String searchString);
}

class Member extends User {
    Account account;
    List<Badges> badgesEarned;
    public void postQuestion(Question question);
    public void addAnswer(Question question, Answer answer);
    public void addComment(Entity entity, Comment comment);
    public void vote(Entity entity, VoteType voteType);
    public void addTag(Question question, Tag tag);
    public List<Badge> getBadges();
}

class Moderator extends Member {
    public void deleteQuestion(Question question);
    public void undeleteQuestion(Question question);
}

class Admin extends Member {
    public void blockMember(Member member);
    public void unblockMember(Member member);
}

class Account {
    String name;
    int accountId;
    String userName;
    String password;
    String email;
    AccountStatus accountStatus;
    int reputation;
}

public class Badge {
    BadgeType badge;
    String description;
}

public class Entity {
    int EntityId;
    Member createdBy;
    Date createdDate;
    Map<VoteType, Integer> votes;
    List<Comment> comments;
    List<Member> flaggedMembers;
    public void flagEntity(Member member);
    public void addComment(Comment comment);
    public void voteEntity(VoteType voteType);
}

public class Comment extends Entity {
    String message;
}

public class Answer extends Entity {
    String answer;
    boolean isAccepted;
}

public class Question extends Entity {
    String title;
    String description;
    List<Answer> answers;
    List<Tag> tags;
    public void addAnswer(Answer answer);
    public void addTag(Tag tag);
    public List<Answer> getAnswers():
    public List<Tag> getTags();
    public void editQuestion(String title, String description);

}

Thoughts on the above solution?

Comments (2)