1 of 13

Data Modeling

& Getting Started

COMP423 CL26. Mar 22, 2023

Sit at your team’s table!

(Same Zone + # as your team name.)

go.unc.edu/comp423-23s-squads

2 of 13

Team Seating

Your team’s name is the same as your assigned team table in this classroom.

Moving forward, at the start of class, write a team member’s first and last names on each corner of the whiteboard that corresponds to their seat at the table. Top corner names should be teammates sitting closest to the whiteboard.

These boards will be placed in a holder that is facing a walkable aisle:

  • Middle and back tables in a Zone, whiteboard faces front of room
  • Front tables in a zone, whiteboard faces back of room

We are taking individual attendance and individual attendance will be factored into individual final project sprint scores and grades.

3 of 13

Announcements

Fix to GitHub Team Repository Settings:

Branch protection of `stage` branch: Uncheck “Lock branch”!

Next reading: Google Engineering Practices Code Review Guidelines

Due Friday 3/24

Sprint 0:

Due Friday 3/31

Sprint 0 Deployment Instructions:

By Monday 3/27

GitHub Phone App:

Very good for collaboration purposes! Notifications on comments / code reviews, etc.

4 of 13

Grading Breakdown

Original:

50% - Final Project

30% - Homework

(Readings, Exercises)

10% - In-class Activities

10% - Quizzes

Revised:

50% - Final Project, roughly:

~10% - Sprint 0

~10% - Sprint 1

~10% - Sprint 2

~20% - Final Deliverable

30% - Homework

(Readings, Exercises, PD)

10% - Participation pre-SB

10% - Participation post-SB

5 of 13

Final Project Grading

Grades for all Sprints and Final Deliverable have individual and team components.

This is a team effort.

  • Failing to show up for your team and meaningfully contribute to the best of your ability is failing your team. Show up for your team members.
  • Trying to be heroic and carry your team as the individual contributor is also failing your team. Collaborate with your team members!

Team members may receive VERY different grades for the final project components.

Sprints and Final Projects are weighted toward QUALITY not quantity or scope.

  • Failing to implement the full feature set you set out to is OK, but meaningful progress, adherence to team process, and quality work (code, documentation, tests, pull requests, code reviews) committed to the project is required.

6 of 13

Access Control Model

User

id

int

first_name

str

last_name

str

pid

int

roles

list[Role]

permissions

list[Permission]

Permission

id

int

action

str

resource

str

Role

id

int

name

str

users

list[User]

permissions

list[Permission]

7 of 13

Whiteboard Data Modeling

  1. Think about the data models and each model’s attributes of your feature�
  2. For each model, create a table on a whiteboard with the model’s name as the title and two columns with a row per attribute of the model:
    1. Name
    2. Data Type�
  3. Draw arrows of dependency between models. In general:
    • Unidirectional (‘one-to-many’) relationships are preferable!
    • Bidirectional relationships require more careful handling.�
  4. One member of the team will use the GitHub Mobile App to take a photo of the data models and Create an Issue on your Final Project titled:�“Implement Data Models” with the photo attached.�
  5. After creating the issue, be sure it is added to your Project’s Board.

8 of 13

Tips on Getting Started with the Final Project

  • Focus on Data Models First and Start Simple
    • Agreeing on model set and each model’s attributes can unlock Frontend, API and Backend work to happen in parallel.
  • Specify the interfaces between layers! These are the contracts.
    • Wireframe Sketches of UI (user <-> app layer)
    • REST API Routes (method + uri + body data in post/put) (front-end <-> api layer)
    • Backend Services API (api <-> service/database layer)
  • Work layer serving “upward” first
    • Front-end: Start with Angular routes, Components, static data/hardwired event handling without backing services
    • REST API Routes: Respond with faked data that adheres to the API spec
    • Backend Services: Implement Services API connected to database (you are not blocked on the data layer!�
  • Then collaboratively integrate between layers!

9 of 13

Goals for First Sprint

  1. “Minimum Viable” Data Models, Entities, and Dev Data merged to `stage` branch via the `backend/script/reset_database.py` script. (More on this…)�
  2. Implement at least one Pressing Story across all layers running in cloud Stage env
    1. Aiming for a “view” story here makes the most sense, e.g. viewing upcoming workshops, viewing a list of clubs, viewing list of rooms with availability, etc.�
  3. Everything committed for #2 is properly documented, tested, and up to standards.�
  4. Everyone makes at least one Pull Request that has an improvement commit after at least one round of Code Review Comments and is Approved and Merged into Stage.�
  5. Everyone performs at least one Code Review that involves Requesting Changes on a team member’s Pull Request.

10 of 13

Use Material UI Components: https://material.angular.io

  • We are standardizing on Google’s Material UI
    • Uncoincidentally, it pairs really nicely with Google’s Angular Framework�
  • You may still have needs for custom CSS, but for common UI elements please default to the Material Implementation first
    • Buttons, Form Controls, Autocomplete Inputs
    • Popups, Modals, Dialogs, Snackbar, Bottom Sheet
    • Icons, Badges, Tabs, Chips, Menus�
  • Explore each of the components available and check out its Examples page
    • When doing wireframes of views/stories, you should default to wireframing in terms of Material Components

11 of 13

Development Data

  • When working on features, it speeds development to have mock data loaded into the system and easily reset back to.�
  • Our project has a script to entirely drop and reset the database with mock data: `backend/script/reset_database.py`�
  • It creates baseline Users, Roles, and Permissions whose contents are defined in the backend.script.dev_data package’s modules.�
  • Once you have your backend models committed to in `backend`, a team member working on the services layer can begin working on creating the entities, adding additional modules to dev_data, and modifying the `reset_database.py` script to load the data.

12 of 13

Authentication via Bearer Tokens

Routes in your backend are likely to become protected by some combination of:

  • User Authentication (Is this a logged in user in the system?)
  • User Authorization (Does this user have permission to access this route?)�

We will discuss Authentication and Authorization in more depth soon, but you can find examples of it in the web app code for the admin routes.

To use the OpenAPI /docs Tool with Authenticated Routes:

Login to your dev front-end

Go to Developer Tools

Select Application > Storage > Local Storage > localhost:1560

Copy the Value (this is a JSON Web Token)

In /docs, click the Authorize button and paste in the token value.

13 of 13

Team Time

  • What will you each make progress on ahead of Friday’s stand-up meeting?
    • Pairs or solos?