http://www.perlmonks.org?node_id=28701


in reply to RE: Exposure to problem solving methods need not be limited in number.
in thread Learning Programming

I think we do agree, for the most part :)

You mention the use of pseudo-code as a mid-step for solving a problem. To me, the only usefulness actually writing down pseudo-code (if it's in your head, it's not pseudo-code) is to by-pass a restrictive syntax structure that is merely going to inhibit you stating the problem.

Pseudo-code can be useful, therefore, as a linguistic construct in order to explain a problem/solution to someone as a type of lingua franca. That is, pseudo-code is a more or less universal way of talking/writing that gets the essence of all programming languages, without being bothered by any concept of syntax.

Other than that use, actually having the student write down pseudo code implies (to me), a problem with either their understanding of, or the natural over-syntaxized of a particular language. In other words, pseudo-code would act as a scratch board where you can quick jot down the solution, because it's too hard to actually write syntactically correct code. (to which you can then slowly fill in the correct syntax later).

I think that this symtom of using pseudo-code is primarily from ridged, strict, and/or non-intuitive syntaxed languages. If you have to both solve the problem and remember to use && but not &, etc. , then it makes sense to just drop the notion that what you are writing down first will even be close.

However, I think a language like Perl is much less strict, fluid, and (for the most part) intuitive, especially compared to other languages (not to start a Holy War (tm): e.g. Lisp, Ada). And becuase of the ease of thinking outloud in Perl, it makes more sense to skip the entire notion of pseudo-code and write down 90% syntax-correct code the first time.

That's the reason why I'd pick Perl over Python. Becuase while they are both great languages, in terms of easing the programmer, Perl wins (IMO) because it does not impose as strict of syntax.

Take for instance Ada. Ada is the only widely used programming language with true strict typing. It's also a pain in the wazoo's rear end to program in! I went straight from programming in Pascal for several years to Ada, and I found that I was spending most of my time fixing boot-boatloads of syntax and typing errors. I couldn't keep up with all the typing (er, structure, not finger), and so I pretty much gave up and resigned to letting the compiler tell me of all my mistakes.

Granted, when (several hours later -- I program a few kilos of lines before I try to compile a big program, normally) I finally got the program to compile, it had relatively few bugs. But I wouldn't completely atest that towards the strong typing. Rather, the fact that I spent so much time correcting typing errors, I would happen to read over some code that I didn't think was correct, and fix it.

In contrast, Perl provides a lexical structure that I can easily remember even when I while I was first learning the language. My program would certainly have bugs in it, the first time I ran it. But the first time I would tried to run it, I would rarely have a syntax error! (and if I did, it was a bug manifesting itself to the compiler as syntax)

Anyway, I just feel that the easier the language is to learn, plus the easier it is to actually spit out, makes solving the problem a much easier task.

Again, just because Perl does become nasty, and has ten tools that vary subtly, it doesn't mean that a careful teacher could keep his students from falling prey to these pitfalls. (For instance, no map, grep, regex's, etc, and if you want, don't tell them for and foreach are actually the same.. :) ).

Ciao,
Gryn