4 ms·
Edit: local college, not logical college. Hi. I volunteer at my local college as a Computer science Tutor. Your teaching applied programming, so I would, unl
by lsiebert 14y ago
Edit: local college, not logical college.
Hi. I volunteer at my local college as a Computer science Tutor.
Your teaching applied programming, so I would, unless it's a requirement, avoid most discussions of how things work, beyond the fact that the programming language is a way to write instructions that get the computer to do something.
I'd emphasize that loops, if/else, comparisons, boolean logic, arrays etc, are all composable, and you can build really complex things with them by combining them, just as you can build really complex equations by combining simple mathematical functions.
Then get them writing functions. I'd introduce them to a function the first day, and explain that code is broken up into functions, because they are composable, testable, reusable, and allow the writer to focus on getting a specific task correct.
Get them printing stuff the first day, and reading input in from a file, not just a keyboard. These are essential for any scientific work. I'd provide ways to read in files of different formats... I'm not sure what computational biology generally uses, but you might want a csv and a plain text file.
I'd then do if/else which lets you talk about boolean logic.
Teach them about nested if statements.
Then I'd move on to loops and arrays.
Teach loops tied to arrays. They are almost always used together anyway. Teach multi dimensional arrays as arrays of arrays, generally gone through with nested loops.
Post useful code for them to download and read, with comments on what each line does. Challenge them to modify it to do something different but related. Talk about how to debug code.
Talk about binary searches... I'd mention them first as a way to debug code, then introduce them later.
Show how to write function to find a minimum value in an array. Matlab probably has this, but show them it, because the fact that you initalize the comparison to first element and start comparing with the second, and not just initialize to 0 or something isn't obvious. I often see people have this issue.
show how to write a function to exchange values, if that requires a temporary variable in matlab.
show them how you can put those functions together and make a simple sort.
The truth is that for most actual things they will do while working, until they understand MatLab well enough to write their own stuff, they will be googling code and modifying it, so get them in the habit of reading code to understand what is going on, and modifying it.
Teach them to comment their code. Teach them to try to think about the steps involved before they code too much... try to get them writing down what they are going to do, and implementing it.
Oh and finally, have them write code, and then review it, or (easier for you) peer review it. Getting comments on code helps more then merely copying other's styles, because then they learn why you would do something.