September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Walter Bright | Walter Bright wrote:
> bearophile wrote:
>> So beside asking the age of your students, a second important
>> question to ask you is the kind of things you want to teach, and the
>> kind of students you have. If your purpose is to teach just
>> programming, then Java may be better. If your purpose is to teach
>> some math too, to think in a flexible way, logical thinking,
>> recursivity, functional programming, parallel thinking, and so on,
>> then maybe Scheme is a better choice, despite it's almost useless
>> compared to Java.
>
> That's a very good point. If my students intended to become top professionals and had a keen interest, I'd start them with assembler, and follow up with D. If they were 9 year old kids wanting to toy around, I'd probably start with a language with instant gratification, like javascript.
Also, different people learn best in different ways. Some can't focus on high-level issues unless they understand what's going on under the covers, while others are the opposite. If I were to design a curriculum I'd suggest the bottom-up approach (ie. architecture to assembler to D), but leave students the option of doing the reverse as well. At least insofar as these first few courses are concerned.
Sean
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard wrote: > Hi, > > I am new to D, and I think I have discovered a programming language close to my ideal one... > > On the web site, it is said: "Who D is Not For [...] As a first programming language - [...] Java is more suitable for beginners.". > Is this based on experience? In my experience there is a prevailing belief that students have difficulty with low-level issues and so it's common to begin by teaching high-level programming and then go on to explain what's happening behind the scenes. "The Art of Assembly Language," for example, teaches assembly via a higher-level meta-language for this reason, and the decision was made based on a great deal of experience teaching students assembly. Personally however, I think this approach is a mistake. Some students aren't willing to overlook the "magic" and focus on high-level logic at the outset. Also, I think that it's important to teach good habits at the outset, because re-training later is much more difficult. Teaching with Java, for example, may be convenient in that it obscures most of the irrelevant details that plague C++ programmers--pointer errors, etc--but at the same time the students aren't given the opportunity to develop an understanding of issues that will be crucial to their success later on. > 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 :-) > It seems the main argument why Java is a good first language is that it lacks complexity (namely C++ complexity). I think it also lacks simplicity for absolute beginners. D can be both simple and complex, and it shares other features with Java that could make it a language for beginners: object-oriented, no pointers necessary, garbage collection, strict type checking, portable... This is why I think D is a perfect teaching language. It's possible to get very low-level by using inline assembler and writing C-style code, or to use objects, delegates, etc, all in the same language. If I were teaching imperative programming and didn't care about the lack of published teaching materials I'd use D. > What feature would make D a worse choice than Java for a first language? Shaky debugger / IDE support and a lack of published documentation. I suppose I could plug "Learn to Tango with D" here, but its target audience is really someone who knows at least one other imperative language. An alternative would be to start with Pascal, C, or C++, depending on your preference of syntax, safety, and complexity. Alternately, you could begin with a language like Lisp, Scheme, Haskell, Erlang, etc. I can't see this being terribly successful if your class is full of would-be web designers, but it's a definite option if you're targeting BS Comp Sci. or Comp Engineering students. I think it's generally a good idea to get a functional language in early, because students seem to have a lot more trouble learning them if they've already spent a year or two doing strictly imperative programming. Sean | |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard wrote:
> Hi,
>
> I am new to D, and I think I have discovered a programming language close to my ideal one...
>
> On the web site, it is said: "Who D is Not For [...] As a first programming language - [...] Java is more suitable for beginners.".
> Is this based on experience?
>
> 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?
>
> It seems the main argument why Java is a good first language is that it lacks complexity (namely C++ complexity). I think it also lacks simplicity for absolute beginners. D can be both simple and complex, and it shares other features with Java that could make it a language for beginners: object-oriented, no pointers necessary, garbage collection, strict type checking, portable...
>
> What feature would make D a worse choice than Java for a first language?
>
> Nicolas
On of the nice things about D is that its a multi-paradigm language. That is it has a bit of everything in it. That should make for learning other languages easier once one knows D. Also hello world is a lot simpler in D:
import std.stdio;
void main(string[] args)
{
writefln("Hello World!");
}
I think you could craft tutorials that have small enough steps to make D a very easy language to learn.
-Joel
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Janderson | Janderson <ask@me.com> wrote: > On of the nice things about D is that its a multi-paradigm language. That is it has a bit of everything in it. That should make for learning other languages easier once one knows D. Also hello world is a lot simpler in D: > > import std.stdio; > > void main(string[] args) > { > writefln("Hello World!"); > } > > I think you could craft tutorials that have small enough steps to make D a very easy language to learn. > > -Joel Actually, you can make hello world even simpler: void main() { printf("Hello World!"); } -- Simen | |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Sean Kelly | 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. | |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Chris R. Miller | On Mon, Sep 29, 2008 at 9:12 AM, Chris R. Miller <lordsauronthegreat@gmail.com> wrote:
> 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.
You forgot the "\n" in your printf, which is another thing to explain to the poor helpless students.
--bb
| |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Simen Kjaeraas | Simen Kjaeraas wrote: > Actually, you can make hello world even simpler: > > void main() > { > printf("Hello World!"); > } You seem to be missing an import std.c.stdio; there... Can't count on Object being buggy* like that forever ? ;-) Or you could use an alternative declaration, like: version(Tango) extern (C) int printf(char *, ...); --anders * http://www.digitalmars.com/d/archives/digitalmars/D/bugs/5838.html | |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | On Sun, Sep 28, 2008 at 8:03 AM, Nicolas Sicard <dransic@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.
| |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Jarrett Billingsley | "Jarrett Billingsley" <jarrett.billingsley@gmail.com> wrote in message news:mailman.260.1222678473.19733.digitalmars-d@puremagic.com... > On Sun, Sep 28, 2008 at 8:03 AM, Nicolas Sicard <dransic@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. | |||
September 29, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | I like two programming languages a lot: D and Jade. I dont prefer one of the other I think they each are very good depending on what you are trying to do. I think D is not that easy to start with but I think java is much worse. Have you ever tried Jade. I recently started jadeprogramming.com back in June for people like you. It doesnt have much but it has one tutorial vid on there at the moment. An example easy to understand jade code: vars s : String; begin read s; write 'You entered: ' & s; end; PS dont confuse Jade with the Java Agent DEvelopment Framework. The jade im talking about is this http://en.wikipedia.org/wiki/JADE_(programming_language). | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply