Pedagogical principles

Pedagogical principles

Programming can be many things. In scientific and mathematical programming the focus should be on the disciplines, not on the programming itself. Also, learning how to program Therefore we have a set of pedagical principles that you should take into account when building content for this page:

1). Easy does it: When learning a new skill, like programming, our working memory may easily be filled up. This prevents us to connect the dots and seeing the bigger picture. Therefore, use as few programming concepts as possible. This is far more important than making the code robust. Here are some examples:
-Avoid functions in the beginning if they are not strictly necessary.
-Avoid short-hand notations like a += 1.
-Try to avoid docstrings, try-except/assert and other features making the code more robust.

2). Substitute the “best” code with the basics. Examples:
-If you can use if-else to handle errors, if error-handling is too important to skip, do that.
-Stick to the way they have learned to read files (eg. Pandas) or the way they are plotting (eg. without using plots as objects). Do not introduce new libraries or ways of doing things needlessly, but feel of course free to do so if it is absolutely needed.

3). Use good variable names and helpful comments (not too many, but not too few either). All variable names should be either self-explaining or accompanied by a short comment.

4). Bring the programming, mathematics and science together. Examples:
-Try to ofte write expression as they appear in mathematics or science: \(v = v0 + a*t\) instead of \(speed = initial\_speed + acceleration*seconds\). Use comments to explain the nature and units of variables.
-Explaing the difference between ways they know how to solve things (eg. analytically) and ways they could be solved with programming (iteratively/numerically).

5). Tell a story. Write the code as a narrative with space, paragraphs and not too long “sentences”. Tell your story over more lines than over few. Example:

derivative = []
for i in range(len(x)):
    dy = y[i+1] - y[i]
    dx = x[i+1] - x[i]
    dydx = dy/dx
    derivative.append(dydx)

instead of:

derivative = []
for i in range(len(x)):
    derivative.append((y[i+1] - y[i])/(x[i+1] - x[i]))

6). Keep in mind that this is a course in how to teach mathematics and science with programming, not how to be an expert in informatics.

7). Keep in mind that the users of these courses are experts in their fields, but maybe not in programming. Some might know a bit programming, some might know a lot. Make different approaches for different teachers.

8). Use varied approaches in exercises. It is a high level skill to “make a program that…”. You can use the table below to guide you.

Teaching methods

There are many ways to teach programming. The most important thing is to take into account the goal of the teaching (learning goals) when choosing a method. If the point is to learn a programming structure, certain methods may be good, but if the point is to learn a concept in, for example, mathematics or chemistry better, other methods may be better. Here you get an overview of different methods that you can use when teaching programming.

Method

Short explanation

Use of analogies and concretes

Some concepts such as variables and objects can be illustrated with something concrete. Analogies to loops and decisions are found in everyday life.

Live programming

The teacher programs live in the classroom. Here one can e.g. ask questions along the way, ask the pupils/students to continue the code, and you may and enter (consciously and unconsciously) errors that you can troubleshoot together with your students.

Programming together

Two students together. One writes code, another dictates what the person should write.

Discuss what the program does

Give the students some code to interpret and predict the results of the code.

Fill-in

Code can be created with some lines that are missing, and that the students have to fill in, either live or as assignments.

Modify

Give code that can be altered in a specific way.

Programming puzzles (Parsons problems)

The program lines are given, but in the wrong order. The focus will be on problem solving, not syntax. Online puzzles can be used.

Flow charts

Use flow charts to systematize conditionals and logic.

Comparisons

Compare what two almost identical snippets of code do. Can be a focus on syntax or the scientific problem.

Troubleshooting

Find the error in the code when the code is given. The error can be of an algorithmic (scientific) or syntactic nature.

“Alias”

The game alias with important concepts such as variable, loop, parameter, function, conditional, etc.

Pseudocode

Informal description of a computer program. Emphasize logic over syntax. Describe or design the pseudocode yourself