TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy

TEAM-ADA@LISTSERV.ACM.ORG

Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Condense Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Sender: "Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
From: kemillik <[log in to unmask]>
Date: Thu, 5 Oct 2000 12:50:06 -0500
In-Reply-To: Your message of "Thu, 05 Oct 2000 10:52:54 CST." <[log in to unmask]>
Reply-To: kemillik <[log in to unmask]>
Parts/Attachments: text/plain (64 lines)
I'm very interested in the answer to this question; I've spent the
last few years teaching Scheme to introductory CS students.  Some "get
it", some don't.  I _don't_ think it has much to do directly with the
language's syntax.

>>>>> "MC" == Carlisle Martin C Dr USAFA/DFCS <[log in to unmask]> writes:

    MC> There are lots of syntatical issues about switching from Pascal to C++ (even
    MC> a C subset).  The former "var" parameters are now required to be implemented
    MC> via pointers, since C does not support implicit pass by reference.

Remember, the students are presumably taking a first CS class.  They
have not seen Pascal before, so they are not the ones switching from
Pascal to C++.  In fact, if students have seen any programming at all
when the reach their first CS course, it is increasingly likely that
it was Java.

C++ _does_ have explicit pass by reference, with a syntax much like
Pascal's.  Besides, it would take me a while in an introductory CS
class before I would start talking about pass by reference.

    MC> Certain C constructs like:

    MC> while (c=4) {
    MC> }

    MC> look fine, but are disasterous (note this is an assignment, not a comparison
    MC> [==]).  (You can do the same thing in an if statement).

Certainly, but Pascal also has different operators for variable
assignment (":=") and equality comparison ("=").  So it's not really
the syntax here, I think, but the fact that an assignment is an
_expression_, with a value, and that the test of a while or if is not
required to be a boolean.

    MC> Misplaced semicolons also wreak havoc.  For example,

    MC> while (c==4);
    MC> {
    MC> }

    MC> Now we've created an infinite loop!

But my experience is that students learning C/C++ quickly learn where
the semicolons go; while students learning Pascal are never quite sure.

    MC> The real problem is that these types of things are LEGAL C programs.  They
    MC> just don't do what you would expect at a glance.

Students are quite adept at writing legal Pascal programs that don't
do what they expect, too :)

I think part of the problem is that C++ (especially without the OO
features) doesn't have enough "structure".  Student projects end up as
a collection of top level functions in a single file.  Pascal's nested
functions and procedures provide some guidelines to students when
answering the question "what do I have to think about to understand
how this works".

--
Kevin Millikin          Software Engineer
[log in to unmask]    Architecture Technology Corporation
The above opinions are mine, not my employer's.

ATOM RSS1 RSS2