D vs Java as a first programming language

Nicolas Sicard dransic at free.fr
Mon Sep 29 09:59:34 PDT 2008


Chris R. Miller a écrit :
> Sean Kelly wrote:
>> Nicolas Sicard wrote:
>>> I am a teacher in a field where my students don't know what a 
>>> programming language is! I need a language for a first approach of 
>>> programming. I would say that Pascal, or BASIC even if a bit 
>>> outdated, or even D would fit, but not Java.
>>>
>>> I can imagine my first lesson with Java:
>>>
>>>     public class HelloWorld {
>>>         public static void main(String[] args) {
>>>             System.out.print("Hello world!");
>>>         }
>>>     }
>>>
>>> I would have to explain what a class is. What a method is. What a 
>>> public or private visibility means. What a static method is. What 
>>> the dots in "System.out.print" mean... :) Then how to compile it. 
>>> Why you can't run it without a virtual machine. A virtual what?
>>
>> The typical approach to this tends to be "just put this stuff in the 
>> file and ignore it--I'll explain it later.  I never understood why 
>> this is considered a good teaching method :-)
>
> There are so many concepts and mechanics that are at work with even 
> the simplest Hello World in wee simple C that it's completely 
> irrational to expect a student new to programming to comprehend what's 
> going on.  Just think about it...
>
> #include <stdio.h>
>
> int main(){
>     printf("Hello, world!");
>     return 0;
> }
>
> Right there!  More concepts than can even be explained!  You have the 
> concept of an include, and how the parser literally strings all the 
> files together to create a processed source code, then how the 
> compiler creates a new C run time in suspended animation which will 
> then run the function main(), and how printf is supplied by the 
> include directive earlier.  We get it 'cause we've been trained.  To a 
> lot of kids it's a completely foreign thing.  I mean... gee, this 
> computer is hecka dumb 'n stuff if we need to tell it where to find 
> out how to talk through the display!  Not to mention the distinction 
> of a constant character array, arrays in general, string literals, 
> types, casting, return values, etc.  It's a crazy world!
>
> At a certain point you have to pedagogically ask the student to take 
> certain things on faith until you can better explain it all.
Of course, and this is true for every teaching action in every field. I 
sureky wouldn't teach linguistics to babies learnig to talk. I would 
just tell them what the words mean. In your C example, as well as in the 
Java one, I would tell my students why they have to use these items and 
what for, but certainly not how they work. In this respect, there is 
much to say in Java's HelloWorld, and less in C/D/Pascal's, even less in 
Python's.




More information about the Digitalmars-d mailing list