Code and comments

Practical and theoretical aspects of software development

Archive for the ‘didactics’ Category

Why programmers count from zero

with 3 comments

If you are a programmer, you know that zero-indexed arrays and lists are just the right thing. Perhaps you read Dijkstra’s paper, or maybe you’ve encountered enough practical benefits to be convinced. But to non-programmers and students, zero-indexed lists seem extremely odd, and needs explanation. After all, we all know how to count, and it seems like it works OK when we start at one. What’s your good reason for starting at zero?

We have made this too complicated. While it is appropriate to have a careful answer for academic settings, we should have a casual illustration that is useful for casual inquiries. Here are my two suggestions:

Read the rest of this entry »

Written by Eric Wilson

September 21, 2011 at 4:22 am

Posted in didactics

Tagged with ,

The first thing you should know about matrices.

with one comment

When you look at NumPy, Python’s numerical library, the first object you will encounter is the ndarray, or n-dimensional array. Also known as a matrix, right? Wait, there is also a matrix class in the linalg submodule, that can’t be right. And worse, matrix is not nearly as general as ndarray, it only allows two dimensions. Is that really good enough for real-world data?

Based on experience in higher education, I’m confident that over 90% of those that have seen matrices missed the point. If you don’t know why a matrix must have exactly two dimensions, than you don’t know what a matrix really is. (So read on.)

Read the rest of this entry »

Written by Eric Wilson

September 15, 2011 at 9:52 pm

Posted in didactics

Tagged with , , ,