comp.lang.ada
 help / color / mirror / Atom feed
From: Georg Bauhaus <rm.dash-bauhaus@futureapps.de>
Subject: Re: Fun with C
Date: Sat, 23 Apr 2011 11:42:51 +0200
Date: 2011-04-23T11:42:51+02:00	[thread overview]
Message-ID: <4db29f1b$0$6972$9b4e6d93@newsspool4.arcor-online.net> (raw)
In-Reply-To: <1uthrsrabx8di$.8i74uk28axo0.dlg@40tude.net>

On 4/23/11 9:23 AM, Dmitry A. Kazakov wrote:
> On Fri, 22 Apr 2011 19:08:33 -0700 (PDT), Elias Salomão Helou Neto wrote:

>> It is quite different with programming languages, as C is actually
>> harder than Pascal, which is a great tool for teaching programming.
>
> In which sense is C harder?

C is harder to learn from the ground up, as your first formalism,
when measured by the number of non-intuitive and non-essential
fundamental concepts that students must all understand in order
to understand and use fundamental ideas of C.

Notions are formed by distinction. Formally, each distinction D(n)
means another fork in the "tree of rules" that a human mind must
climb when trying to understand what's in the leaves. Humans have
limited capacity when following decision trees in any case, not just
when learning.  More so when topics change along the way, as is the
case with C, as explained below.  Changing topics requires context
switching---which is another distinction, thus f(D(n)) where f >= id.

Some of C's concepts will draw students of C to syntax, others
to operating systems, rather than focusing their attention
on what should be a meaningful part of C program text,  You might
be so familiar with these distinct notions that you have forgotten
that it once was difficult to keep them apart: you just saw
these different pieces of C text but they all looked alike!
Teaching C, then, by force is lacking modularization, in the following
sense.

For example, C offers distinctions that are non-essential
when seen from the viewpoint of teaching programming subjects.
Yet, they must be understood by the novices should they need to
to write programs, which, I think, they usually do.

- The statement and the block (of statements), and why and how
   to write them

Typically, a distraction:

Mostly offered when the subject is C's case distinction with if/else.
When teaching conditionals, the focus should be on conditional
execution.  It will easily be on whether or not you need braces,
and what the braces mean, and about what happens if you do or don't
write "else" and then do or do not write braces,

Blocks/statements confront novices with recursion at the level of
grammars---when they are trying to understand if/else.  But
recursive definition is not an easy concept in itself.  Observe
students (in the general sense of the word "students",
i.e. including pupils, or hobbyists) trying to understand
mathematical induction, which requires recursive thought.  It takes
time and practice to become acquainted, and then induction at school
was usually about natural numbers, not symbols, or about how
you yourself write.  Entire books like "The Little Functionaler"
by Friedman / Felleisen are all about recursive definitions.
They aren't easy.  Intrinsically, recursive definitions are very
close to circular definition, which, as you know, are vicious.


- C's shorthands

Too many things in one piece.

Professional typists learn how to write first.  Shouldn't students
of C (as a first language) do this, too? (Typists need to learn
the rules of written natural language first.  Orthography.  Then,
I imagine, other practical things about writing.)

Only then they, typists, learn how to use shorthands.

C culture, I believe, does not call *x++ a shorthand.  It calls
it an idiom.  It is even possible to argue that there is no
shorthand at all because everything is (mostly) well defined
and not an abbreviation.  But this argument misses modularity of
attention: one thing at a time.  The above expression requires
that the student isolates each single effect, and separates it from
the others.  Then thinks about implicit order and such. Why
should beginners in programming become familiar with shorthands
so very early?

Note how C's shorthands are totally different from the definitions of
"A Programming Language", i.e. APL languages.  There, TTBOMK, every
symbol has one (or two) well defined meaning(s) that do not
"abbreviate". Or that could easily be written in another way, as is
the case with C when, e.g. isolating the constituent parts of *x++.
The sum of 1 .. 100 in APL is

    +/⍳100

which, in Python, reads

   reduce(plus, range(101))

where
   def plus(x, y): return x + y

That is not to say that using "/" as reduction operator and not
division might not be confusing at first.  It is also not to say
that ⍳ and the many other operator symbols won't take time to learn.
But APL's mode of expression does not conflate so many things into
one piece, and fewer of them are about syntax or precedence.


- main and its (int argc, char* argv[]), that C shares with Java.

You will see lengthy discussions of what these mean.
And how they come to be, out of nowhere (known).  Or how
they could be passed to the program and that argv[0] is
of a different quality than argv[n], n > 0.

Similarly, about return 0; the teacher will have to explain why in
a Boolean context 0 means false but in the context of operating
systems, 0 means OK.  And what this has to do with the C program
in the first place.


- file scope.

An important feature of C---and its OS...

You'll need to know operating system concepts including file
system concepts before you can understand program text.
What is it that warrants dragging the file systems into it?
Why can't we understand the text of programs without the
external notion of a file?  K&R have no need to ship their
book split suitably into files.  They don't!


I guess I could go on for some time...  And I haven't mentioned
pointers at all and how they relate to arrays and to the + operator,
...

Is this a sense in which C is harder when you
want to learn the fundamentals of programming?



  reply	other threads:[~2011-04-23  9:42 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-16 17:02 Fun with C George P.
2011-04-16 20:04 ` Nasser M. Abbasi
2011-04-16 21:12   ` Ludovic Brenta
2011-04-16 21:42     ` jimmaureenrogers
2011-04-17  7:17     ` Georg Bauhaus
2011-04-17  8:29       ` Martin
2011-04-17 18:19       ` George P.
2011-04-17  8:40     ` Georg Bauhaus
2011-04-18  1:04     ` Peter C. Chapin
2011-04-18  2:14       ` George P.
2011-04-16 22:03   ` George P.
2011-04-17  6:26 ` KK6GM
2011-04-17  6:59   ` Georg Bauhaus
2011-04-17 16:15     ` KK6GM
2011-04-17 19:35       ` Elias Salomão Helou Neto
2011-04-17 20:18         ` KK6GM
2011-04-18 19:47           ` Elias Salomão Helou Neto
2011-04-18 22:11             ` Peter C. Chapin
2011-04-17 22:26         ` Georg Bauhaus
2011-04-18 19:12           ` Elias Salomão Helou Neto
2011-04-18 20:56             ` KK6GM
2011-04-18 21:01             ` Georg Bauhaus
2011-04-18 21:20               ` Nasser M. Abbasi
2011-04-19  2:43                 ` George P.
2011-04-19 18:05                   ` Vinzent Hoefler
2011-04-19 19:34                     ` George P.
2011-04-19 20:08                       ` Georg Bauhaus
2011-04-19  1:10               ` Elias Salomão Helou Neto
2011-04-19 14:28                 ` Georg Bauhaus
2011-04-19 17:40                   ` Jeffrey Carter
2011-04-21 14:52                   ` Elias Salomão Helou Neto
2011-04-21 18:58                     ` Georg Bauhaus
2011-04-21 19:27                       ` Hyman Rosen
2011-04-28  5:13                         ` David Thompson
2011-04-28 13:41                           ` Hyman Rosen
2011-05-05  8:39                             ` David Thompson
2011-04-25 11:06                 ` Paul Colin Gloster
2011-04-25 11:00                   ` Georg Bauhaus
2011-04-25 12:12                     ` Martin
2011-04-25 18:39                       ` Paul Colin Gloster
2011-05-08 23:41           ` wilso
2011-05-20 10:41             ` Yannick Duchêne (Hibou57)
2011-05-20 16:04               ` Yannick Duchêne (Hibou57)
2011-04-18  0:12         ` George P.
2011-04-18 19:24           ` Elias Salomão Helou Neto
2011-04-19  1:22             ` George P.
2011-04-19  2:06               ` Elias Salomão Helou Neto
2011-04-19  2:37                 ` Bill Findlay
2011-04-19  3:00                 ` George P.
2011-04-17 19:19 ` Elias Salomão Helou Neto
2011-04-17 23:26   ` Gautier write-only
2011-04-17 23:43     ` Nasser M. Abbasi
2011-04-18 19:16       ` Elias Salomão Helou Neto
2011-04-18 23:10         ` Randy Brukardt
2011-04-19  1:36           ` Elias Salomão Helou Neto
2011-04-20 23:14             ` Randy Brukardt
2011-04-21 16:19               ` Elias Salomão Helou Neto
2011-04-21 17:36                 ` Dmitry A. Kazakov
2011-04-21 17:43                   ` Hyman Rosen
2011-04-21 19:44                     ` Dmitry A. Kazakov
2011-04-22  6:16                   ` Elias Salomão Helou Neto
2011-04-22  9:21                     ` Dmitry A. Kazakov
2011-04-22 13:18                       ` Hyman Rosen
2011-04-22 15:17                         ` Dmitry A. Kazakov
2011-04-23  2:08                       ` Elias Salomão Helou Neto
2011-04-23  7:23                         ` Dmitry A. Kazakov
2011-04-23  9:42                           ` Georg Bauhaus [this message]
2011-04-23 10:23                             ` Dmitry A. Kazakov
2011-04-23 18:37                           ` Elias Salomão Helou Neto
2011-04-23 21:36                             ` Dmitry A. Kazakov
2011-04-24 11:27                               ` Peter C. Chapin
2011-04-24 13:53                                 ` Dmitry A. Kazakov
2011-04-24 19:07                                   ` Nasser M. Abbasi
2011-04-24 19:46                                     ` Dmitry A. Kazakov
2011-04-24 21:20                                       ` Nasser M. Abbasi
2011-04-24 22:33                                         ` Elias Salomão Helou Neto
2011-04-25  7:09                                         ` Dmitry A. Kazakov
2011-04-25 20:46                                           ` Maciej Sobczak
2011-04-25 21:19                                             ` George P.
2011-04-26  6:18                                             ` Dmitry A. Kazakov
2011-04-26  6:58                                               ` Nasser M. Abbasi
2011-04-26  8:39                                                 ` Dmitry A. Kazakov
2011-04-26 20:57                                               ` Maciej Sobczak
2011-04-27  8:00                                                 ` Dmitry A. Kazakov
2011-04-27  8:19                                                   ` Georg Bauhaus
2011-04-27  9:32                                                     ` Dmitry A. Kazakov
2011-04-28  7:02                                                   ` Maciej Sobczak
2011-04-28  7:41                                                     ` Dmitry A. Kazakov
2011-04-28 10:24                                                       ` Peter C. Chapin
2011-04-28 13:56                                                         ` Dmitry A. Kazakov
2011-05-03  1:19                                                           ` Nasser M. Abbasi
2011-05-03  6:05                                                             ` J-P. Rosen
2011-05-03  6:15                                                               ` Ludovic Brenta
2011-05-03  7:43                                                                 ` Dmitry A. Kazakov
2011-05-03 15:34                                                               ` Bill Findlay
2011-05-03  7:53                                                             ` Georg Bauhaus
2011-05-03  9:29                                                             ` Simon Wright
2011-04-24 22:23                                       ` Elias Salomão Helou Neto
2011-04-25  7:10                                         ` Dmitry A. Kazakov
2011-04-24 20:37                                 ` Georg Bauhaus
2011-04-23 15:23                         ` George P.
2011-04-23 17:28                           ` Nasser M. Abbasi
2011-04-23 17:52                             ` Dmitry A. Kazakov
2011-04-23 18:11                               ` Nasser M. Abbasi
2011-04-23 20:47                               ` George P.
2011-04-24 11:36                                 ` Peter C. Chapin
2011-04-25 11:43                                   ` Paul Colin Gloster
2011-04-23 16:56                         ` Nasser M. Abbasi
2011-04-23 18:45                           ` Elias Salomão Helou Neto
2011-04-22 12:15                     ` J-P. Rosen
2011-04-22 14:56                       ` Niklas Holsti
2011-04-21 23:29                 ` Randy Brukardt
2011-04-22  6:29                   ` Elias Salomão Helou Neto
2011-04-25 11:22                 ` Paul Colin Gloster
2011-04-18 19:13     ` Elias Salomão Helou Neto
2011-04-20  5:11   ` J-P. Rosen
2011-04-20 15:45     ` KK6GM
2011-04-20 19:04     ` Vinzent Hoefler
2011-04-20 21:09       ` Georg Bauhaus
2011-04-20 22:52         ` Vinzent Hoefler
2011-04-21 14:18     ` Elias Salomão Helou Neto
2011-04-21 16:22       ` Vinzent Hoefler
2011-04-21 19:25         ` John B. Matthews
2011-04-23 23:07 ` Gerd
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox