D vs Java as a first programming language
Chris R. Miller
lordsauronthegreat at gmail.com
Mon Sep 29 15:59:41 PDT 2008
Sean Kelly wrote:
> == Quote from Chris R. Miller (lordsauronthegreat at gmail.com)'s article
>> 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.
>
> And of course don't forget explaining how a compiler works since they'll
> be compiling the app, and how an OS works since it runs on an OS...
>
> In all fairness, I think there's a happy medium here, where the stuff that
> the student sees is explained without involving related but extraneous
> details. The big issue for me with Java is that I don't see any way around
> at least a simple explanation of OO, given the format of a Java "hello world"
> app. That's significantly more material than discussing a "hello world" in
> C or D. C++ would be kind of a mess as well, since IO there uses operator
> overloading, etc.
My teacher didn't explain that. For four months I had no idea what this
strange "class Main" was all about. I knew that if the class name was
different than the file name it didn't run, but beyond that I ignored
it, since the assignments didn't require work outside the class.
Anything I needed I could import.
>> At a certain point you have to pedagogically ask the student to take
>> certain things on faith until you can better explain it all.
>
> Fair enough. But the amount each student is willing to take on faith varies.
It doesn't matter what they're willing to take. You are the instructor.
In due time you will make all things known. For now they need to
just shut up and do what they're told.
Yes, standardized education for nice little standardized children!
> Some will accept pretty much anything as magic, while others want to know
> how a function call works mechanically (or in some cases conceptually, if
> they're math geeks) before they feel comfortable actually calling functions.
I have seen many different kids from all three ends of this triangular
spectrum do just fine with Java. I got curious and started
experimenting with it, trying to make my own classes at month 4.
Eventually I figured out how they worked syntactically so I could use
multiple classes in my programs (the files were getting too big for my
tastes, I just wanted to split stuff up). Later on the explanation of
why and how they worked came and I had this great big "ah hah!" moment
and I was ruined as a Java pro ever since. It's been four long years
of deprogramming myself to get off of Java, so I'm doing well. ;-)
More information about the Digitalmars-d
mailing list