Making a UML Class Diagram for a web forum

class-diagramuml

I am trying to make a forum which has users who create topics in various categories. Other users can post replies
these are my tables below

categories
  id 
  category_title
  category_description
  last_post_date
  last_user_posted

posts
  id
  category_id
  topic_id
  post_creator
  post_content
  post_date 

topics
  id
  category_id
  topic_title
  topic_creator
  topic_last_user
  topic_date
  topic_reply_date
  topic_views

users
  id
  username
  password
  email
  forum_notification

Im having a problem creating a uml class diagram for my forum but im kind of confused i can up with one diagram below for users but i do not know how i can create the rest

  ┌─────────────────────────┬
  │  Users                  │
  ├─────────────────────────┬
  |username: String         |
  |password: String         |
  ├─────────────────────────┼
  |+logIn()                 |
  |+logOut()                | 
  ├─────────────────────────┼

Best Answer

First of all you should know that you need to do some more "Behavioral Diagrams" that show what should happen on the system, to give a deeper understand about how to design the "Structure Diagrams" which describe the system more technically if I should say. Example of behavioral diagrams are Use Case diagrams and Sequence diagrams.

Structure diagrams show the things in a system being modeled. In a more technical term they show different objects in a system. Behavioral diagrams shows what should happen in a system. They describe how the objects interact with each other to create a functioning system.

Then we have to go through your question, "Class Diagram", in brief

Class diagrams show the classes in a system, attributes and operations of each class and the relationship between each class. In most modeling tools a class has three parts, name at the top, attributes in the middle and operations or methods at the bottom. Different relationships between diagrams are show by different types of Arrows.

As an example

  ┌─────────────────────────┬
  │  Users                  │
  ├─────────────────────────┬
  │id: int                  |
  |username: String         |
  |password: String         |
  |email: String            |  
  |forum_notification: bool |
  ├─────────────────────────┼
  |+logIn()                 |
  |+logOut()                | 
  |+Reqigster()             |
  |+CreateTopic()           |
  |+EditTopic()             |
  |+AddNewPost()            |
  |+EditPost()              |
  |+DeletePost()            |
  |+SendMessage()           |
  |+ReportIssue()           |
  ├─────────────────────────┼
            | ..1
            |
            |
            |
            |
            | 0..*
  ┌─────────────────────────┬
  │  Posts                  │
  ├─────────────────────────┬
  │id: int                  |
  |category_id: int         |
  |topic_id: int            |
  |post_creator: int        |  
  |post_content: String     |
  |post_date: DateTime      |
  ├─────────────────────────┼
  |+PostDelete()            |
  |+PostUpdate()            | 
  |+UpdateContent()         |
  |+GetViewers()            |
  |+ChangeCategory()        |
  ├─────────────────────────┼

On posts class you will keep working by linking that Class with Categories and topics classes and so on. beer always in mind that you should think about the relation between all your entities.

Good luck.

Related Topic