HomeLog InSource


[View] [Short] [Hash] [Raw]



I work at Monash University in Melbourne, Australia. Last year we moved our foundational course in data structures and algorithms from Java to Python, with great success. This is a course that used to be taught in C, then moved to Java. […]

I was talking to Klaus a while back, and he asked me about ring buffers, which were the topic of an interview question he had been hit with recently (not sure if that was from the job he eventually got or not). After I explained them, he asked me an interesting question: could they be used in Python? I was honestly caught a bit off guard because I hadn’t considered that before. I answered that you could, but generally you wouldn’t (directly).

So I was lucky to be prepared to understand this comment.

Let me cut to the chase. Computer science professors don’t understand abstraction (well enough), and thus pass on a muddled understanding to their students.

In the 21st century, we should teach data structures and algorithms by looking at them where they are actually used:

Trying to teach someone about a linked list in a language that doesn’t have pointers is just going to leave them with a very shaky understanding of… abstraction.

(I’ve accused Lisp of being high level, but its traditional data structures have been primitive, owing to its age. If you want to teach someone about linked lists, I’ll admit Lisp is a very good language to do it in.)

The move to Python gained us, among other things, the freedom not to have to explain Java’s generics and access modifiers. […] With Python, we even have time to explain idiomatic Python iterators and generators, and to discuss Python scoping rules (which come up again when we work on local variables in their hand-compilation tasks). So we still teach a bit of language-specifics, but we don’t feel we are shackled to have to teach them.

Keywords: boredom

Why Swift is 100 times slower than C in this image processing test? [duplicate]

Swift performance: sorting arrays

mweathers noticed that changing -O3 to -Ofast makes this code run almost as fast as the C++ version! However, -Ofast changes the semantics of the language a lot — in my testing, it disabled the checks for integer overflows and array indexing overflows. For example, with -Ofast the following Swift code runs silently without crashing (and prints out some garbage): […] Hence the question: how can we get a reasonable performance in Swift without losing the safety nets?


Honestly seems like an example of insufficient work ethic, or just a lack of rigor. I’m proud to say EarthFS has been designed and tested more carefully than this.

I don’t care if the language is still young. Getting this shit right is your proof of concept. Without it you don’t have a language.

Swift, you had one job.

Keywords: programming languages, tower of abstraction, optimization versus complexity, self-deception, creative process