Skip to main content

Skills

This course will teach the following skills, repeated assessment of which will form the primary source of final grades.

Each skill will be assessed as "Doesn't meet expectations", "Approaching expectations", and "Meets expectations", and students may attempt any skill assessment up to five times (four independently, and once via the bulk assessments, see below), with the best result being used for their grade.

  1. Design Basic Functions (Pyret)
    Meets Expectations• Correct type annotation
    • Docstring that describes behavior, doesn't repeat type annotation.
    • A few (2+) correct, meaningfully different tests
    • Well-formatted, correct implementation:
        • may include numbers, strings, if (NOT images)
        • minor typos are okay
    Approaching Expectations• Missing docstring, or long, includes redundant type information, etc.
    • 1+ correct tests.
    • Correct implementation.
Examples

Sample question: Design a function nm-square that, given a number, returns the result of multiplying the number by itself.

Answer meeting expectations:

fun nm-square(n :: Number) -> Number:
doc: "Multiplies the input by itself"
n * n
where:
nm-square(-1) is 1
nm-square(0) is 0
nm-square(2) is 4
end

Answer approaching expectations (docstring, insufficient tests):

fun nm-square(n :: Number) -> Number:
doc: "Takes a number as an argument and returns a number. The result is what you get when multiplying the first number by itself."
n * n
where:
nm-square(1) is 1
end
  1. Construct / Transform Tables (Pyret)
    Meets Expectations• Function designed has signature, docstring, and at least one test
    • Function uses correct table function (filter-with, build-column, etc)
    • Row helper does what is expected, whether defined with lam or named
    Approaching Expectations• Function uses correct table function (filter-with, build-column, etc)
    • Row helper accesses fields from row, but not in a way that solves the problem
Examples

Sample question: Design a function find-scholars that takes a table of students with "name" and "campus" columns and returns a new table containing only the students whose campus is not "Boston".

Answer meeting expectations:

fun find-scholars(t :: Table) -> Table:
doc: "Find students not in Boston"

fun is-scholar(r :: Row) -> Boolean:
r["campus"] <> "Boston"
end

filter-with(t, is-scholar)
where:
students = table: name, campus
row: "Ajay", "Oakland"
row: "Jason", "Boston"
row: "Lauren", "London"
end

result = table: name, campus
row: "Ajay", "Oakland"
row: "Lauren", "London"
end

find-scholars(students) is result
end

Answer approaching expectations (missing docstring, incorrect row helper, no tests):

fun find-scholars(t :: Table) -> Table:
fun is-scholar(r :: Row) -> Boolean:
r["campus"] <> "Boston"
end

filter-with(t, is-scholar)
end
  1. Iteration: Lists (Pyret)
    Meets Expectations• Uses for each properly, drawing elements from the list
    • Mutates a single variable within the loop to correctly accumulate the result
    • Returns the final result after the loop
    Approaching Expectations• Uses for each, drawing elements from the list
    • Either: Mutates within the loop, but in such a way that doesn't produce the correct accumulated answer, or doesn't use the final result properly at the end of the loop
Examples

Design a function list-of-squares that takes a list of numbers, and returns a list where each element is the square of N where N is the element from the list. You must use for each, rather than a built in list function or recursion.

Answer meeting expectations:

fun list-of-squares(numbers :: List<Number>) -> List<Number> block:
doc: "produce the squares of the numbers in the input"

var result = [list: ]

for each(n from numbers):
result := result + [list: n * n]
end

result
where:
list-of-squares([list: ]) is [list: ]
list-of-squares([list: 5, 6]) is [list: 25, 36]
list-of-squares([list: -1, 0, 1]) is [list: 1, 0, 1]
end

Answer approaching expectations (doesn't use the final result properly):

fun list-of-squares(numbers :: List<Number>) -> List<Number> block:
doc: "produce the squares of the numbers in the input"

var result = [list: ]

for each(n from numbers):
result := result + [list: n * n]
end

numbers
where:
list-of-squares([list: ]) is [list: ]
list-of-squares([list: 5, 6]) is [list: 25, 36]
list-of-squares([list: -1, 0, 1]) is [list: 1, 0, 1]
end
  1. Structured & Conditional Data (Pyret)
    Meets Expectations• Uses data with variants as needed, fields with appropriate type annotations
    • Function uses either field projection or cases as needed
    • Function has signature, doc string, and tests
    Approaching Expectations• Uses data with variants as needed, fields if needed (possibly missing or incorrect annotations)
    • Function should use either field projection or cases, but may not do it correctly, or to match the problem
  2. Recursion: Lists (Pyret)
    Meets Expectations• Function has appropriate type signature, doc string, and tests
    • Function uses cases to handle empty case and link case
    • In link case, calls function recursively on rest of list appropriately
    Approaching Expectations• Uses cases to break apart list, and has recursive call to rest of list
  3. Recursion: Trees (Pyret)
    Meets Expectations• Function has appropriate type signature, doc string, and tests
    • Function uses cases to handle base case and recursive case
    • In recursive case, calls function recursively on subtrees appropriately
    Approaching Expectations• Uses cases to break apart tree, and has recursive call on subtrees
  4. Variable Scope (Python)
    Meets Expectations• Output of given code, that uses variables, defined locally, in functions, globally, etc, is correct
    • Explanation of behavior, including global keyword if needed, is correct
    Approaching Expectations• Explanation mentions key idea, but does not use it to correctly characterize behavior
  5. Design basic functions (Python)
    Meets Expectations• Correct type annotation
    • Docstring that describes behavior, doesn't repeat type annotation
    • A few (2+) correct, meaningfully different tests
    • Correct implementation
    Approaching Expectations• Missing docstring, or long, includes redundant type information, etc.
    • 1+ correct tests
    • Correct implementation
  6. Iteration: Lists (Python)
    Meets Expectations• Uses for ... in ... properly, drawing elements from the list
    • Mutates a single variable within the loop to correctly accumulate the result
    • Returns the final result after the loop
    Approaching Expectations• Uses for ... in ..., drawing elements from the list
    • Either: Mutates within the loop, but in such a way that doesn't produce the correct accumulated answer, or doesn't use the final result properly at the end of the loop
  7. Aliasing & Mutation (Python)
    Meets Expectations• Output of given code that uses mutation of values like lists, aliasing, etc, is correct
    • Explanation of behavior is correct
    Approaching Expectations• Explanation mentions key idea, but does not use it to correctly characterize behavior
  8. Identifying Privacy Issues in Problem Formulation
    Meets Expectations• Privacy analysis chart is complete and each entry is correct
    • Identify named privacy issue in a new context
    • Proposed mitigation strategy is appropriate given context
    Approaching Expectations• Chart is complete but at least one entry is not correct
    • Attempts to identify named privacy issue but mis-identifies, or explanation is unclear
    • Proposed mitigation of known privacy issue would not address the privacy threat
Examples

Sample question: You are designing a system for a campus food service. Students can specify their dietary restrictions through a website that requires their student id, which is used to create a record containing other personal information. The resulting record can be accessed by any food service employee (full-time staff and student workers) and is searchable by all fields.

Here is an analysis of the flow of information in the context:

What type of information is shared?Personal information, including legal name, photo, phone number, address, and dietary restrictions
Who is/are the subject(s) of the information?The student
Who is the sender of the information?The student and the university
Who are the potential recipients of the information?Food service workers
intended: meal planners/preparers and managers
unintended: ???
What principles govern the collection and transmission of this information?Students provide their dietary restrictions freely while logged in with their student id, although they do not have a choice about what linked information is accessed

The principle of data minimization suggests that we limit the collection, storage, and transmission of personal data to only the data absolutely necessary to perform the task.

Using our privacy analysis, identify one unintended recipient, and also how access to data might be designed to minimize transmission.

Answer meeting expectations: One unintended recipient would be student workers, who should not be allowed to retrieve other students' photos, addresses, or phone numbers. Access to data could be minimized by making contact information available only to the manager, in case a student needs to be notified that food was mislabeled.

Answer approaching expectations: One unintended recipient would be students who don't work for the food service [incorrect] who could get private information [too vague]. Access to data could be minimized by keeping the data encrypted [does not address the privacy threat].

  1. Identifying Stakeholders in Problem Formulation
Meets Expectations• Complete stakeholder matrix that lists all relevant stakeholders and at least one relevant interest at stake for each stakeholder
• Answer identifies the specified number of conflicts between stakeholder interests/values (e.g., if the task is to identify 2 values conflicts, the answer identifies 2 values conflicts)
Approaching Expectations• If prompted to provide a complete chart, chart fails to identify relevant stakeholders OR fails to identify their relevant interests/values
• Chart does not identify relevant interests
• Identifies some, but fewer than specified number of conflicts between stakeholder interests/values (e.g., if the task is to identify 2 values conflicts, the answer identifies 1 values conflict)
Examples

Sample question: A university has a cafeteria and collects information about students' dietary restrictions, which may be due to students' health requirements or strongly-held beliefs. Below is a stakeholder matrix:

StakeholderInterest/Value
University budget managers
Vegetarians

FIRST: Complete the stakeholder matrix for cafeteria system design by identifying, and filling in, interests/values that correspond to the listed stakeholders, and, in the third case, by supplying both the stakeholder and the listed interest/value. SECOND: Explain in one or two sentences which (if any) stakeholder interests/values can come into conflict.

Answer meeting expectations

StakeholderInterest/Value
University budget managersminimizing food waste
Vegetarianshaving healthy and tasty food options
Meat eatershaving non-vegetarian food options

The interests of vegetarians and meat eaters could come into conflict because each group wants multiple options of their preferred food type, but the cafeteria can only offer a limited number of options.

Answer approaching expectations (incomplete chart, incorrect conflict)

StakeholderInterest/Value
University budget managersminimizing food waste
Vegetarianshaving soda

The interests of budget managers and vegetarians could come into conflict if they like the tastes of different types of soda.

Skill Introduction

Skills will be introduced in certain weeks (and may be re-inforced in later weeks), via class, recitation, labs, and HW. Each of these will be marked with what skill is being introduced or reinforced by the material.

Skill Assessment

Assessment of skills can be done at many different opportunities.

Assessable@Hours

Every week, there will be several special hours held by instructors, course coordinators, or graduate TAs, that exist solely for the purpose of taking assessments. The skills assessable at these hours are those that were introduced the previous several weeks -- see the table below to see what skill is assessable in any given week via this mechanism.

This is intended to allow you several attempts at the skill after the content is introduced, but require you to keep up with the material -- all assessments cannot be deferred to the end of the semester, since only the last few skills can be attempted at the end of the semester.

Skill Days

Several class days exist as gaps in our schedule, and some of the class may be used to catch up on material, but 30+ mins of class will be used for skill assessments. Instructors will bring a set of assessments -- students are able to attempt any of those available (likely, due to time, 1-2 of them). See the schedule below to see what weeks these occur in, and what skills are assessable during each one.

Skill Bundles

Finally, there are two bulk assessment slots, which take place during normal lab time, during the semester. These collectively cover all of the skills for the semester, and students are welcome to attempt all of the assessments available -- every student will be given a packet with a set of assessments when they come to the lab session. If they have already completed a given skill, they can skip that one, and if they have already completed all the skills, they are welcome to skip the bulk assessment entirely. The two bundles are:

Skill Schedule

WeekTopicSkill IntroducedAssessable@HoursSkill DaySkill Bundle
1Programming with numbers, strings, images: IDE, interactions, operations on standard values
2Definitions, functions, conditionals: type annotations, test cases1
3Ethics, intro to tables: constructing, importing, extracting2, 11, 121
4More on tables: transforming, filtering2, 11, 121, 11, 12
5From tables to lists: extracting columns, performing operations on them, visualizing data1, 2, 11, 12SkillDay1
6Computing with lists: iteration & mutable local variables32, 11, 12
7Structured & conditional data42, 3, 11, 12
8Working with trees: recursive functions53, 4, 11, 12SkillBundle1
9More with trees63, 4, 5, 11, 12SkillDay2
10Transition to Python: IDE, files, definitions, testing7, 84, 5, 6
11Transition to Python: more state & aliasing, loops, mutable data structures9, 105, 6, 7, 8
12Tables in Python: pandas & matplotlib6, 7, 8, 9, 10SkillBundle2
13File I/O: csv files, via pandas and manually7, 8, 9, 10
14More with Python: catch up, bonus content, etc9, 10SkillDay3