
Principles for Programming Languages for Learners - akkartik
http://cacm.acm.org/blogs/blog-cacm/203554-five-principles-for-programming-languages-for-learners/fulltext
======
teach
I've been teaching kids to code for 19 years now, and I still make them do it
the hard way.

Just two days ago this year's crop of 83 students wrote their first Java
programs in Notepad and compiled and ran it from the command-line.

And I have a waiting list to get into my class.

I do work with older students (aged 14-18) and the key is TREMENDOUS support.
I'll happily show them the command-line stuff over and over again for a month
if need be.

And my curriculum goes through the basics of Java _very_ slowly. As I've said
on HN before, I make my students code FizzBuzz, but they will have literally
done 106 complete programming projects before it.

~~~
mikegerwitz
> first Java programs in Notepad

Do you find this to be beneficial? What are your observations?

My first impression would be the frustration with lack of simple features that
programmers take for granted in their editor, like auto-indentation. I can see
the benefit in deferring syntax highlighting, but something as simple as the
former can be unnecessarily off-putting, and distract from learning.

With that said, I try to think back to when I was learning HTML in elementary
school, using Notepad to edit. I was so focused on struggling through
comprehension that typing extra tabs/spaces wasn't what slowed me down. I also
didn't know what I didn't know about editing. But I have observed frustration
in others who didn't know how to program, pounding the tab key or spacebar.
And I did forego indentation in my early days in many instances, because it
was a PITA.

So this isn't a criticism of your decision to have students use Notepad; I'm
just curious of their feedback and your observations. Java indents virtually
every line.

~~~
teach
It's important to clarify that these are brand-new students who have never
coded anything at all in any language. I'm not teaching them Java; I'm
teaching them how to code and Java happens to be the language.

That said, I only make them use Notepad for a day or two. My goal is that they
understand that nothing magical is happening. Java is just text, which can be
written with any suitable tool.

After the first couple of days we switch to Notepad++, which has syntax
highlighting and auto-indent.

(We would use Sublime Text, but the district won't approve "shareware".)

I do have auto-completion turned off in Notepad++, though. In my experience
that only produces beginners that don't actually learn the names of anything.

Auto-complete is super helpful once you have a few years of coding under your
belt, but IMO it is inappropriate for honest-to-god beginners.

~~~
developer2
>> these are brand-new students who have never coded anything at all in any
language

Is this really a thing? I just can't imagine a student going into CS unless
they have at least a bit of experience playing with it in their own time. As
someone who started programming at age 7-8, I just can't believe people go
into CS without a pre-existing interest in the form of a hobby.

Do people really enter into CS for the money grab? No interest in programming,
no idea what they are getting into, and solely interested in the salary once
employed? That seems so counterintuitive based on the reason the majority of
us enter the industry. Maybe this is where the 9-5ers come from? I can't say
this without ego being involved: you can tell the difference between a "real
developer" who spends some time most nights digging into new tech, vs. someone
who is in it for the salary who adds nothing but code debt every time they
touch the codebase because they never improve their skills outside of office
hours. ie: The "senior" after 10+ years whose every commit looks like the work
of a first-week developer.

~~~
teach
Computer science is just an elective at my school. Students can also take a
cooking class as an elective even though they don't plan to be chefs.

Students have room in their schedules for several electives and mine has a
reputation as a tough but rewarding course. The majority of my students just
take a single class and go on to college to major in something else.

Kids have different hobbies. I have students who've been playing soccer since
they were 5 years old who don't play around with a computer for fun. Or they
don't have access to a computer. (Many of my students are on free or reduced
price lunch.)

Limiting the profession to those who started naturally at a young age is a
good way to keep out everyone but rich mostly-white kids with college-educated
parents.

~~~
flukus
> Limiting the profession to those who started naturally at a young age is a
> good way to keep out everyone but rich mostly-white kids with college-
> educated parents.

~$100 (or less for an old second hand laptop plus a basic internet connection
(or the public libraries one) is all that's needed to start programming.

~~~
innerspirit
$100 equals 40 hours of work in a blue-collar job down here in Argentina. It's
probably even worse elsewhere.

~~~
AstralStorm
And if you're coding, you're not training or doing another job. So it is
actually much more.

------
parfe
If excel isn't the first item on your list for teaching programming you're
already out of touch.

Let's pretend you're a high schooler volunteering at a charity.

"Donors who attended our last five fundraisers?"

"Email list for our whale donors from this fiscal year?" (>100, 1000, 100000+
whatever)

"Who are our best fundraisers?"

"Was the dinner last week a success?"

What are the odds the student who can answer these questions is helped by a
teacher who ticks off any of the five principals in the submission? _Logo_?
People aren't drawing basic geometric shapes. "Cognitive load" referencing
_types_? I'm not even sure how to address this. Any beginner expects 1/2 to
display 0.5. That entire paragraph is nonsense. _Be honest_ Ok, learn how to
excel in your field with programming/excel/sql/etc as tools to succeed at your
job. "Computer Science" isn't programming and it isn't a job. Never confuse
any of those. #5 is just generic filler for being a not-bad teacher.

~~~
mikegerwitz
One doesn't need Excel to answer those questions. It has convenient GUI
features, but it can also be efficiently done in a variety of languages made
for processing of data (or even simple command-line pipelines), many better
for the task. That's also a good application for teaching about SQL and
databases. These yield broader skills that can be applied more generally.

In any case: I hope schools don't start with Excel, since that cements
students in relying on proprietary software and Microsoft's suite of software.
If they teach it as a generic spreadsheet program---e.g., the same things can
be done with LibreOffice---that's another thing.

~~~
lbotos
You expect your average high school student volunteer to be comfortable with
command-line pipelines or be briefed in that vs. just using excel??? The
conceptual overhead for a beginner vs. the payoff is just not there.

~~~
mikegerwitz
Command-line was just an example. In some instances, a seemingly difficult
problem can be solved trivially with standard tools found on most Unix-like
operating systems like GNU/Linux.

But if we're talking about programming, then we're not talking about putting
some formulas in Excel---that's what I'd expect of far less technical
positions, ranging from accounting, to data entry, to your average person
looking to understand some simple data a little bit better. Someone trained to
use Excel is stuck with morphing problems into Excel's domain rather than
being able to apply general building blocks to other problems.

You can do some pretty complicated stuff in Excel that requires strong
technical skill; I'm not implying otherwise.

~~~
klibertp
> a seemingly difficult problem can be solved trivially with standard tools
> found on most Unix-like operating systems like GNU/Linux

You forget how difficult is getting to the point where you can "trivially"
solve problems at the command line. For one you need to be aware of the tools'
existence and then understand their functions and how they cooperate and fit
in together.

~~~
mikegerwitz
That is the job of the teacher.

My argument is that time can be better spent teaching general skills than
teaching students how to be locked into a single proprietary program and try
to force certain topics into its domain so that they can use the tool familiar
with them (Excel) to solve the problem.

~~~
cjs_2
It should be the job of the environment. While i agree about learning general
skills, Let's face it that Unix commands just aren't discoverable outside of
the curated list by a teacher or other resource.

------
20years
"We are doing a disservice to kids by assuming that they can't grasp industry-
standard languages, complex computer science topics, and applications. By
limiting them, we undermine their capabilities and stifle their creative and
inventive potential."

I have felt this way for awhile with the direction some of these learn to code
courses take with the younger kids. I think we sometimes forget just how
quickly younger kids learn. They soak things up so much quicker than adults
and even teens.

Last summer I ran a learn to program class for 8 to 12 year olds and it was a
very interesting experience. We taught them how to program Minecraft mods in
JavaScript. The biggest hurdle was critical thinking and trouble shooting.

We taught groups of 15 kids at a time and out of each group only 1 to 2 kids
had the critical thinking/trouble shooting skills needed for programming.
These kids were the ones that really excelled in the class and wanted to learn
more. They couldn't get enough.

By making things too easy, I worry we are losing those 10% of kids that have
the potential to be really great programmers. That 10% get bored with the drag
and drop stuff and bail out if they are not challenged.

~~~
wccrawford
I think the easiest solution to that is to give them time to challenge
themselves.

I was _very_ bored in school, and I usually found some way to entertain
myself. If it was a subject that I was interested in (like programming!) it
meant that I spent time writing other programs while I was waiting for the
rest of the class.

I would have preferred a stronger class for _me_ , but this was the second
best thing, I think.

------
phlakaton
I agree with the principles, but I am curious what so-called "coding app
programming" approach they're referring to. I strongly suspect it's a straw
man.

I taught a semester of CS to high school students in Snap!, a derivative of
Scratch. It's a coding-with-blocks app and we did go through a sequence of
game projects with it. But it's unfair in the extreme to say students are not
learning real CS by going through it. Here's what we covered:

Algorithms and algorithmic thinking (one of the first things we hit upon!) \-
Data types and variables \- Data representation \- Binary arithmetic \- Scope
(to some extent) \- Conditionals and boolean expressions \- Loops \- Modeling
and simulation \- Event-based programming \- Functions and procedures \-
Prototypal OOP

And all this while keeping high school students engaged with extremely limited
time.

The curriculum I linked elsewhere on this thread if you're curious.

I think that, given the time and size constraints of an American high school
class, the emphasis on keeping the cognitive overload constrained is
paramount. And that includes as little yak shaving as we can get away with!
Any attempt to evaluate a PL for intro really _really_ needs to look carefully
and honestly at the yaks - in the language as well as the programming
environment...

~~~
mathattack
I agree. I dismissed Scratch as a toy, and then saw my kid doing logic, loops,
variables, procedures... It was more advanced that anything I learned up until
AP Computer Science. (And now he wants to learn Python)

~~~
blendo
And now a derivative of Scratch can take you through the new AP "Computer
Science Principles" course. See
[http://bjc.berkeley.edu/](http://bjc.berkeley.edu/), which says: "Snap!
(formerly BYOB) is a visual, drag-and-drop programming language. It is an
extended reimplementation of Scratch (a project of the Lifelong Kindergarten
Group at the MIT Media Lab) that allows you to Build Your Own Blocks. It also
features first class lists, first class procedures, and continuations. These
added capabilities make it suitable for a serious introduction to computer
science for high school or college students."

~~~
phlakaton
Yeah, the language goes into some pretty advanced territory, though our class
didn't stick with it that long. We did use BJC as a secondary source though.
Good stuff!

------
bluetwo
Where do students learn how to understand a problem, break it down into parts,
document requirements, and plan development?

~~~
jakub_h
Presumably, in a How-to-Design-Programs-based curriculum.
([http://www.htdp.org/](http://www.htdp.org/) ,
[http://www.ccs.neu.edu/home/matthias/HtDP2e/](http://www.ccs.neu.edu/home/matthias/HtDP2e/))

------
AstralStorm
A funny question: wouldn't it be easier to teach students assembly in a good
environment that can diagnose errors instead of crashing and burning?

It is easy syntax, no extra concepts. Then pick some sort of structural
language, and then go further...

Come to think of it, might be as successful as Logo but more gradual and
useful. Everything is explicit.

~~~
tyleraldrich
I think to actually learn Assembly, you need to at least have some idea of how
a computer works on the inside. Knowing what a register is, what pointers are,
what memory even is, is necessary to make anything besides "add 1 and 1." I'd
encourage any CS major to learn assembly, but imo it's definitely not a
beginner-friendly thing.

------
AstralStorm
Logo is more like low threshold, low ceiling. A good benchmark is if you can
implement differential calculus in said language, while also drawing pretty
pictures and playing sound, with real time input. In other words, implement a
full 3D video game.

Logo fails this criterion as far as I am aware, Pascal and Squeak do not.

------
gameofdrones
Ahh, fondly remembering LOGO for the Apple II in grammar school when I was
about 6.

------
known
[https://en.wikipedia.org/wiki/Test-
driven_development](https://en.wikipedia.org/wiki/Test-driven_development) is
good for teaching programming

~~~
teach
I disagree with this for true, absolute beginners.

In order to do TDD, students have to know enough to write an object with
methods or -- at minimum -- a function.

My students do seven assignments before they even see a variable. They've done
25 assignments before they write an if statement. They do 76 assignments
before they see a function.

My second-year kids can do TDD and it works pretty well.

But for students with literally zero experience coding, TDD means you're
skipping a LOT of basics. Or throwing a lot of unnecessary complexity at them
before they even know the basics.

~~~
akkartik
Do you have any pointers to such assignments?

I've been teaching programming 1-on-1 with mild success by introducing
concepts related to teaching fairly early:
[http://akkartik.name/post/mu](http://akkartik.name/post/mu). But I'm very
conscious of what I don't know, and eager to learn more.

~~~
teach
These were my classroom assignments in 2012. My current assignments use my
book, but the basic sequence is the same.

[https://programmingbydoing.com/](https://programmingbydoing.com/)

~~~
akkartik
Thanks!

Drat, I just realized that I mistyped my original comment. I meant to say,
"I've been teaching programming 1-on-1 with mild success by introducing
concepts related to _testing_ fairly early.." Hopefully that wasn't too
confusing.

------
hairy_man674
Here is the opinion of someone who makes a strong normative claim, that not
lacking merit, is typical of one who has had more time to think. The naive
idealism of motivating us" computer science" people to solve non-trivial
problems is in stark contrast to an industry that that is lucrative to the
extent that it satisfies the facile needs of millions of relatively
unintelligent, complacent users.

As long as there is a market demand for these little apps, enterprise
consumers and shitty little ventures millions wills be invested here and
greedy companies and stackeholders will profit. Fuck the poor and ambitious
ideas. There is money to be made!

