On Tue, 2006-06-13 at 14:03 -0600, Nicholas Leippe wrote: > On Tuesday 13 June 2006 13:11, Michael L Torrie wrote: > > Sure. But my real point was the Java habit of always doing "new" causes > > a ton of problems for Java programmers heading into C++. Rather than > > use a local variable allocated on the stack, they do "new" which leaks. > > That is the problem. So really it's not a language problem; it's a > > programmer problem. But a programmer can be trained; unfortunately Java > > is not a good trainer in this instance. In my opinion it would be > > better to subject a new CS student to C and C++ in all their glory and > > then introduce them to managed, Garbage-collected languages later, > > rather than the other way around. > > Hrm. Maybe. But, silent show of hands, how many plugger's first programming > language was some dialect of BASIC?
Unfortunately, I did learn applesoft BASIC and Microsoft's BASIC. Fortunately at a very young age I was introduced to Borland's TurboBASIC compiler (later became PowerBASIC) which was more like Pascal than GWBASIC. (What's a line number?). User-defined functions, Switch statements, If blocks, etc. Was wonderful. > > The key concepts are dynamic allocation, and variable binding. Each can be > separated, and can be taught better in some languages than others. Right. Scheme or LISP is the best. > > Some forms of BASIC implement neither concept. Every variable is in fact > 'the > variable', and there is no dynamic allocation (save for variable sized, > global arrays). > > This is where I started. Then, I went straight to assembly language, and > then > to C++. Having a good grasp of what is occurring physically in hardware > (asm) made understanding pointers trivial. To understand references, IMO, > implement a compiler (or take a compiler course), and you'll have no more > confusion--it's all about symbol tables. Agreed. > > The real learning issues come about when different parts of these two > concepts > have overlapping syntax across languages. > > IMO, better to introduce language concepts w/o dynamic memory management > first, then memory management and variable bindings as two distinct (though > interdependent) topics later. > > You can teach dynamic memory management in subtle ways w/o it. For example, > teach linked lists, but implement them using arrays. Then when you introduce > pointers--tahdah!--the student already understands exactly what is happening. > > The storage location has moved from the array he explicitly declared to an > intrinsic property of the computer, and now, in his mind, the pointer is no > different from the array index variable he had to use before. Unfortunately that's not the way most CS students are taught. Tis sad. > > /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
