[plt-scheme] Perplexed Programmers

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Sat Sep 1 18:34:59 EDT 2007

Got it.

1. We use a dynamically typed language for the following primary  
reasons: teaching a typed language immediately requires teaching a  
proper, enforced syntax of types and a true understanding of type  
checking requires an understanding of the compilation/phase model. In  
my experience, novices are so utterly confused that to them "the  
computer did this to me" is gospel. No need for these useless  
complications.

2. We occasionally exploit the dynamic typing nature with tricks and  
tricky problems. (For example, one assignment uses the return the  
first-symbol-such-that-P-or-false trick.) We try not to do this too  
often.

Why? As we explain in SI CSC, we don't wish to teach Scheme for  
Scheme's sake in this book but use it to prepare students for the  
next course so that some knowledge carries over. It is common for  
6.170 instructors at MIT to say, "okay, forget 6.001, we'll teach you  
programming here." My colleagues at Rice used to start 212 with  
similar words. My engineering colleagues certainly didn't understand  
how students couldn't program (so to speak) if they didn't recognize  
while/for/do/repeat/until/ever/more.

So, I decided to structure the course in a way that would scale to  
what students typically see next: OOP (even if I disagree with this  
being the next choice. I consider it a pragmatic engineering-style  
compromise).

3. I believe that CS curricula should offer a follow-up course to  
HtDP where students continue to explore the idea of 'scripting' as  
opposed to 'program design' using an untyped language. Specifically,  
I would start it with PLT Scheme used for scripting tasks on a Web  
server and Unix (with an emphasis on how basic design principles from  
HtDP work), and I would then cover four or five modules of "scripting  
other systems with popular scripting languages." (This would include  
VB for Excel, PHP for Web pages, RoR, and some more.)  Clearly, this  
is a course where you would point out the nature of dynamic types and  
how they help some times and how they hurt.

Rationale: students who go on co-ops (NU is one of the largest co-op  
programs in North America) and summer internships encounter scripting  
languages but haven't seen much scripting except for what I teach  
them for web page production and web server stuff in HtDP courses. If  
we prepared them for the range of scripting languages to be  
encountered and how knowledge of PLT Scheme helps them get up to  
speed for anything, we would do them a big favor.

[To their credit some of my former students have recognized this  
fact. Some go as far as to attend my middler course to recruit future  
students for web scripting shops.]

-- Matthias

P.S. I have been meaning to write up my curriculum vision as an essay  
for a while. I guess I should do so soon These questions come up time  
and again.



On Sep 1, 2007, at 5:26 PM, Marco Morazan wrote:

> On 9/1/07, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>> Dynamic typing is the default and makes writing simple and
>> nearly useful programs easy at the beginning. What do you
>> mean w/ your question. -- Matthias
>>
>>
>
> Here we have a dynamically typed language over which we impose a
> static typing discipline to develop code. This provides a context for
> learning that is effective and that, no doubt, facilitates the
> transition to statically typed languages. In essence, we are arguing
> for the importance of structural invariants which are not enforced by
> languages such as Scheme.
>
> Dynamically typed langauges, however, are powerful precisely because
> they do not require the enforcement of structural invariants. We can
> develop prototypes, for example, without having to enforce structural
> invariants. This is useful especially when we are not sure what the
> shape of the data is needed (e.g. vague specifications) or when we
> need to quickly develop a prototype (e.g. to determine the shape the
> data must have). Then there are the more subtle issues of being able
> to write useful programs that could never be proven type safe.
>
> So, students ought to know about dynamic typing (and gradual typing
> etc.). When do readers of this list feel it is best to "formally"
> introduce students to the idea of dynamic typing with the goal or
> writing code?
>
> Cheers,
>
> Marco



Posted on the users mailing list.