Skip to content

Assignment 4 Beta

Abstract Data Models:

User

State:

  • users: set User
  • username, password: registered -> set String

Session [UserAccount]

State:

  • active: set Session
  • user: active -> one UserAccount

Friend [UserAccount]

State:

  • friends: set Friend
  • requests: set FriendRequest
  • user1: UserAccount
  • user2: UserAccount
  • from: UserAccount
  • to: UserAccount
  • status: String

Book [UserAccount]

State:

  • books: set Book
  • title: Book -> one String
  • author: Book -> one String
  • description: Book -> one String

Folder [BookItem, UserAccount]

State:

  • folders: set Folder
  • name: String
  • owner: UserAccount
  • contents: set BookItem

Rating [BookItem, UserAccount]

State:

  • ratings: set Rating
  • book: BookItem
  • user: UserAccount
  • value: Number

Recommendation [BookItem, UserAccount]

State:

  • recommendations: set Recommendation
  • userFrom: UserAccount
  • userTo: UserAccount
  • book: bookItem

Invitation [BookItem, UserAccount]

State:

  • invitations: set Invitation
  • userFrom: UserAccount
  • usersAccepted: set UserAccount
  • book: BookItem

App definition:

app BookClub:

include User

include Session [User.User]

include Friend [User.User]

include Book [User.User]

include Folder [Book.Book, User.User]

include Rating [Book.Book, User.User]

include Recommendation [Book.Book, User.User]

include Invitation [Book.Book, User.User]

Data Modeling Diagram:

Data modeling diagram

Website and code:

Deployed website: https://bookclub-one.vercel.app

Link to code: https://github.com/juliacamacho/bookclub

Design Reflection

I found that the process of creating my data model diagram greatly helped clarify my understanding of my concepts and helped me reorganize them more effectively. After realizing that I needed to link concrete types by their fields relating them to one another, rather than trying to link the concepts themselves to one another, I decided to update my concept states to reflect that. For instance, instead of the state of my Recommendation concept containing recommendations: User -> set Items, User, I changed it to recommendations: set Recommendation and added states of userFrom, userTo, and book. Additionally, I decided to simplify invitationsPosted and invitationsReceived in my Invitation concept to just invitations, which I could then query more specifically.

Furthermore, I realized that much of the information I was trying to represent as concepts and store across various states were rather just UI-related groupings. For example, I chose to remove my Profile concept because although it could potentially contain more user information beyond the state stored in User, I had mostly just been using it to redundantly store information related to Recommendations, Invitations, Folders, and Ratings. I improved my modularity by containing all of the book or user-related actions (updating the information about these aforementioned aspects) within the other concepts rather than trying to involve all of the other concepts within Book or User/Profile.