View mode: basic / threaded / horizontal-split · Log in · Help
April 18, 2012
Re: arrays and foreach
Le 18/04/2012 10:26, Somedude a écrit :
> 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 .
> 
... largely improved.
April 18, 2012
Re: arrays and foreach
On 04/18/2012 03:06 AM, Somedude wrote:
> Le 18/04/2012 10:26, Somedude a écrit :
>> 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 .
>>
> ... largely improved.
>

Thank you, this is all very valuable information. Yes, I will make the 
improvements and I am very grateful.

Although, I must say that there has been some reason in all of the 
decisions, which has been admittedly bad. At least it all started as a 
tutorial attached to a Turkish forum with a small but lively forum. It 
was fine back then to not explain everything in the "book" partly 
because of the experience that was already on that forum. Especially the 
number of platforms and IDEs that the user may be using has been a 
deterrent.

About the order of the chapters: Knowing that it may be boring to keep 
some topics like classes for so much later, I tried to reduce the amount 
of "accept this as a recipe for now, it will be explained later" type of 
information. I know my decision is not right and "people don't learn 
like that" but that has been an early decision. :) Also, I was under the 
impressions that there was no known good way of teaching programming.

Again, thank you very much the suggestions I will incorporate them. :)

Ali
April 18, 2012
Re: Compiling Was: arrays and foreach
On Tuesday, 17 April 2012 at 12:11:21 UTC, David wrote:
>> In this case, I had to type:
>> rdmd -unittest --main test.d
>>
>> Without the --main, I would get linker errors, and couldn't 
>> find the
>> reason for these errors. Happily, someone here explained me 
>> that the
>> effect of the --main flag was to insert a main() function just 
>> for this
>> case.
>
> That's not surprising, try to write a C program with no main:
>
> ─[ArchBox][/tmp]╼ touch foo.c
> ─[ArchBox][/tmp]╼ LANG=C gcc foo.c
> /usr/lib/gcc/i686-pc-linux-gnu/4.7.0/../../../crt1.o: In 
> function `_start':
> (.text+0x18): undefined reference to `main'
> collect2: error: ld returned 1 exit status
>
> You get the linker errors, because there is no entry-point for 
> your program, but that has nothing to do with D, it's a common 
> behaviour for C, C++, D and other languages.
>
>
> And the unittest(-switch) is also good relativly good explained 
> at http://dlang.org/unittest.html (dlang -> search -> unittest)

Yeah I understand, but I thought that by writing unit tests, I 
would implicitly add an entry point, but now I see how dumb an 
idea that is.
April 18, 2012
Newbie Introduction (was Re: arrays and foreach)
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
> (do-while, for, foreach, switch case, you really want to merge 
> those
> with other chapters like while, these don't need separate 
> chapters),
> ternary ops and associative arrays. With that, beginning 
> programmers can
> have some fun.
>
> In the second section (core language), I would put
> File
> Program environment
> auto typeof
> name space
> litterals
> enum
> function
> function params
> Lazy ops
> Immutability
> Classes <-- I didn't see a chapter on this topic ?
> Intefaces
> Exceptions
> Scope
> Assert and Enforce
>
> In the third section (Generic Programming and advanced 
> concepts), I
> would put:
> Templates
> Mixins
> Ranges
> Parallelism
> Concurrency
> synchronized
> __traits
> calloc etc, or 2 chapters for interoperations with C/asm
>
> Etc
>
> Finally, as appendices, I would put chapters about the tools:
> The Compiler <-- some more details about it
> The Linker <-- name mangling, etc
> Creating interface files, etc
>
> I think this organization would make much more sense, and would 
> make a
> wonderful book.
>
> I hope this helps.
April 19, 2012
Re: Newbie Introduction (was Re: arrays and foreach)
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.
April 19, 2012
Re: Newbie Introduction (was Re: arrays and foreach)
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 
acehreli@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
April 22, 2012
Re: arrays and foreach
On 04/18/2012 01:26 AM, Somedude wrote:

> 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.

[...]

> The order of the beginning chapters I think should be:
> Intro
> Practice of programming
> Hello world
> writeln and write
> Compiler
> Fundamental types

That part is done:

  http://ddili.org/ders/d.en/hello_world.html

Thank you,
Ali
April 22, 2012
Re: arrays and foreach
On Sat, 2012-04-21 at 22:14 -0700, Ali Çehreli wrote:
[...]
> That part is done:
> 
>    http://ddili.org/ders/d.en/hello_world.html

Surely "Hello World" shows just a few, and definitely not all, of the
essential concepts of a programming language.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder
Next ›   Last »
1 2
Top | Discussion index | About this forum | D home