Re: Newbie Introduction (was Re: arrays and foreach)

2012-04-19 Thread SomeDude
On Wednesday, 18 April 2012 at 19:43:50 UTC, Paul D. Anderson 
wrote:
SomeDude: Your outline and especially your emphasis on what a 
rank beginner needs to know is very good.


Would you consider writing it up yourself? Not the whole thing, 
maybe but the beginner info and the compiler/linker appendices. 
You have a commendable prose style.


There are tutorials available already, but too many is way 
better than too few.


Paul



Thanks. I wouldn't mind having a stab at it, but:
1. it is Ali's book, not mine, so we would need Ali's agreement. 
If he offers me to contribute, why not,
2. I'm myself a D beginner, so you would probably need to proof 
read and correct me afterwards.


Re: Newbie Introduction (was Re: arrays and foreach)

2012-04-19 Thread Ali Çehreli

On 04/19/2012 10:02 AM, SomeDude wrote:
 On Wednesday, 18 April 2012 at 19:43:50 UTC, Paul D. Anderson wrote:
 SomeDude: Your outline and especially your emphasis on what a rank
 beginner needs to know is very good.

 Would you consider writing it up yourself? Not the whole thing, maybe
 but the beginner info and the compiler/linker appendices. You have a
 commendable prose style.

 There are tutorials available already, but too many is way better than
 too few.

 Paul


 Thanks. I wouldn't mind having a stab at it, but:
 1. it is Ali's book, not mine, so we would need Ali's agreement. If he
 offers me to contribute, why not,

I will improve the beginning of the book with your ideas. (I don't have 
free time yet; maybe by the end of next week.) I would also like to 
thank you if you would please e-mail me your full name at 
acehr...@yahoo.com.


I think it would be even better if you add a newbie section (or improve 
the existing ones as you graciously have been doing) on the wiki site, 
or some other site. I would be happy to link to that section from the 
book. (I have a feeling Paul D. Anderson meant that you wrote a separate 
document anyway.)


 2. I'm myself a D beginner, so you would probably need to proof read and
 correct me afterwards.

Gladly, as much as I know myself. :)

Ali



Newbie Introduction (was Re: arrays and foreach)

2012-04-18 Thread Paul D. Anderson
SomeDude: Your outline and especially your emphasis on what a 
rank beginner needs to know is very good.


Would you consider writing it up yourself? Not the whole thing, 
maybe but the beginner info and the compiler/linker appendices. 
You have a commendable prose style.


There are tutorials available already, but too many is way better 
than too few.


Paul


On Wednesday, 18 April 2012 at 08:26:14 UTC, Somedude wrote:

Le 17/04/2012 16:07, Ali Çehreli a écrit :

On 04/17/2012 12:42 AM, Somedude wrote:

Sorry for hijacking this thread, but since you're around, I 
hope you'll
see this message. As a D beginner, I'm browsing through your 
book.
I wanted to tell you that there is something essential 
missing in it:
how to compile. It's actually quite hard to find it in the 
official
website, and since the first chapters are targetted at 
complete
beginners, I thought it would be nice to add a few lines or 
pages about

compilation, linking, debugging, etc.
What do you think ?


Thank you very much for the feedback. I will do something 
about that.


Although there is no hello world compilation, the dmd command 
line

appears multiple times throughout the chapters.

The 'assert and enforce' chapter shows it for the -release 
compiler
switch and coincidentally I am on the 'Unit Testing' chapter 
as we

speak, which includes the -unittest switch. :)

But you are right, both dmd and rdmd command lines must appear 
earlier.


Thank you,
Ali

Yes, I think that you have a lot of valuable information, but 
the
organization is lacking. The advanced chapters look good, but 
the first

beginner chapters can be .

what struck me as an error in your Hello world program 
chapter, you

give as an exercise:

Type or copy the hello world program into your editor as a 
source file,

compile it, and run the program. The program should produce the
following output: Hello world!

If you are new to using a compiler, you will need to get help 
from the
compiler documentation or, preferably, an experienced person. 
You can't
benefit from the rest of this book if you can't compile and run 
programs.


Spock would have said: Illogical, captain! At this point, you 
haven't
told how to compile and run the program. Seriously, if your 
book is
aimed at complete beginners (and the first chapters seem to say 
that),
you really want to tell them what to do, not go find the 
compiler
documentation, else if they can do that, they simply don't 
need to read

your book.

For a complete beginner, it's very frustrating to have to read 4
chapters of fluff, then write the program, and still not 
knowing how to
run the program. Where is the fun ? I can guarantee that at 
this point,

9 out of 10 beginners will drop the reading.


FIRST show, THEN explain. Better yet: first show, then ask 
questions,

and finally explain.

So how would I have organized this chapter ?
Something like this:

---
The first program to show in most programming...
Here is a hello world in D:
...

Copy this program and save it in a file under the name hello.d
.d is the extension for D source code.

Now we'll compile it, that is to say the compiler will check 
that the
syntax of this source code, and if it is valid D, will 
translate it into

machine language and make it a program.
Type in the command prompt:
rdmd hello.d

If you didn't make any mistake, you should have the impression 
that
nothing happened. In the contrary, everything went well ! You 
can check
that the executable file hello (or hello.exe under window) has 
been

created. If instead the compiler barked at you lots of text, you
probably made a mistake while copying. Correct it and retry. 
You will
routinely make many mistakes when programming so that this 
process of

correcting and compiling will get very familiar.

Once this is done, type the name of the executable to run it.
You should see
Hello, world !

Congratulations, your first D program is running !



Then ONLY after that, I would proceed to the explanations.
(As an exercise, I would ask also: what is the smallest valid D 
program ?)


I would put the Hello, world chapter at the very beginning, 
right

after The practice of programming.
This chapter would be enriched by an example on the computer, 
showing

the values.

The order of the beginning chapters I think should be:
Intro
Practice of programming
Hello world
writeln and write
Compiler
Fundamental types
I would then merge Assignment and order of evaluation with 
Variables


I would also remove the Standard Input and Output Streams, 
they don't

belong to an introduction.
In fact, the problem is, you really want to separate your 
chapters into
a sections, one as an introductory course, and one for more 
advanced
explanations of the core language, and maybe one to introduce 
specific

concepts of the standard library (your last chapters).

I would put in Introduction section the first 19 chapters until
Redirecting input and output, as well as all the flow 
constructs