D vs Java as a first programming language

Nick Sabalausky a at a.a
Mon Sep 29 03:28:37 PDT 2008


"Jarrett Billingsley" <jarrett.billingsley at gmail.com> wrote in message 
news:mailman.260.1222678473.19733.digitalmars-d at puremagic.com...
> On Sun, Sep 28, 2008 at 8:03 AM, Nicolas Sicard <dransic at free.fr> wrote:
>
>> 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?
>
> It's funny you mention this because I had this exact experience last
> year.  I worked as a student helper at my university, where students
> from classes I had already taken could come and ask questions about
> things they didn't understand and assignments they were doing.  For
> some reason, the simplest introductory programming course at my
> university is taught in Java.  And every week, there'd be at _least_
> two people asking me why we had to put the "public static void
> main(String[] args)", why variables had to be declared before use, why
> they had to compile and then run etc.  And these same people had
> problems grasping concepts of what a string was and that numbers were
> not infinitely precise.  It seems like throwing all this OO junk at
> people from the outset is way too much information at one time.


I've also worked as a CS tutor at a college. We had two instructors (Mr. A, 
and Ms. B - because I honestly don't even remember their names anymore) that 
taught the intro to programming class (also taught in Java - which I still 
consider to have been a mistake). The number of students I got from each 
class was about half and half.

Mr. A would always start teaching with basic sequential statements (this 
line happens, then the next, then the next, etc.), then conditionals, then 
loops, then functions, and only *then* did he start getting into classes and 
OO. Literally every time I got a student from his class, it was clear that 
they understood the material, and they confessed they were only coming to 
see me just to double-check their work (which was overall pretty good).

Ms. B (a real nut, she wouldn't stop reminding everyone that she'd had 
experience "in the real industry" - yea, so what, who hasn't? Even I had at 
that point, and I was a student), for some reason that had always been 
completely beyond my comprehension, she always *started* these first-time 
programmers on classes and OO. Only *after* that would she get to anything 
else, such as basic flow of execution. Literally every time I got one of her 
students, they were *so* completely confused and clueless that the only way 
I could have helped them would be to either re-teach them from scratch with 
a full course curriculum of my own, or just send them back to their teacher.

So you definitely don't want to start too high-level. But, I would never 
teach a first-time programmer by starting at computer architecture and 
assembly (unless perhaps if they were coming from a strong EE background). 
Beginners need to start with simplicity. That rules out both OO and Asm:

OO is ruled out because OO is a style of code architecture (not a type of 
language) and code architecture is meaningless without understanding the 
basics of the language, and in the case of Java this means "imperative 
programming". Starting with OO is like teaching algebra before arithmetic. 
You can't understand one without first understanding the other.

Asm is ruled out because it's too complex and technical, and in many cases a 
full understanding is not strictly needed (although it can always help, I do 
recommend it be learned eventually). Plus it's very dull for a beginner. 
Starting with Asm is like teaching formal logic before moving on to basic 
arithmetic, or teaching quantum mechanics before moving on to chemistry and 
Newtonian physics. Yes, one is built on the other, but the lower-level is of 
somewhat less relevance (wrong level of abstraction), and the higher-level 
is far easier to grasp.

So basically, the high-level, OO, is too high-level to start at because it's 
too complex, and the low-level, computer architecture and Asm, is too 
low-level to start at because it's also too complex.

The way to go (at least for imperative languages):
- Basic text output using one statement
- Basic text output using multiple statements
- Assignments
- Conditionals
- Loops
- High/Low number guessing game (I've always thought this deserves the same 
status as "Hello World")
- Functions
- Other stuff, such as classes or binary, or anything else needed before 
getting to classes or binary.





More information about the Digitalmars-d mailing list