184_notes:comp_process

This is an old revision of the document!


Coding: Group Process for Computational Projects

Our in-class coding projects are unique, and require different group strategies than an analytical or design project. In this page of notes, we'll lay out some strategies for success when coding with your group.

Making a plan is just as important for coding as it is for hand-written calculations. Without one, it's easy to get lost and turned around. One of the best ways to plan for coding is using pseudocode.

Pseudocode is a simple way to plan out the process or steps the computer should follow. When writing pseudocode, don't worry about using exactly the right names or calculations. Instead, focus on an overview and write out in words what the computer should do. For example, the following is pseudocode for numerically computing an integral:

define bounds
sum = 0
while x is in bounds:
    evaluate function at x, multiply by dx
    add to sum
    increment x

Talk through what each step should do as a team, and rework your pseudocode until it seems correct. Once you have some solid pseudocode written out and agreed on as a team, it's easy to convert it to code and test your program. Trying to make changes to a full code program is much more complicated than rearranging some pseudocode.

We'll often provide you with a minimally working program to build on top of. On these days, it's very important to figure out exactly what the provided code is doing, and where your team needs to edit the program. Read through the code as a group, and after each line add a comment that says in words what that line is doing. In python, anything on a line after an octothorpe (#) is considered a comment, and the computer will ignore it. These comments will likely be very similar to what pseudocode for the program would look like.

x = 0           # initialize x
bound = 10      # define bounds
sum = 0         # initialize sum
dx = 1          # determine size of little piece
while x < sum:  # while x is in bounds
    val = (5*x) * dx    # evaluate function at x, multiply by dx
    sum += val  # add to sum
    x += dx     # increment x
  • 184_notes/comp_process.1650469569.txt.gz
  • Last modified: 2022/04/20 15:46
  • by woodsna1