From: John D'Errico on
Rune Allnor <allnor(a)tele.ntnu.no> wrote in message <6420e674-7fa2-4dae-9238-4b31b367b540(a)p9g2000vbl.googlegroups.com>...
> On 6 Okt, 14:50, "John D'Errico" <woodch...(a)rochester.rr.com> wrote:
>
> > First of all, use the capabilities of MATLAB when
> > you teach it!!!!!!!
>
> Or rather, decide if you want to teach programming
> or if you want to teach matlab.
>
> The first approach about separating the algorithm
> into small, easily understood, easily tested separate
> functions is what is considered 'best practices' when
> programming the compiled languages: The focus is on
> the human reader and maintainer of the code, the
> compiler is left to optimize away function overheads
> and so on.
>
> Matlab is not a compiled language, and thus has a
> lot of inherent bottlenecks.
>
> Just about anything that makes matlab go fast, breaks
> with what is otherwise considered 'best practice'
> programming. Which is a very good reason for *not*
> teaching 'the capacities of matlab' for newbie
> programmers.
>
> Rune

This is a good reason for teaching both styles of code
in MATLAB, then explaining why they are different.

John
From: Quentin CAUDRON on
Thank you all very much for your input !

Sebastiaan, thanks for breaking it down as you did, and for improving on what I had. Some of your suggestions are a little complicated for the new guys, but I'll definitely try to show them the improvements !
The main problem with your Suggestion 4 is the number of iterations. I've so far been using ten million - this quickly becomes a resource hog. Breaking it into blocks is great though.
I particularly like your Suggestion 6, very quick and clean !

John, I'm myself a student, just starting my PhD. I'm teaching basic computing to those with no background in programming in my doctoral training centre. Whilst I agree with your point, the idea behind this was to point towards programming practice, and the correct way to think in order to get your instructions down in code. I understand that MATLAB isn't a programming language, and that loops are slow. That was the whole point of this exercise, that was first written in C++, and then in MATLAB, with performances compared.

Rune, thanks for the wisdom, you've explained it well - I may be borrowing some of your words in my next session. What are your bank details so I can pay your royalties ? :P

Thanks again to everyone, you've been extremely helpful.
From: Rune Allnor on
On 6 Okt, 16:53, "Quentin CAUDRON" <q.caud...(a)warwick.ac.uk> wrote:

> Rune, thanks for the wisdom, you've explained it well - I may be borrowing some of your words in my next session. What are your bank details so I can pay your royalties ? :P

You can use my wisdom for free, provided you teach the students
the best practices of *programming*, not best matlab practices.

Ah, and if you add that no one should expect speed or high
capacity from any software product with 'lab' as part of the
trademark (matLAB, LABvies,...). Such SW are exactly what
the names allude to: *LAB* tools and toys.

Rune