Professional Documents
Culture Documents
Problem Statement
A thunderstorm brought you back into reality after a nightmare. You got up to wash your
face, as you'd been sweating a lot while sleeping. You looked into the mirror and were
startled to see Mark Zuckerberg, the founder of Facebook, in the reflection. You couldn’t
look for your phone, but there was a calendar and a laptop on the desk. The calendar
shows the year 2004, and a sticky note was pasted on the laptop with the words “Modify
Facemash!” You subconsciously sat on the chair and began drafting and brainstorming
for a brand new idea “TheFacebook”.
1
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
First things first, you need to use certain data structures for the new application. Without
them, you won’t be able to help people connect with each other, search for new friends,
and get friend recommendations from mutuals on your new application.
The hardest problem here is to find the mutual friends between two persons, as the
data structure implemented must be suitable to check for the relationship between one
and another consecutively until two targets are found in the same “friendship line".
2
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Note: Any implementation of DBMS like MySQL will be counted as an extra feature.
What’s a social media account if you don’t need to include your name, birthday, and
other information? Where's the fun in that? You want other people to see your details,
so you need to set up your account by including some important information, such as
Name, Username, Email Address, Contact Number, Birthday, Age (can be
calculated from birthday), Address (hopefully not the entire address), Gender,
Number of Friends, Hobbies, Jobs, and other relevant and useful information about
yourself using the knowledge you have learnt for Object-Oriented Programming concept
(OOP). All the examples given are merely for your reference and are not mandatory to
implement. However, it must be sufficient to prove the identity of a person.
Note: There are a lot of different approaches which you could use to design the object
creation for User Account. For example, using the knowledge that you have learnt in
Abstraction. By using Abstraction, you could implement Factory Design Pattern, Builder
3
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
pattern and so on. No marks will be given for wrong implementation of User Account
Object creation.
If you have implemented Factory Design Pattern or other alternatives to create different
types of account, that will be an extra feature as well if you could manage to explain it.
Besides that, while editing your account, you are required to display the options for
multiple-choice fields and demonstrate which data structure you are using to store the
selections. For instance, while selecting your hobbies, you may display the selections
from an ArrayList; to display your current and previous jobs, you may use a stack to
store the information to show your latest job experiences at the top. You are required to
justify your data structure selection using comments in your code.
4
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Note: However, before you start working on the connections/relation between users,
make sure you have considered which data structure will help in reducing the
complexity to implement the connection in order to make searching, friend suggestions,
effective and efficient.
Optional: if any other roles come to mind, feel free to add them with complete
functionalities (e.g., parental control).
Not only that, you are required to display the search results in sorted order. For
example, there are four users named Clarice in the database: Clarice Phillip, Clarice
Wong, Clarice Hudson, and Clarice Harrington. Your search query of “Clarice” should
display the search results in this order:
1. Clarice Harrington
2. Clarice Hudson
3. Clarice Phillip
4. Clarice Wong
5
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Note: You may implement the user’s privacy functionality to allow others to view the
details of the user according to the user’s privacy settings. For example, you may
include a special feature such that the user only wishes his phone number to be viewed
by 2nd-degree connections (refer to Enhanced Networking in Extra Features). This may
be counted as an extra feature.
Tips: You may implement this function by using the shortest path algorithm; however,
you are not limited to using only this method.
You decided to implement this using LinkedList. TheFacebook will keep track of your
user session by storing your interactions with the program, and if you accidentally leave
the content, you are still able to track the history of your interactions and continue where
6
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
you left off. Your interaction includes the type of content and the content itself (or the
reference to the particular content).
To save on memory, this feature will only store the LinkedList of interactions for that
particular session only, and will not be stored in the database. The LinkedList of
interactions will be emptied when the session ends (the program ends or the user logs
out).
**Warning**
You are NOT ALLOWED to use java.util.HashMap directly, but instead you may create
your own implementation that is similar or identical to HashMap using the knowledge
about generics you have learned to prove your understanding but not copying.
Each of these basic requirements must be in the form of modules (separated into
pages and navigable) rather than a solely sequential program (the program should not
end after execution and can only be ended on command). You can group different
modules the way you want, as long as it makes sense.
7
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
8
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Chats
Why pay for SMS or wait for emails when you can message in real-time over the
Internet for free? The user should be able to choose a friend to initiate a chat with them.
Optional: The user can also add two or more friends into a brand new group chat so
that no one gets left behind!
Database
An application without a database is like a library without books. Use a database to
store all information created on TheFacebook with a reasonable design. You may use
either a SQL or NoSQL database. (You don’t have to adhere to best database practises;
reasonable means working smoothly without causing data storage or retrieval problems)
Data Analysis
In this day and age, information is everything when doing business. You know that in
order to improve your application, you need more data from the users regarding your
own product.
9
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Implement data analysis by:
1) Allow your application to generate a summary report. (For instance, total number
of active users, comparison of the number of users by time period [ For example,
last month vs this month ] , total number of users based on categories such as
gender, address, age and more…) (Any that is applicable and proven useful for
data analytics)
2) Generate the report as a .txt file or .csv file in order to carry out further analysis. //
Provide visualisation or an actionable insight based on the summarised
information. For example, drawing graph in the application or display useful
messages such as “The active user this month has decreased, this is possibly
due to the update feature in Patch 2.0 which are: 1) Banning all users who used
inappropriate wordings in their profile…“)
Enhanced Networking
Since you are from the future and you’ve used LinkedIn before, you know about the
Degrees of Connection feature and would like to implement it on TheFacebook. You are
required to label other users accordingly. For example, if you added Harith, he would be
labelled as your “1st” degree connection. If Harith has a friend named Dinesh and you
have not added Dinesh, Dinesh would be your “2nd” degree connection. If Wong is a
friend of Dinesh and not you, Wong would be your “3rd” degree connection.
With this implementation, you are also required to provide friend recommendations to
users with priority (i.e., more 2nd-degree connections are recommended than
3rd-degree connections). Imagine a scenario, A (10 mutuals), B (5), C (6), D (12), E (9),
F (1), G (6) are your 2nd-degree connections, while H (mutual of 3 second-degree
connections), I (5), J (7), K (1), L (2), M (1), N (2) are your 3rd-degree connections, your
recommendations should show some sort of priority to 2nd-degree connections and
also sort them based on the number of mutuals they have. An example would be to
provide recommendations in this order: D, A, E, J, C, G, B, I, F, L, N, K, M.
10
Group Assignment Topic 2 (The Facebook)
WIA/WIB1002 Data Structure S2, 2022/23
Special Note: Apart from the extra features listed in this document, feel free to include
any other relevant extra features that spark your interest!
Tips or Recommendations
1. Try to utilise as many suitable data structures as possible for the features. It is also
important to note that OOP practices are recommended to structure your code base
better.
2. The graph data structure is recommended for anything related to networking.
3. It is recommended to study about Breadth-First-Search (BFS) to search within the
user’s social network.
11