
Ask HN: What would you teach adults new to programming in a 2 hour class? - brw12
I teach what I call &quot;creative technology&quot; to kids (my company is adaandleo.com). Parents keep asking me to teach THEM about this stuff. In particular, I keep getting asked, &quot;How can I understand what programming IS?&quot;<p>In other words, what these parents want is:<p>* a taste of what the experience of programming is like<p>* to experience what&#x27;s unique to computer science, as opposed to adjacent fields<p>* to walk away feeling that they have programmed<p>What they are not looking for (from me):<p>* useful vocational knowledge (I mean, they wouldn&#x27;t mind some, but that&#x27;s not the point)<p>* the same circuits-Scratch-3d design &quot;art class and tech class had a baby&quot; curriculum I give kids<p>HN, any ideas?<p>Some things that come to mind:<p>* I could use a platform like coderpad.io to manage coding environments in a lightweight way<p>* It seems to me that Python and Ruby are roughly  close to the sweet spot of clarity to a beginner; I want to avoid too much cleverly terse syntax, and be able to focus on basic building blocks such as arrays, functions, and loops.<p>* I keep coming back to CS intro concepts like sorting arrays and recursion, but a) I&#x27;m not sure how to neatly visualize these, and b) I worry they&#x27;re not really that representative of programming work<p>* on the other hand, if I were TOTALLY realistic I&#x27;d have them try to update XCode certificates for two hours :)
======
kenshi
I think I would do the following:

\- set up a web page with some minimal and familiar interactions.

\- with the adult student, visit that webpage and let them use it.

\- then bring up the browser's web dev tools and show them some ways they can
modify the content and behaviour.

\- to wrap up maybe go to a website they use regularly, and bust out the web
dev tools and do some minor modifications.

Why I think this approach would be good:

\- people are familiar with web pages, so it provides them with some context
of programming and how it effects the 'real world'. (Different to just
programming something that would seem highly abstract, such a command line
app)

\- letting them see the web dev tools after having interacted with the page
would hopefully enforce the idea that they are going behind the scenes/seeing
the insides of something they use. The idea that code and programming 'powers'
things they use.

\- modifying the code, should give the student that they can manipulate and
change what they are interacting with on the screen. Again, conveying the
power of programming, and perhaps a taste of what its about.

\- final thing is to modify something/peek behind the curtain of something
they like and use often. Hopefully to convey the idea that fundamentals of
programming apply to the big brand websites as much as the toy website they
have been playing with.

I'd be interested in hearing feedback on the above approach!

~~~
dorfuss
I absolutely agree - it has to be something in the browser, because it has to
be familiar and visual. No theory. Open the source, show people how simle html
1.0 elements work. Bold, italics, paragraphs, some simple styles. Then people
would be able to see the link between the code and how it translates to what
is displayed. I am not sure if 2 hours are enough to introduce javascript, but
that is definitely the way to go next - you put a little script, like:
calculate something easy, and diplay the results. But it shouldn't be about
math, it should be about colours, shapes etc.

The third step would be about making them understand the difference between
client and server side programming and between programs in the browser and
standalone programs. But that's only if they get the first part.

I would also stress, from the very beginning, that it's really simple, that
there is no magic or super-powers involved. Open a popular news website, open
the source and change the articles on the New York Times website. You want to
achive the "aha!" effect within the first 2 minutes, so that they are
encouraged and positive about the idea. It's a small lie, but an important
one.

------
gingerbread-man
I don't think it's possible to do any better than this:
[https://www.youtube.com/watch?v=dlbMuv-
jix8](https://www.youtube.com/watch?v=dlbMuv-jix8)

Admittedly, when I found my way to Sussman's course, I had already been
programming for awhile, so the "magic" was less of _Wow, I can write a
computer program that does neat stuff!_ and more _Wow, this makes everything I
've been doing so much more clear and simple!_

~~~
ev_rolfe
I don't think that the average person taking an introductory program course
has any interest in calculating the sum of squares or fibonacci numbers. May
be alright for MIT students in 1986 but in 2017 people want to know how
websites and phone apps work.

------
matt_s
Simple: build a calculator. They are adults and should know basic math so they
have a comfort zone and would know if the computer did it right.

Introduce loops (add a string of integers like "1 2 5 8"), functions to run
those (add, multiply, etc.)

Don't get all computer science-y on them with recursion, sorting or stuff like
that in the first 2 hours of an introduction.

It might be a lot of work to setup 20 computers with something like Ruby or
Python - assuming you ask them to bring their own laptop. That might take 2
hours itself. Just find some online Javascript (shudder) editor thing which
will allow them to build a basic calculator - no UI though, that's too complex
for 2 hours.

Programming is just telling a computer to do things. They are parents and
should be familiar with that concept, except the computer will do exactly what
they ask, unlike kids.

~~~
dorfuss
Definitely NO! Not another calculator!

------
js2
I don't know, is 2 hours long enough to walk them through a spell checker?

[http://norvig.com/spell-correct.html](http://norvig.com/spell-correct.html)

OTOH, [http://norvig.com/21-days.html](http://norvig.com/21-days.html)

------
brw12
Thanks for these ideas, all! I like the approach of using the browser console
and source inspector, though that has the problem that everything gets reset
if you reload -- there's not really a way to save your work or see the js code
you're building up in one place. So I don't think I'll ONLY do that.

Doing JavaScript in a jsbin-type environment seems like a good way to go. I
think it would also be good to show them how to post a simple bootstrap page
online. Maybe I could:

start them in jsbin with a minimal HTML page with no styling (10 min)

Have them add a few elements; Point them to a cheat sheet of commonly used
tags (10 min)

Add Bootstrap and jquery; talk about how programmers rely heavily on each
others existing work (5 min)

Make something neat using bootstrap, like a drop-down menu (15 min)

Show them how to post it online... Maybe using one of those super simple drag
and drop hosting demo sites, maybe using GitHub pages, maybe just using
jsbin's static urls (5 min, using jsbin)

Make a text input and have it do something cool like simultaneously change the
headline of the page (15 min)

Show them you can inspect and tweak your page (10 min)

Show them you can do the same with nytimes.com; tweak headlines and styles (10
min)

Give them a very simple program in C that inefficiently sorts a random array
with a size that is set in a variable and prints out the result (10 min)

Show them how to compile, and look at the resulting binary; talk about the
levels of abstraction a computer has (10 min)

Run the binary. Then try various sizes of array and run them, and report back.
Have students organically discover the importance of time complexity. (15 min)

Explain that part of programming is thinking about the architecture of the
algorithms, edge cases and scaling and how a program performs when unexpected
situations are thrown at it. (5 min)

Explain that most of the apps and programs that use everyday or basically no
different than the programs they just wrote, just a lot longer! (5 min)

Total: just under 2 hours.

Overly ambitious? :)

------
taurath
Get their hands on something usable and relevant as fast as possible. I like
using very precise and specific instructions for creating a twitter "every
word" dictionary bot for instance. Simply exposing people to the idea that
there is a whole world they can interact with with code (via an API) is a very
powerful concept to get people interested in coding. It makes them go "aha!"
when they think of all the apps and technology that use in their every day
life and wonder how things work.

------
fillskills
Perfect - I currently teach this to my sales agents and customer support team
( I am founder at a startup). They come from varied backgrounds and had zero
knowledge of programming. Most of them actually wanted to know some very very
basic things like : \- What is a computer \- What is a program \- How does
internet work

What I taught them in the first two hours: \- What is a computer made of
(Hardware, logic gates, cpu etc) \- What is a program and how it runs on a
server (How does a simple program look like and how does it go from high level
code to being run on a computer) \- How is the internet set up and how does
the browser use it to find stuff \- What is a browser \- History of the
internet \- What is the difference between Front end, middle tier and database
\- Database basics like how is data actually stored physically \- Write a
simple python program

.... and now I go into actually building a website end to end with basic Html,
css, JavaScript, some backend language, database. But thats more than 2 hours.

------
mamaniscalco
I honestly believe that learning to program is similar to learning to speak
languages. You can't truely learn them after childhood. Atleast not in the way
that you could when you were a child - in the way we learn our native
languages. That certainly doesn't mean that someone can't 'learn what
programming is' but I have serious doubts that someone who learns to program
as an adult will ever actually program like a native.

I could be wrong on this and I'm sure there are some exceptions. But I suspect
the answer to your question could only really come from a gifted teacher.
Asking a seasoned developer how to teach someone who has never programmed is
probably akin to asking seasoned artist how to draw like a child. They
probably can't really know the answer because of their level of sophistication
and the fact that their brains have long since migrated the skill from the
section of the brain that learns to the section of the brain that masters.

I'm certainly no teacher but perhaps something with a gentle learning curve
such as basic HTML where the reward to effort ratio is faily high. Or the
classic 'guess a number from 1 to 10' type of program which is easy to
accomplish with a little assistance and teached loops, print to console and
variables.

~~~
ipa711
I don't agree with either of your points, spoken language or programming
language. I served in the military and studied CS. I graduated when I was 31
and have had a great career. I also learned Arabic while in the military. I
don't think there is anything unique about my experience. The idea that adults
stop learning is garbage. The brain is much more complex then that.

~~~
mamaniscalco
I never said adults stop learning. It would be terrible if we did.

But spoken language, absolutely true. For example, my wife speaks three
languages fluently. But she dreams in Bulgarian, because that's what she is.
I've been programming since I was six. Now, almost 50, I see virtually
everything as a process (which is not a good thing, just as my wife). I
strongly suspect that I think as I do because of what I've been doing every
day for over forty years.

I didn't mean to offend. Clearly adults can learn and many can reach
professional level with strong dedication. You are obviously one of them. But
I still suspect that the children the OP teaches will get far more out of the
lessons than the parents if they are taught in the same manner. Ask yourself
if you ever think, count, dream etc in Arabic?

------
gingerbread-man
Two hours isn't really enough time to go from zero knowledge to _programming._
The first two hours or so are, almost inevitably, going to be spent learning
the syntax and the interface; real programming begins when you start using
that knowledge to solve problems.

~~~
johan_larson
I don't know. Assuming you don't have to deal with setup issues (the machines
are ready to go), you should be able to present IO, variables, assignment,
arithmetic operations, IF statements, and loops. Then give them a program that
reads and repeats numbers, and ask them to modify it to print out the biggest
number and the average. You'll have to move fast and just skim the surface of
everything, but that would get them to programming within two hours.

------
ilaksh
2 hours is small. How to open developer tools in Chrome. Change colors on an
existing web page. A 'for' loop with document.write some numbers or something.

Maybe get them to sign up on codepen.io

------
bsvalley
I would expose the potential risk of automation in a near future. Making them
aware of learning something that might disapear in 10 years, for the most
part.

------
Spooky23
Excel VBA with some practical examples.

