| Thread overview | |||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 28, 2008 D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
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
| ||||
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?
Given the described target audience, I would suggest Python or Ruby as the first language. Even D might have too much initial knowledge to gain for them.
Matt
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard:
> What feature would make D a worse choice than Java for a first language?
Choosing the "right" language to teach programming is difficult. Once Pascal (or Logo for young ones) was a safer bet (but even in the past Scheme was present and not bad). The first thing to ask is what's the age of your students.
If they are very young then D is unfit and Python/NetLogo/etc are probably better.
If they are college students then Java isn't that bad choice, because it has uniform syntax, very few special cases, works well, it's the most used language in the world, it has tons of libs, IDEs, you can find lot of books, lot of answers and docs on the net, the HotSpot today runs programs quite quickly, and so on. So it's a rigid, boring language that makes you write very long programs, but it has its advantages.
D is less safe, it doesn't have a really standard library yet, and compared to Java no one uses it, and no one uses it to work (compared to java still), and the compilers have lot of bugs still, so after your courses the things they know become less useful for them, and you they have more problems producing working programs.
To be truth, I think D is a nice language, but it's closer to the CPU than languages like Python and Java. This has both downsides and upsides. If your students don't know any other language, I think D is too much complex (it's a system language still).
Scheme is nice, but it makes you go mad a little.
New languages like Clojure, Scala, ecc too are nice, but too much unripe yet.
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.
If your purpose is to teach lot of programming with the minimal problems, then probably a language like Python is better. When they know Python then they can learn C or Java or even some basics of Haskell...
If you answer those two questions I can give you a better answer.
Bye,
bearophile
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | bearophile a écrit :
> Nicolas Sicard:
>
>> What feature would make D a worse choice than Java for a first language?
>>
>
> Choosing the "right" language to teach programming is difficult. Once Pascal (or Logo for young ones) was a safer bet (but even in the past Scheme was present and not bad). The first thing to ask is what's the age of your students.
> If they are very young then D is unfit and Python/NetLogo/etc are probably better.
>
> If they are college students then Java isn't that bad choice, because it has uniform syntax, very few special cases, works well, it's the most used language in the world, it has tons of libs, IDEs, you can find lot of books, lot of answers and docs on the net, the HotSpot today runs programs quite quickly, and so on. So it's a rigid, boring language that makes you write very long programs, but it has its advantages.
>
> D is less safe, it doesn't have a really standard library yet, and compared to Java no one uses it, and no one uses it to work (compared to java still), and the compilers have lot of bugs still, so after your courses the things they know become less useful for them, and you they have more problems producing working programs.
>
> To be truth, I think D is a nice language, but it's closer to the CPU than languages like Python and Java. This has both downsides and upsides. If your students don't know any other language, I think D is too much complex (it's a system language still).
>
> Scheme is nice, but it makes you go mad a little.
>
> New languages like Clojure, Scala, ecc too are nice, but too much unripe yet.
>
> 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.
>
> If your purpose is to teach lot of programming with the minimal problems, then probably a language like Python is better. When they know Python then they can learn C or Java or even some basics of Haskell...
>
> If you answer those two questions I can give you a better answer.
>
> Bye,
> bearophile
>
They are college students. They are biologists and most of them won't need programming skills after they graduate.
I really don't think D is necessarily more complex (though it surely can be). Pascal was as close to the CPU than D, and about as safe, wasn't it? But the poor documentation on the net compared to Java is the best point, I think. As could be the small audience, and the stability.
I think Python is the right alternative: large audience and docs, easy for beginners, libs designed for biological science are available... I just need to start learning it myself ;-)
Thanks for the answers
Nicolas
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard: > They are college students. They are biologists and most of them won't need programming skills after they graduate. Then D is probably a bit too much complex for them. They can surely learn it, but probably there are better languages for them. But remember that students aren't all the same. Each one has a different mindset/brain, so probably for some of them Scheme is better, for some other C/Pascal/D are maybe fitter, and so on. There are many kinds of languages not just because problems are different, but also because the brain of the programmers is different, and such differences are often present in student brains already :-) > I really don't think D is necessarily more complex (though it surely can be). Pascal was as close to the CPU than D, and about as safe, wasn't it? I think modern ObjectPascals, like FreePascal, are a little safer than D still, but the difference isn't much, I think. Java is safer than both. > and the stability. The stability isn't much of a problem, I think. > I think Python is the right alternative: large audience and docs, easy for beginners, libs designed for biological science are available... I just need to start learning it myself ;-) For them Python is probably one of the the best things, then. There are lot of people that use Python for biology, me too. But note that I also use D for bioinformatics, mostly because sometimes Python is too much slow. But your students have to learn programming first, so performance is not important. > I just need to start learning it myself ;-) Few months may suffice. You need a good large book on it. There's the newsgroup too, where you can ask things. Bye, bearophile | |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard wrote:
> 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 think Python replaced Pascal and BASIC in the succession of horrible
languagues that you learn in school and are hard to unlearn later...
Should be great for non-programmers. ;-)
--anders
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard wrote:
> I think Python is the right alternative: large audience and docs, easy
> for beginners, libs designed for biological science are available... I just need to start learning it myself ;-)
>
Don't forget about the ability to be used interactively. Check out IDLE, the interactive IDE that comes with the standard Python download.
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | == Quote from Nicolas Sicard (dransic@free.fr)'s article
> 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
I second the vote for Python. I would avoid toy languages like BASIC, etc. I think that most people are more motivated to learn something that is directly practical and might be directly useful outside the classroom. Python is unique in that it's intuitive enough for beginners, but has enough cool stuff (metaclasses, list comprehension, etc.) that those who do end up programming after your class will not outgrow it fast. Heck, even "real programmers", such as Eric Raymond, use and praise it. My only real knock against it is performance, but that's not even a problem in most cases.
I certainly agree that Java is a terrible beginner language (and not a particularly good language period) because it makes you jump through too many hoops to do simple things (see your own hello world example), and yet doesn't have very many advanced features, such as metaprogramming, advanced programmers to play with.
However, D has its own problems as a beginner language. First, although it doesn't seem like it to someone coming from C/C++, it's a fairly close to the metal language. Although it's relatively easy to avoid, there is undefined behavior. Integers can overflow. Static typing, while necessary for high performance and of debatable value in catching errors, isn't the most intuitive thing in the world for a novice programmer. Furthermore both of the common ways to make a statically typed language more flexible (templates, polymorphism) are probably too advanced for a first course. Lastly, D is still fairly young, and the occasional compiler bug or need to roll your own <insert data structure/algorithm for which there is no decent library yet here> requires having some programming experience under your belt to deal with.
Having helped a few friends who were struggling with very simple (to anyone who's been programming for a while) assignments, it seems to me that most of the time, programming teachers fail to explain the most basic stuff because it seems too obvious to someone who's been programming for a while. For example, I've known several people to whom the whole concept of nesting just didn't make sense until I backed up the truck and actually explained it explicitly. Furthermore, if the syntax is complex, such as in a C++ class I took in high school, I've seen students spend so much time at first thinking about the syntax that they can't think about higher level concepts. Therefore, I think a language with simple syntax and not too much excess stuff that makes it hard to illustrate the basics is the way to go.
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Nicolas Sicard | Nicolas Sicard wrote:
> What feature would make D a worse choice than Java for a first language?
As languages, I argue that D is a better first choice than language. But I was thinking of infrastructure. D doesn't have shelves full of tutorial books written about it, and Java does.
| |||
September 28, 2008 Re: D vs Java as a first programming language | ||||
|---|---|---|---|---|
| ||||
Posted in reply to bearophile | 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.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply