Project Class Diagram - bounswe/bounswe2025group10 GitHub Wiki
Here's the completed class diagram for our project, finalised in Meeting 7
And the code for the diagram:
@startuml
top to bottom direction
class ManagementSystem {
userManagementSystem: UserManagementSystem
postManagementSystem: PostManagementSystem
challengeManagementSystem: ChallengeManagementSystem
loadData(): boolean
saveData(): boolean
}
class UserManagementSystem {
users: List<User>
maxUsers: int
deleteUser(user: User): boolean
addAchievement(user: User, achievement: Achievement): boolean
deleteAchievement(user: User, achievement: Achievement): boolean
loadUsers(): boolean
getUserById(id: int): User
listAllUsers(): List<User>
}
class PostManagementSystem {
posts: List<Post>
deletePost(post: Post): boolean
deleteComment(post: Post, comment: Comment): boolean
getPostCreator(post: Post): User
loadPosts(): boolean
getPostById(id: int): Post
getPostsByDate(start: String, end: String): List<Post>
listAllPosts(): List<Post>
}
class ChallengeManagementSystem {
challenges: List<Challenge>
maxChallenges: int
createChallenge(challenge: Challenge): boolean
deleteChallenge(challenge: Challenge): boolean
changeChallengeReward(challenge: Challenge, reward: Achievement): boolean
loadChallenges(): boolean
getChallengeById(id: int): Challenge
}
class SystemAdministrator {
id: int
username: String
password: String
managementSystem: ManagementSystem
queryDatabase(query: String): Result
resetUserPassword(user: User): boolean
}
class User {
id: int
profile: Profile
login(username: String, password: String): boolean
}
class Profile {
id: int
achievements: List<Achievement>
loggedWaste: List<Waste, date>
profileImage: String
updateBio(newBio: String): boolean
logWaste(recycledWaste: Waste): boolean
getWasteForSummary(String format): List<Waste>
}
class Waste {
type: String
possibleTypes: List<String>
}
class Achievement {
id: int
title: String
description: String
getAchievementById(id: int): Achievement
setTitle(newTitle: String): boolean
}
' DatabaseHandler as a singleton
class DatabaseHandler <<singleton>> {
instance: DatabaseHandler
DatabaseHandler()
{static} getInstance(): DatabaseHandler
sendQuery(query: String): QueryReturn
}
class Post {
id: int
comments: List<Comment>
creator: User
date: String
editText(newText: String): boolean
reportPost(reportDescription: String): boolean
getCommentById(commentId: int): Comment
}
class Comment {
id: int
content: String
author: User
date: String
editComment(newContent: String): boolean
}
class Challenge {
id: int
title: String
description: String
targetAmount: int
currentProgress: float
reward: Achievement
setDescription(newDesc: String): boolean
updateProgress(newRecycle: Waste): boolean
reportChallenge(reportDescription: String): boolean
}
class TipService {
- tips: List<Tip>
--
+ listTips(): List<Tip>
+ addTip(title: String, description: String): Tip
+ likeTip(tipId: int, userId: int): Tip
+ dislikeTip(tipId: int, userId: int): Tip
+ removeTip(tipId: int): boolean
+ addTipComment(tipId: int, content: String, userId: int): TipComment
+ refresh(): void
}
class Tip {
- id: int
- title: String
- description: String
- comments: List<TipComment>
- likeCount: int
- dislikeCount: int
}
class TipComment {
- id: int
- content: String
- userId: int
- createdAt: LocalDateTime
--
+ edit(newContent: String, userId: int): void
}
ManagementSystem "1" --> "1" UserManagementSystem : has a
ManagementSystem "1" --> "1" PostManagementSystem : has a
ManagementSystem "1" --> "1" ChallengeManagementSystem : has a
SystemAdministrator --|> User : extends
User "1" --> "1" Profile : has >
Profile "1" --> "0..*" Achievement : contains >
Post "1" --> "0..*" Comment : contains >
UserManagementSystem "1" --> "0..*" User : controls
User "1" --> "0..*" Post : creates/edits/deletes
User "1" --> "0..*" Comment : writes
User "1" --> "0..*" Challenge : initiates
Post "0..*" --> "1" PostManagementSystem : requests management
Comment "0..*" --> "1" PostManagementSystem : requests comment storage
Challenge "0..*" --> "1" ChallengeManagementSystem : requests processing
Challenge "1" --> "0..*" Waste : evaluates
Profile "1" --> "0..*" Waste : logs
Profile "1" --> "0..*" Challenge : updates progress
TipService "1" *-- "1..*" Tip
Tip "1" *-- "0..*" TipComment
@enduml
- Purpose of parameter-less "getInstance" method unclear
- Inappropriate void return types
- Cardinality in "has a" relationships not specified
- Database handler class was envisioned as static class that is accessed by any class when database access or querying is needed, and getInstance accesses that global single handler instance. To make this more obvious, the class is labeled as static
- The getInstance function of SystemAdministrator is a mistake and should not exist, because we decided that SystemAdministrators are any admin profile that accesses the app, not a static class. It has now been removed.
- The output type for functions that update some system internally and doesn't output the results is now boolean, indicating whether the operation was successful or not.
- All relations specify the appropriate cardinality now.