# Programming language for teenagers

I have been asked to give an introductory programming course for kids between 14-15 years old. Scratch seems like a good option for young children, maybe up to 12 years old. Python, is also a good language for beginners.

I need help from educators to choose between the two options for the mentioned age group. I'm afraid that Scratch might be too childish for them, while Python might be too complicated.

Update

Basically, the course will meet once a week. However, I have relative liberty in deciding how long the session is and how many weeks the course will be. Actually feedback in this regard is also appreciated. I want the session to be long enough to be productive, but not boring long. My initial thought is meeting for 1.5 hours each week for 6 weeks, and then deciding whether follow up course is a good idea.

I can't say much about the background of the kids. This is part of an extra-curricular school that meets every weekend, and I volunteered to give a programming course to the children to make them more interested in technology.

Update2

The age range was a bit different from expected. The kids were between 10-15 years old.

I started the course with Python and used Turtle library to have a visual output. The kids had some progress, but I felt it was slow and it was a bit hard for some of them to grasp some basic concepts.

After five or six weeks, I decided to switch to Scratch. The progress rate improved significantly. However, a few of the kids who were good with Python complained that Scratch is a language for little children that you can't do 'real' things with. It's definitely hard to please everyone.

• Welcome to Computer Science Educators! You've come to the right place :) Can you give a few more details? How often will the course meet? Are there any additional goals beyond "introductory programming"?
– Ben I.
Jan 17, 2018 at 12:57
– diaa
Jan 17, 2018 at 13:58
• Jan 17, 2018 at 14:55
• Python is used for AI and machine learning research, and I have interfaced with enterprise systems written in python. It is not to be laughed at. Jan 23, 2018 at 3:11
• Commenting on update 2. That is expected as the kids were in different stages of development 10-15 crosses the boundary a bit. If you do it again, you could try to split the group at around 12, but give each kid the option of the Scratch group or the Python group. You can be a bit deeper with the latter. But you can do "real" things in Scratch, actually. Feb 12, 2019 at 1:10

I highly recommend checking out a language called Processing. Processing is designed for novices, and makes it easy to create visual and interactive programs without a ton of boilerplate.

Here's an example Processing sketch:

void draw() {
ellipse(mouseX, mouseY, 25, 25);
}


This is a full program that draws a circle wherever the mouse is, 60 times per second.

Related:

Shameless self-promotion: I wrote a series of tutorials for Processing available here. I'd love to talk more about using these in a curriculum.

• Processing is Java based. If that puts a knot in your stomach, the Processing Foundation has extended their library to work with Python and Javascript. Jan 24, 2018 at 21:04
• I'm happy to see Processing mentioned here. I teach students in the same age range as OP's, and I this year I had to replace a teacher that had been using Pascal as an introductory language, which the students hated. I finished the main topics in Pascal and used Processing as a pain reliever. I'm planning on using Processing (python) as the introductory language this year, and the links you shared are going to help me decide and convince my partners. Jan 27, 2018 at 15:05
• @AntonioJunior and Kevin Workman I've created a Stack Exchange chat room, in case y'all want to move over there. All the existing comments have been migrated over there, so I've deleted them. Jan 30, 2018 at 14:46

## Tl;dr: use python. (Preferably python 3.)

Well, I’m a teenager in your age group, so hopefully I’m some level of qualified to respond.

I have to say as a bit of a disclaimer that python is my favorite language but it is in that position for a reason. Scratch is, for me, annoying to write because I can touch type so python is just faster. Further, I actually have always found scratch a bit non intuitive while on the other hand I have always found python incredibly intuitive but also very powerful - it grows in capability along with you.

When I first started programming I used khan academy’s introduction to JavaScript, and then at some point I transitioned to python and have used it since. I have never felt either overwhelmed by or limited by python. My next thought would be that as 14/15 year olds, you’re going to have kids with a wider range of abilities and python can handle that better than scratch.

There are as has been mentioned many resources for teaching python out there. I’d recommend codecademy for learning and repl.it for personal projects - they can then access their work when the camp is over and it provides autocomplete and other useful features. Another thought - since python has so many packages, maybe let them split up by what they are interested in? Python can do websites, games, scientific programming (math fans can work on the Euler problems), or mod Minecraft. (Scratch, I might point out, is limited to games.)

Hope this helps, and I’d be glad to talk with you more about resources, etc.

• Thanks for sharing your experience. Would you mind sharing as well how old you were when you started learning programming, and if it was completely self-taught?
– diaa
Jan 22, 2018 at 12:53
• @diaa to be quite honest, I'm not sure at what age exactly I started - especially because, when I did start, it was pretty on and off. I guess I probably started programming more seriously at...12? 13? but I've been programming since at least several years before that. I used Khan Academy alone to teach myself when I started out, and then used codecademy to switch to python (and a little later found out about stack exchange/stack overflow, which was super helpful). So - if that counts as self-taught, yes? I never took a class to teach me. Jan 24, 2018 at 21:11

Here's an unlikely answer: Teach them C.

You're correct, Scratch will be a turn-off to an average 14 year old.

Mid-teens dislike things that seem fake and/or useless, and have a strong aversions to things seemingly geared toward younger children.

Python is probably an OK option... but I believe Python is a little too high level, using concepts that may seem very abstract to a beginner. A small line of python can contain a lot of abstract concepts that aren't easily met by the early-teen brain.

Don't get me wrong, I love Python.
But I already know what a pointer is, I know what variables are, arrays, classes, etc.
If I did not, I would appreciate a language that didn't gloss over everything.

When teaching fundamentals, the number of lines of code is secondary to the ability to understand and illustrate concepts core to your curriculum.

C is one of the most fundamental languages, and learning C will give you a solid understanding of the basics.

I prefer to begin with something real, but simple. Not simple in the sense that we are constructing programs with colorful shapes, stacks of cards, or a friendly caterpillar, but simple in the sense that on the surface we have 32 keywords, and everything is built on that.

When teaching a young teen, here are some key factors I found helpful: 1. Teach them something that is real, clearly not just a toy.
2. Keep concepts granular.
3. Allow them to stretch and delve deeper than the standard lesson (often giving a student the ability to leap a distance ahead will keep them engaged while other students maintain standard progress)
4. Give them a simple, light-weight, environment to work in. Easy to set up, and easy to get going.

Back in the stone age, when I was learning programming. I took my floppy disk with QBasic everywhere I went. Portability was a big reason I stayed plugged in. QBasic allowed me to get going quickly, learning at a pace that my appetite set.

Today, I would recommend something like Code::Blocks. Lightweight, easy to get started and installed, and you can start with C.
Don't want to install anything? Try Learn-C.org.

C is a great language to start learning with.
You can begin with simple concepts, simple operators, simple variables, types.
Then dive into arrays, and you'll quickly find that the topic of arrays is a big concept for a 14 year old mind.
Loops and functions, function recursion, etc.

C is an excellent first language for teens, and perfect for an introductory programming course.

• And then you can show them all the footguns, giving them an appreciation for memory-safe languages!!
– cse
Jan 22, 2018 at 22:34
• But don't you agree that C usually requires higher overhead from the programmer to produce something interesting compared the Python? I think teens like to see the fruit of the efforts quickly. Even as an adult who used C for years, I wouldn't consider solving a problem in C over python unless the performance was an issue.
– diaa
Jan 22, 2018 at 23:19
• @diaa Of course C usually requires higher overhead to produce something interesting, but this is a beginners programming course for teens. The concept of arrays and pointers are complicated for teens. C is a great teaching tool for learning programming. It's the same as when teaching basic math, the concept of "showing your work" rather than jumping straight to an answer. C is showing your work, Python is jumping to the answer. Jan 23, 2018 at 2:26
• I think maybe it's time for me to learn C. Even if I don't move from there to C++. Good answer and good resources. Feb 23, 2018 at 0:13
• Forgive me, but you should check out modern C++ it has proved over and over again to be the best first language and unlike many misunderstandings it is not an object-oriented language only to explain why let's say that modern cplusplus does not use pointers anymore which is the greatest complaints about teaching C for beginners yet it keeps the understanding of how the machine works there are many papers published about the advantage of using C plus plus as a first language Aug 27, 2019 at 6:19

I think it largely depends on the kids. If you are proficient in both you might even want to give them a choice (as a class, not individually). Show them a bit of each in the first session and let them discuss the options. It might make them more connected to the course, in fact.

Either is appropriate in general, but the background of the students might also be relevant. Is it a random selection or self-selected interested kids or a captive audience? Knowing that might push you toward the more or less "sophisticated" option.

Even Java with a tool like Greenfoot might work for you since it is very visual and has quite a lot of support through greenroom.greenfoot.org. The greenfoot folks are working on a scratch-like environment at this time, but its introduction may be a ways off. It does, however, include a language simpler than Java (Stride) with nearly the capabilities of Java (and translations between it and the full language).

Note that there are quite a number of books for teaching Python to kids. A search at Amazon, for "Python for Kids" will turn up several, including a book with that title. I don't find that particular book especially inspiring, however.

If you choose Python, I'd suggest also finding a suitable environment (i.e. something richer than idle) to provide support, with code management, code completion and the like. Scratch will provide much of that, but you might not want to have the choice Scratch v. "Naked Python".

• I am familiar with both languages. However, giving the kids a choice might not be the best idea because I don't think they have a good tech background besides the smartphone-using experience. I updated the question with more details about that.
– diaa
Jan 17, 2018 at 14:03
• Actually, their choice needn't be strictly rational. If you were to see brighter faces for one and scornful looks for the other it might sway your choice. You want them excited, not just accepting. Jan 17, 2018 at 14:06
• Actually, even for Python I would base my course on this Coursera course from Rice University: coursera.org/learn/interactive-python-1 They make a simple game in every lesson. So I'm not completely dismissing the idea.
– diaa
Jan 17, 2018 at 14:22

If your kids are into making things they can see or hear, why not give SonicPi a try?

It will give immediate audible results and teach a fresh beginner the basics of assigning variables, looping, writing functions to group like events/actions, and teach a general sense of sequence (this before that) as well as simple troubleshooting (it doesn't sound right, but where is the mistake?)

One of the things that I did as part of an undergrad research (that unfortunately didn't get very far due to time) was to gather information on how to create a curriculum that would bridge the gap between computer science and music, as part of a joint collaborative of both departments at my university. Things I found while looking into Sonic Pi is that it is actually a very good "first" language and a good environment to break into the shell of programmable music. It is also a good way, likewise, for a programmer to learn a bit about music and how it all works.

Much of today's music is synthesized, and is in a standard popular song format, meaning that there are sections that loop. If the end result is to create a standard 3-minute length song, for example, things that need to be learned first are a few key things about music theory (which, for the basis of "song-making" and not necessarily serious composition, are fairly simple and can be picked up along the way), but as for the technical/programming side of things, a newcomer would also have to pick up a few essential skills.

Day one would be preparing the environment. Installing the OS and the packages required to run the environment on which it runs.

Day two would be the first few standard expressions. Subsequently, learning about MIDI inputs and what each number represents (pitch, velocity, etc.). You assign an instrument to a variable and call the variable when you want to output the sound.

From then on begin the real fireworks. Programming variable instruments to play on a timebase. Looping sections of timed variable instruments (standard loops, such as do-while) to create riffs.

After that, creating functions that will group a section of riffs to make an audible passage. Passing parameters onto these functions to apply effects, volume/loudness, etc. Learning about constructors, getters and setters. Working with libraries (such as randomizers).

The end result is something that's engaging, fun to play with and discover, and imparts an essential understanding of underlying concepts, so that when they jump into a formal language, much of the foundation is already there and the daunt of the challenge of learning something that might as well be "in another language" is lessened.

Another possibility (if you have the money) would be something like Lego Mindstorms.