- Chihan Cui (HermesCui)
- Qianjun Huang (cang-xue)
- Liwei Yang (Blair Yang)
- Jiawei Yu (JY3150)
- Gangquan Zhang (jasongangquanzhang)
- Xiling Zhao (Teinble)
- Jiajie Zhu (Christinjiajie)
- Yuyang Zhao (NerverSoGoodStart) (Dropped)
This ia a link to our presentation file.
Our code splitted the code into several compartments (packages), by clean architecture, being:
- Package
entities
contains all entity level classes - Package
database
contains all database-related classes - Package
use_cases
contains all use case level classes - Package
controllers
contains all controller classes - Package
presenter
contains all presenter classes - Package
UI
contains all UI level classes - Package
Exception
contains all exceptions - Package
base
containsMain
class
Our code has implemented the following test suites:
- CourseUsecaseInteractorTest
- UserUsecaseInteractorTest
- ReportUsecaseInteractorTest
- We used issues along with pull requests.
- Issues are addressed during discuss, and are resolved after suscessful implementation.
- We also used issues to assign tasks to team members.
- We use pull request to discuss and determine whether the code is in good manner and should be merged into Main.
- We also used it to perform code review to ensure code quality.
- We used auto-grading to run the tests to ensure that our code is bug-free.
We used the following design patterns in our project.
Add ActionListener and MouseListener to the UI. When the user clicks the button, our program would use the
corresponding controller to call the functions related to that action. For example, in LoginForm
, when we click
Login
, it will call UserController
loginUser
method without calling any other methods besides what methods are
used in the loginUser
.
All of our posts are stored in some courses. But when we add a post to a course, we do not pass in relevant information
and create a new post is inside of the course; rather, we pass in a post directly. This is also exhibited in posts and
comments. Additionally, in the database gateway, we need two dataHandlers
to create a gateway, instead of creating
those dataHandlers
inside this gateway
, we create them in Main class and inject them into the gateway.
Since we have many report types, it makes more sense if we could have a Report factory responsible for creating various reports. We could use a simple factory pattern here to implement this in the future.
- Our code follows a strict MVC Clean architecture, as mentioned in our slides.
- Single Responsibility Principle:
Every class in our project has only one responsibility. Every non-attributive data - Open and Closed Principle:
Our project align with the principle, as the program is easily modifiable. - Liskov Substitution Principle:
Our subclasses do not alter the behavior of the general inherited behavior. Therefore, we can safely substitute objects of the super classes by the subclasses. - Interface Segregation Principle:
We have specific interface for each task. The interfaces are small, concise. - Dependency Inversion Principle:
As long as the interface methods are implement correctly, our program runs without error.
YOU NEED TO DOWNLOAD THE JAVX.MAIL package.
User.java
is a class that is used to store the data of each individual user/administrator of the forum. It implements
the Serializable
interface for serialization.
The user object has the following attributes:
username
userid
password
email
The entity provides interfaces for other functions to modify the username, password, and email. The userid, however, is immutable once registration.
Course.java is a class that is used to store the data of each specific course registrated on the forum.
The course object has the following attributes:
name
courseCode
description
instructors
semester
posts
Most attributes for the course objects, once created, are immutable. The object only provides two functions to add/remove students.
Post.java is a class that is used to store the data of the posts in the forum.
The posts has the following attributes:
topic
texts
comments
user
likedUser
unlikedUser
The post object, once created, are modifiable, and can be commented by other user objects.
Some attributes, however, like the user who posted this thread, is immutable and viewable to everyone.
Comment.java is a class that used to store the data of each comment to a post.
The posts has the following attributes.
texts
comments
user
The comment object is very similar to a post. However, it must be attached to a post or another comment.
Comment.java is a class that used to store the data of a report of a problem in a forum to be viewed and resolved by the administrator.
The posts has the following attributes.
type
content
user
All of the information of the Report object, once created, are immutable.
Course contains all relevant posts.
User can be registered with account name, password and email but not duplicate with other users.
There is verified_email feature, which can auto sent a random code email to the user. The verified code serves as the Random method to protect user accounts.
Uses can post a Post under a course, and Post can contain the numbers of like and unlike, so that user can judge what the best relevant post is.
Administrator can send a report to modify some issue in the software.
We used three classes to handle the data, being DatabaseDataHandler
, RuntimeDataHandler
, and DatabaseGateway
.
The use cases andcontrollers interacts with DatabaseGataway
to set, get, and edit the (non-attributive) data.
DatabaseGataway
implements three data interfaces, being
CourseDataInterface
, UserDataInterface
, ReportDataInterface
.
It has the following methods that could be called for data handling:
getAllUsers()
,getAllCourses()
,getAllReports()
Which fetches and returns all of the above data from the database.getUser()
,getCourse()
,getPost()
Which gets the correspondinguser
,course
, andpost
from theirusername
,code
, andtitle
, respectively, in O(1).addUser
,addReport
,addCourse
deleteUser
, `delete
The run-time data are stored in the RuntimeDataHandler
, in the following way:
ArrayList<User> users
ArrayList<Course> courses
ArrayList<Report> reports
The actual objects are stored in these ArrayLists
. Furthermore, we
made use of Hashmaps
to achieve a better time-complexity
, and look up.
Hashmap name2User
Hashmap email2User
Hashmap code2Course
Hashmap type2Report
Using these Hashmaps
, our database provides O(1) complexity for
searching and fetching.
We serialized the data as a single object called
Hashmap<Integer, Object> Info
. The hashmap has the following structure.
key |
value |
type |
Serializable object | Non-native Attributes |
---|---|---|---|---|
1 |
all users | ArrayList<User> |
User |
null |
2 |
all courses | ArrayList<Course> |
Course |
null |
3 |
all reports | ArrayList<Report> |
Report |
user , course , Arraylist<Comments> |
CourseController can get the judgement from Course UseCase and return different integers to UI.
For example, there is three states in removeInstructor
. The method will call course UseCase to judge the exception.
- If return -1, it means not found the instructor in the courss.
- If return 1, it means successfully remove the instructor.
PostController can get the judgement from Post UseCase and return different integers to UI.
For example, there is three states in editPost
. The method will call Post UseCase to judge the exception.
- If return -1, it means not found the Post in the course
- If return 1, it means successfully edit the instructor.
ReportController can get the judgement from Report UseCase and return different integers to UI.
UserController can get the judgement from User UseCase and return different integers to UI.
For example, there is three states in registerUser
. The method will call User UseCase to judge the exception. If
return -6, which means the message contains email, otherwise return -1.
- if return -2, which means password is not correct.
- if return -3, which means is the error email format.
- if return -4, which means Wrong re-entered password !
- if return -5, which means wrong verification number.
- if return 1, which means successfully register.