My app is based on 8 concepts and 8 corresponding data model:
User, Websession< User >, Post or Diary< User >, Point< User >, Comment< Post|Comment,User >, Friend< User >, Tag< User >, FriendSuggestion< User >
Data Model
Concept | User |
---|---|
purpose | info about users |
states | username: set User-> set (Username, Password) |
Concept | Websession |
---|---|
purpose | info about an authenticated session |
states | username: one Websession -> one User |
Concept | Diary |
---|---|
purpose | Info about the diary |
states | post: set Diary-> set (Content, Image, User) |
Concept | Point |
---|---|
purpose | Info about users' points |
states | points: set Point-> set User |
Concept | Comment |
---|---|
purpose | info about a comment on another comment or a post |
states | comments : set Comment -> set (User, Content, Target:Comment |
Concept | Friend |
---|---|
purpose | info about friendship |
states | friend: set User -> set User; friendRequest: User -> (User,status) |
Concept | Tag |
---|---|
purpose | Info about tags |
states | tags: set User -> set [ String ] |
Concept | FriendSuggestion |
---|---|
purpose | Info about similar users |
states | suggestion: set User -> set [ User ] |
Github and Deployment
https://github.com/amirika20/backend
https://backend-one-puce.vercel.app/
Design reflection
I ended up bringing up one concept that I removed after the converging step, FriendSuggestion. I had a discussion with one of the TAs for assignment 3, and we concluded that the concept of friend and friend suggestion can be merged. The reason was I thought I did not need to define any state for friend suggestion, and I would be able to simply add an action to my friend concept. However, when I was implementing this action, I noticed that for friend suggestions some information from the Tag concept is needed, and I do not want to generate that every time a user requests a friend suggestion. Thus, I brought back the friend suggestion concept to my design so that I could store users who are similar to each other in a different data model. Additionally, since I need to get access to users' posts, I added actions, like enabling/disabling friend suggestions. By adding such actions, users can decide whether they permit me to process their information or not.
Also, while I was implementing the point concept, I decided to merge that with my user concept because simply I could add one more state for each user to store their points. However, I discussed this with a TA, and I decided to keep the point as a separate concept because it makes testing easy, additionally, if I want to add a new action in the future, I would need to change a few things.
One thing that I enjoyed in this assignment was integrating OpenAI API into my social app. In my second assignment, I wanted to integrate GPT into almost all of my concepts. However, in assignment 3 I noticed that this might be challenging to implement, and I even decided to use a deterministic algorithm for tag generation and friend suggestion. Nonetheless, I tried implementing OpenAI API for my Tag concept, and I found it easy and exciting.