forked from responsibleIT/Social-Network-Simulation
-
Notifications
You must be signed in to change notification settings - Fork 1
Oplossing & Code
Joppe Koops edited this page Jun 13, 2024
·
9 revisions
- Algemeen hoe we code schrijven -> object oriented
- Code conventions
| Class | Explanation | Methods |
|---|---|---|
Node() |
Represents a node in the network. |
draw(context), switch(state), linkHandler(node), friendsHandler(friendNode), itemHandler(item)
|
Person() extends Node()
|
Represents a person in the network. |
addFriend(friendNode, links, score), addItemLink(itemNode, node, links, score), addInfoLink(infoLinkNode, node, links, score)
|
Post() extends Node()
|
Represents a social media post in the network. | |
Edge() |
Represents an edge (connection) between two nodes. |
drawLink(startPoint, endPoint), calcAngle(pointA, pointB)
|
UserData() |
Handles user data and post data, fetching both fake and real data from APIs. |
fetchUserData(url), get(key), getPosts(userId), fetchPostData(postId), fetchRealPostData(postId), xmlToJson(xml), filter(criteria), reduce(callback, initialValue)
|
WebData() |
Manages web-related data like battery status and time updates. |
updateBatteryStatus(status), getBatteryStatus(), updateTime()
|
FileHandler() |
Handles importing and exporting of network data. |
mapToArray(map), export(nodes), import(nodes, links)
|
Cursor() |
Manages cursor state and appearance. | switch(type) |
-
📄 Debrief
-
🧑🎨 Design
-
🧑💻 Solution & Code
- 🎛️ App (main file)
- 🤖 Simulation
- 🔵 Node
- 🙋 Person
- 📰 Post
- 〰️ Edge
↖️ Cursor- 💽 userData
- 📊 WebData
- 📂 Import & Export (FileHandler)
- Onboarding