Due: Tuesday, November 23rd, 2021 at 9:00PM EST.
The goals of this assignment are to:
import pytest
at the top of your hw7_test.py
fileYou will be submitting two separate files to Gradescope under Homework 7:
tracing.txt
, tracing.pdf
, or tracing.png
with your answers to the "Memory Tracing" section exerciseshw7_test.py
, which will contain the testing function from the "Testing Under Mutation" sectionIn addition, the final SRC assignment for the course will be provided on this handout to help you plan your work as we near the end of the course. You have until the final project deadline to turn in that work, but you are welcome to finish it now if you prefer. This work will get submitted to Gradescope under "Final SRC".
You can submit your answers to this either written in a text file, drawn in some tool that saves to pdf, or as a photograph of work done on paper. Name your file tracing.txt
, tracing.pdf
, or tracing.png
accordingly.
Here is part of a program for managing orders in an online store, offering our space travelers some of the creature comforts of home. There is a data structure for the Items
for sale, as well as a catalog of all items. There is a data structure for Orders
, which capture the name of a customer and a list of items that the customer wants to buy. There are also two versions of a function to update the price of an item in the catalog.
At the bottom of the file is a sequence of expressions to evaluate.
Task: Without running the program, predict what will be in each of k_order
and m_order
(items and their prices) after the four expressions evaluate (you won’t lose points for an inaccurate prediction – the point of the question is to help you calibrate your predictions against the memory contents.) Write down your answers.
Task: There are four comments in the code marked "Memory point". Show the contents of memory (known names and memory) at each of these four points, as we did in lecture on Wednesday 11/17. Write your answers to the first task (the answer predictions) in/on whichever file you are submitting with your memory diagrams.
You can write these in a text file or draw (and scan to PDF or png) pictures of memory drawn on paper. Just make the information for each memory point is clearly labeled so we see which memory layout goes with each point.
The online space store code contains two versions of a function called update_price
. Assume we want a version of this function in which changes in price reflect in the catalog, but not in any orders that are still open.
Task: Write a list (in prose/your own words) of the changes that you do and do not expect to see after a price is updated. Put this in a comment at the top of your testing file. Python doesn't have block comments, so just use a multi-line string via #
.)
Task: Use your list to write a test function test_update_price
(using pytest
assertions).
Your function will need to set up some data (catalogs, items, and orders), make one or more calls to update_price
, then run a series of assertions to check the impacts of the update_price
call on the data. The general form of your function should be as follows:
You are only writing a test function for this question. You are NOT writing code for update_price
itself. The goal of this question is to see whether you are understanding how to test the behavior of a function that updates data.
You can complete and submit this portion anytime between now and the final project due date in December. Use Gradescope assignment "Final SRC" to upload your answers on this question. Put all answers in a single text or PDF file.
For this final SRC assignment, you will read a couple of articles from the Wall Street Journal's Facebook Files series and a couple of articles about ways we as a society might respond to some of the recent impacts from technology. You'll also answer some questions based on those readings.
Read these articles from the WSJ series:
Task: Choose one of the issues identified in the Facebook files (based either on one of the links we gave you or another one in the series) and answer the following questions:
Task: In less than 200 words and using at least three supporting pieces of evidence, discuss the ongoing ability for people inside and outside technology companies to participate in shaping the digital space that is shaping them.
Facebook claims that the solution to its problems lies in more artificial intelligence:
Others believe that we need to rethink the design of our current socially-oriented technologies.
Task: Read/watch all three pieces. Then, pick a substantive suggestion from one of them that would move us past a model of clicks and attention. Describe the suggestion and its underlying design goal (instead of clicks and attention). Then, identify multiple threats that the corresponding speaker/author didn't mention (in other words, what could go wrong?).
Space Traveling [Lo-Fi / Jazz Hop / Chill Mix] by The Jazz Hop Café.
Brown University CSCI 0111 (Fall 2021)
Do you have feedback? Fill out this form.