Live data from Hacker News

Ask HN: How to Teach Coding?

news.ycombinator.com

101–110 of 126 posts

Re: Ask HN: How to Teach Coding?

#101
I have mentored many junior developers through my career. And recently, started to train junior developers as a side gig. (Had been helping friends to get up to speed in their new jobs but wasn't charging anything for it.)

So these are the developers who already have basics of programming but they usually don't understand whole ecosystem around it. For example, many don't understand version control, server vs local env, etc. Normally, many senior developers get really frustrated when junior devs ask them about such basic concepts. I used to be like that too, however, I learned to be patient and tried my best to help them. And some of my teammates started to ask me if I can help their friends in other teams/companies.

So this is what I have learned about mentoring:

* Encouragement - Unfortunately, tech world if full of genius jerks. Many junior developers get discouraged by such behavior. A lot of time I find myself convincing them that they will catch up to senior devs eventually. Sometimes, I feel like I am teaching them how to manage their senior developers/managers instead of teaching them technical topics.

* Find out what their objectives are - Another big issue is that many developers have big egos and they would try to hide their ignorance by asking very specific question. If it's a senior developer, I would just answer the question. However, if it is a junior developer, I usually ask them what their end goal is and many times they are going down the wrong path.

* Let them ask you questions and then use search engines to find answer together, even if you know the answer.

* Code Reviews are great but you have to be sensitive towards junior developers. I usually make a small comment in CR and then meet with the developer to explain it further and to make sure they understand the reasoning completely. For example, many developers from non-English speaking countries have hard time understanding difference between verbs and nouns, and they name variables and methods which are hard to decipher. It is hard to explain that in CR but in-person much easier. Also English is not my native tongue so I also get criticised for my namings too still. So I can understand it can be hard to come up with a good variable name for non-native English speakers.

* Help them find good training material. You cannot spend hours training junior developers, so make a list of good resources to learn from and ask developers to review them. These cannot be 40 hour course, but something more narrowly focused on their current problem.

Re: Ask HN: How to Teach Coding?

#102

1. Tell them what to do but do not tell them how to do it. (Just give a few pointers otherwise they'll be lost.) 2. Give them a playground to fail - Offload any non-business critical tasks and let them make mistakes. No one I know ever learnt programming without making any mistakes. Immediately tell them about best practices and how to avoid such mistakes in future. 3. Show them the impact of their work - There's not…

I have never liked the “make a sandwich” task. It sets people up for failure, because the teacher can always take things literally enough to make the student wrong. (For example, when given the instructions: "Take out two slices of bread", the teacher can rip open the side of the plastic bag rather than use the opening.) Some students end up with the feeling of “If I can’t even explain how to make a sandwich, how wil…

Thank you for sharing this video. It can be more helpful for novices than the flat-out adversarial approach of "I'm going to mess this sandwich at every possible step to show you that you need to be precise".

I've found that learners will succeed when they are able to answer affirmatively these two questions: "can I do this?" (self-efficacy), and "do I want to?" (motivation).

The robot scenario with a handful of commands is preferable compared to the "make me a sandwich" task in both respects, because failing badly at even getting bread out of the bag (say) can destroy both self-efficacy and motivation.

Re: Ask HN: How to Teach Coding?

#103
post #42

Earlier quoted context omitted.

"No one I know ever learnt programming without making any mistakes." True! In fact, I don't know anyone who programs without making any mistake.

I know Chuck Norris

Chuck Norris doesn't program. He stares at the computer till it does what he wants.

Re: Ask HN: How to Teach Coding?

#105

1. Tell them what to do but do not tell them how to do it. (Just give a few pointers otherwise they'll be lost.) 2. Give them a playground to fail - Offload any non-business critical tasks and let them make mistakes. No one I know ever learnt programming without making any mistakes. Immediately tell them about best practices and how to avoid such mistakes in future. 3. Show them the impact of their work - There's not…

I have never liked the “make a sandwich” task. It sets people up for failure, because the teacher can always take things literally enough to make the student wrong. (For example, when given the instructions: "Take out two slices of bread", the teacher can rip open the side of the plastic bag rather than use the opening.) Some students end up with the feeling of “If I can’t even explain how to make a sandwich, how wil…

Sounds like this make a sandwich exercise is rather good for understanding the issues with gathering software requirements; it confronts the students with creeping requirements, before they even know how to code.

Coding should probably be taught with a background of requirements that are precisely given in terms of the abstractions that are being used in the code. So that is to say, the problem itself doesn't have to be something abstract (like a number-theoretic computation); it can be connected to something in the real world. But the representational mapping from that domain to the computer should be established by the teacher, so there is no irrelevant fumbling about the requirements.

In the case of the sandwich, we should provide a procedure which somehow takes the slices of bread out of the bag. Similarly, we provide all other necessary procedures, and only those procedures are to be used. Then we eliminate questions about the detailed requirements about what those procedures themselves do, like can the bag be ripped, or does the removal have to be tidy.

A good domain for teaching coding might be game playing (cards, etc). People understand that the objects used in games are abstract, and that certain details do not matter to the game, like the exact shape of a rook in chess or its precise placement within a square. It could just be the letter "R" in an 8x8 grid of characters (with "r" being the opposite color).

Symbolic games are basically a form of mathematics that is instantiated in the real world whose abstractions people readily understand. Moreover, they have a point (to have fun), so the "why are we doing this" question is settled.

Re: Ask HN: How to Teach Coding?

#106

I teach coding. Here are some of my insights: — Remove the instrumental barriers first. I start with teaching the basics of UNIX shell, navigating the file system, processes, editing files etc. Students will move much faster if they do not stumble on basics. — Continue with the notion of system libraries, dependencies and teach how to use system package managers to install stuff. — Explain what APIs are and teach how…

It's definitely good when you can make the time and space to build up all the concepts from scratch. In retrospect, I should have done this with my last trainee. Smart person, fast learner, but so many pieces were missing. The worst thing was being deeply hesitant to do anything at a command prompt. There's only so far you can get if everything you do is mediated by a GUI. If I had it to do over, I would have forbidden IDE use for the first month. I think it was deeply damaging.

Re: Ask HN: How to Teach Coding?

#107

Remembering the very first course I received at 9 y.o. (logo with turtle) the pleasure came from seeing the actual output of the program on the screen: a drawing. Remembering my first C course at 20, whose program was a one liner designed on purpose for us to understand nothing: don't be afraid to tell "I cannot explain you that now" (e.g. why #include). Today if I had to choose a language/platform to teach coding, t…

Going on with my Arduino idea: when they have enough of C you can do some assembly. You can teach interrupt handling, the source of all concurrency on a single core, in C or asm. You can do communication on an unreliable link (2 boards & LEDs), sensor conditioning. A wheeled robot may help some students "seeing the world from the computer eyes", although they may be a bit too old for that.

Of course data structures are best taught in C on a desktop. Functional programming is certainly interesting but further apart from how a modern computer works.

During my studies I even did opcode programming on antic 8085 dev boards, with a 20 keys keyboard (hex digits, reset, run, memory up/down). You can't imagine how much fun that was, akin to woodworking or pottery. That certainly grounded a number of ideas on programming, that may look otherwise mystic to students.

Re: Ask HN: How to Teach Coding?

#108

1. Tell them what to do but do not tell them how to do it. (Just give a few pointers otherwise they'll be lost.) 2. Give them a playground to fail - Offload any non-business critical tasks and let them make mistakes. No one I know ever learnt programming without making any mistakes. Immediately tell them about best practices and how to avoid such mistakes in future. 3. Show them the impact of their work - There's not…

I have never liked the “make a sandwich” task. It sets people up for failure, because the teacher can always take things literally enough to make the student wrong. (For example, when given the instructions: "Take out two slices of bread", the teacher can rip open the side of the plastic bag rather than use the opening.) Some students end up with the feeling of “If I can’t even explain how to make a sandwich, how wil…

That video was super-helpful. I believe he is a CS instructor, and his methods are easy to explain and understand, unlike a lot of class that just rush the students into learning bunch of technology before really learning how to think like a programmer.

Also there's his follow up video where he solves the puzzle (https://www.youtube.com/watch?v=z5VKyKvgyRs). Another helpful video is him teaching how to go through a program by hand, using pen and paper (https://www.youtube.com/watch?v=9Ahejeuasf0)

Re: Ask HN: How to Teach Coding?

#109
post #66

I teach coding. Here are some of my insights: — Remove the instrumental barriers first. I start with teaching the basics of UNIX shell, navigating the file system, processes, editing files etc. Students will move much faster if they do not stumble on basics. — Continue with the notion of system libraries, dependencies and teach how to use system package managers to install stuff. — Explain what APIs are and teach how…

Interestingly, I learned to program in a completely different way. When I started in 1979, the computer terminal where I learned could only run BASIC. There were no directories, just BASIC. We had one book that could teach you most of the commands, IF--THEN GOTO, SET, PRINT, FOR, NEXT, GOSUB. There was no WHILE statement. I think I spent months playing with those before learning about arrays. The biggest breakthrough…

Similarly enough I went from BASIC to Pascal to C. Actually I tried to go from BASIC to C, but that was a bridge too far due to my lack of visceral appreciation for structure. At that time, Turbo Pascal was a god-send as a development environment - crazy fast, decent editor and library all in one tiny thing. In some sense, I owe any advancement in CS to that tool.

Re: Ask HN: How to Teach Coding?

#110
I also just had my first intern. But I also taught at the college level and have had a few employees. A few suggestions to add to the already good lists here.

1. Tell them _why_ you do something.

This helps with cognitive load while learning, and helps them overcome some mental stress when investing in new techniques/methods.

2. Provide real code examples that work, and demonstrate them.

This is analogous to hearing a song played when learning to play a musical instrument. It's really hard to convert notes to music without knowing how it is supposed to sound first.

3. Be patient and ready to describe things from multiple angles.

I noticed I was more patient with people I have little time with. The more time you spend with someone the harder this gets. So be prepared for this.

4. You are likely to be wrong, be ready to learn yourself.

Every class I taught something slightly off, or made a mistake, or simply a student had learned some obscure thing from the internet that I had not learned myself. I learned alot by teaching others, but also by screwing up in front of an entire class. Be humble, expect to be wrong from day one, and be grateful when you are taught something new from anyone from any skill level.

Note: knowledge is easily attained these days, understanding why you use one thing and not another is not as easily learned. When an old experienced codger on the internet say to do something a certain way, take it really seriously and study why, then you can pass this on as well.

Post reply on HN