Wednesday, 27 April 2011

We teach using Matlab and C++ so we could teach programming in an Object-Oriented way. Post-2008, Matlab's O-O support has become neater, and has more features - listeners; something similar to Java's final, etc, but we don't talk about that aspect of Matlab. Undergraduates define their own C++ classes in the 1st year, but only in an optional 3rd year course do they really get introduced to O-O. There's not really enough time to push multi-paradigm programming at them. They would end up forgetting how to write loops, or whether arrays begin at 0, and they'd more often do things like getting programs to print the final results by putting the output code into a destructor, or using objects merely to modularise code.

In a way you might think engineering suits O-O - re-usable components and interfaces are common to both fields - but engineers also know about K.I.S.S. and over-engineering.

In "Python for Teaching Introductory Programming: A Quantitative Evaluation" (Jayal et al; Italics V.10.1 Feb 2011) they say they "found four experimental studies that compare object oriented approach with the traditional procedural approach". One "by Reges (2006) has found significant gains in student satisfaction and enrolment after replacing the object oriented programming first curriculum with a procedural approach". The other 3 studies found no significant differences. Jayal et al. found that students who started with Python then did Java performed better than students who did Java all the way through the course.

In Back to Basics in CS1 and CS2, Stuart Reges says "Our new version of CS1 looks a lot like a 1980's course taught in Pascal. We have gone back to procedural style programming. I
was motivated to do this after attempting and failing to teach a
broad range of introductory students at the University of Arizona
using an 'objects early' approach. I found that my best students
did just fine in the new approach, but the broad range of midlevel
students struggled with the object concept". The course begins by using Java with a lot of public static methods. He writes "Our switch to static methods has allowed us to bring back the problem solving aspects of the course that we thought were so
important in the 1980's" adding that "even though Java is not an ideal choice for our CS1, we continue to use it because of its payoff in our CS2 course."

If that reasoning applies in a Computer Science course it applies even moreso to Engineering, I'd have thought. So should O-O stand for "Objects-Overrated"?

Thursday, 14 April 2011

"Coders at Work" (edited by Peter Seibel, Springer-Verlag, 2009) has
interviews with several famous programmers. Most use Emacs and debug
using print statements. Most try to understand code in several ways -
bottom-up, top-down, following the effects of a user action (e.g. deleting a
character in an editor), looking at data structures, etc. Here are some quotes that might be of use

C++

"C++ is just an abomination", Zawinski, p.10

"[C++'s] syntax is terrible and totally inconsistent and the error messages,
at least from gcc, are ridiculous", Fitzpatrick, p.63

"I don't like C++; it doesn't feel right", Armstrong, p.224

"given the kinds of goals that I have in programming, I think the decision
[for C++] to be backwards-compatible with C is a fatal flaw ... C
fundamentally has a corrupt type system", Steele, p.355

"Google is C++, strictly C++. It's no big deal programming in C++, but I
don't like it ... by and large I think it's a bad language", Thompson, p.475

C

"C has destroyed our ability to advance the state of the art in automatic
optimization, automatic parallelization, automatic mapping of a high-level
language to the machine", Allen, p.502

"the biggest security problem to befall modern computers is C", Cosell, p.557

"one of the most important revolutions in programming languages was the use
of pointers in the C language", Knuth, p.585

Debugging

"I love strace. Strace, I don't think I could live without", Fitzpatrick, p.79

"I think an hour of [team] code reading is worth two weeks of QA",
Crockford, p.103

"we have found fuzz testing to be more productive than almost any other
kind of testing", Eich, p.138

"the most important [debug] tools for me are still my eyes and my
brain. I print out the code involved and read it very carefully ... So long
as I can put print statements in the code, and I can read it
thoroughly, I can usually find the bugs", Bloch, p.189-190

"most of my subjects have found that the hardest bugs to track down are in
concurrent code", Seibel, p.xiii

"the first thing I will try is dropping in print statements to see if it
will help me, even though that is probably the least effective for dealing
with a complicated bug. But it does such a good job of grabbing the simple
bugs that it's worth a try", Steele, p.365

"I don't know of anybody who [uses print statements] if they have the
choice of using a good debugger", Ingalls, p.405

Gender

"Recently I realized what was probably the root cause of [the glass
ceiling]: computer science had emerged between 1960 and 1970. And it mostly
came out of the engineering schools ... And the engineering schools were
mostly all men in that period", Allen, p.510

"A lot of people think it's the games and the nerdiness of sitting in front
of a computer all day [that making computer science unappealing to
women]. It's going to be interesting how these new social networks online
will have an effect", Allen, p.513

"the conventional wisdom at the time ... said that women made good programmers because they pay attention to details ... today ... they're great on teams because they like to collaborate", Allen, p.507, 509

Miscellaneous

"We installed some buttons on the computer, because you could do that, at the time and one was a panic button. When the program appeared to loop one could just press the panic button", Allen, p.488

"I remember reading books about languages that I had no way to run and
writing programs on paper for languages that I'd only read about", Zawinski, p.2

"I despise [perl]. It's a horrible language", Zawinski, p.11

"One of the jokes we made at Netscape a lot was 'We're absolutely 100
percent committed to quality. We're going to ship the highest-quality product
we can on March 31st'", Zawinski, p.34

"I can't even remember which [UML] components are supposed to be round or
square", Bloch, p.181

"the best existing multithreaded building blocks are in Java", Bloch, p.198

"I think the lack of reusability comes in object-oriented languages, not in
functional languages. Because the problem with object-oriented languages is
they've got all this implicit environment that they carry around with them", Armstrong, p.213

"with very difficult problems I quite often start right by writing the
documentation", Armstrong, p.231

"From what I've seen of programmers, they're either good at all languages
or good at none", Armstrong, p.235

"I don't think software is fractal ... I think the things that happen when
systems get large are qualitatively different from the things that happen as
systems go from being small to medium size", Deutsch, p.421