Hot answers tagged

43

I'm not as familiar with Python as I am with other languages, but I'm sure your students have played Minecraft. If you haven't, I suggest taking a few minutes to find some introductory "Lets Play" videos on YouTube first. Let's talk Blocks. Minecraft has dozens of blocks. Dirt, some, water, colored wool... All blocks can be broken, picked up, placed, ...


18

A few years ago, the answer to this would have been "stick with Python 2; the libraries aren't ready for Python 3 yet". In many cases, that would have been a deal-breaker, because many of the older libraries were pretty useful, particularly for scientific computation. However, the story's a bit different now, in 2017. There isn't much of a reason to stick ...


16

Too many examples that you find are (IMO) fatally flawed. The Animal->Dog is especially flawed, though widely used. The problem is that these sorts of examples almost require that the superclass has a certain set of public methods that isn't the same as that of the subclass, requiring you to add additional public methods to the subclass. This is because an ...


15

TL;DR Those two aren't your only options. The main concern is cognitive load: learning to program is difficult enough without adding incidental complexity. We've seen an explosion of hybrids in the last few years with good cross-platform support: Sublime, Atom, VSCode, etc. And while you couldn't pry vim out of my cold dead hands, learning it is easy if ...


11

Here are my thoughts on this. Editor and Terminal This is most likely the more lightweight solution. Editor and terminal often don't consume much space (or, at least, come bundled with the operating system so it doesn't really matter) and start fast. Using editor and terminal can demonstrate students that writing a program can be done without using a huge ...


11

Of course it depends on your overall goals. For me, however, the answer is clear: Use the most powerful IDE that I can find (Eclipse or NetBeans fit my def). I started programming on primitive equipment (card punch) and came up through every level since. I don't romanticize the old way of work and I wouldn't go back. I wouldn't try to impose primitive ...


10

Since you specifically mention high-schoolers getting started with open source, i have to recommend the Google Code-In. I participated all 4 years as a high-schooler and really learned a lot about open source. The contest essentially has a dozen or so open-source organizations provide "bite-size" tasks. Each task is mentored, so the students have someone ...


10

Check out the Python books written by Al Sweigart. His homepage Invent with Python includes some great, free resources that are geared to the age range of your students. In particular he focuses on creating games which is, in my experience, an effective hook. Two books to use to inform your teaching are the following (in order): Invent Your Own Computer ...


10

I've got one that might help, modified/simplified from an actual problem I had to solve at my current job. Imagine you're writing a Content Management system - this system will store four types of documents (and the Meta/Index information for them) PDFs (who created, description, file size) Word documents (who created, description, file size) Pictures (who ...


10

In my experience, good introductory programming courses meet three overarching goals: Empower students to create simple programs outside of the scope of the class by giving them the technical skills and the practice to begin being independent. This includes teaching the basics of one usable language. Inspire students to continue learning and using their ...


9

The real question is this: do you want to teach your students what is actually going on, or teach them which magic buttons to press in an IDE? Of course for professional programming work nobody would NOT use the most functional IDE they could find for the task they were doing. But if you throw a complete beginner into the deep end of a tool like MS Visual ...


9

If you teach Python's typing system correctly, you should have no problem later. The rule in Python is that names don't have a type associated with them, but all values do. It isn't that "things" change type. They don't. Objects and other values have a well determined type when they are created and that type never changes. Names never have a type to be ...


9

Unfortunately, GUI programming is sufficiently different from algorithmic programming that if you start with it students can get the wrong idea about what a program should look like. For example, when I write an algorithmic program, using good OO techniques, a method of five lines is starting to be too long. The granularity of a good OO program can be very ...


9

Actually, the code is terrible, but I don't think its purpose is to illustrate a stack so much as to illustrate in a very rudimentary way how heap allocation works. (Worse than "terrible", it isn't "pythonic"). But you are wrong about the efficiency. Only the initialize function is O(n). Push an pop are O(1) as should be obvious. But no serious code ...


7

My coding school gave one particular (weeks-long) project that I felt nailed the concept of inheritance, and why it could be useful: Simulating a circuit board with logic gates. The framework of the exercise can be adjusted, but here's a short example: A circuit board is composed of circuit inputs, logic gates and circuit outputs; each of these ...


7

If you are tutoring her, it is wonderful that you are trying to motivate the material in a practical way, but don't beat yourself up too much if you aren't that successful at persuading her. Some people just get themselves into a sort of myopic headspace where the only things that they need to learn are the exact operations that they will perform later on in ...


7

You certainly don't need a list longer than this one. If you do even half of this you will have learned enough to know pretty much what should be next. Having a complete list now gives you very little. What you really need is practice and feedback. For practice, find some significant problem and build a program to solve it. Use the best methodology you ...


6

I agree with Peter. It needs to be fun, and games really help. It doesn't take much to exercise basic programming concepts such as variables, loops, selection, input, and output. I would start with simple games like Tic-Tac-Toe and Number Guessing Game. Implementing a simple AI would be fun. I've found that in-class programming contests work well too. For ...


5

I like to ease people in. You have mentioned that this is for first year. So, yeah, easing in would really have a positive impact on the overall learning experience. I would like to draw from my own experience between a GUI and command line. When I was introduced to version control, the whole thing was intimidating. I decided to go with the Github Desktop, ...


5

Before contributing to an open source project it can be useful to become familiar with the tools and concepts involved in version control systems. Write some code that is unfinished with some deliberate mistakes and share it with your students on GitHub Get your students to clone / download your code, find and fix the bugs then talk about the problems with ...


5

Maybe it is a bit overkill, but I'm teaching python and C in parallel to CS beginners. The languages are syntactically similar enough to lower the burden of learning two languages, but the students understand the "problem" of typing and get a better idea of what is happening in behind in python. Fun fact: In the beginning, all like Python, because it ...


5

Have you tried a simple statistics formula such as $$mean = \left(\sum_{i=1}^{n} x_i\right) / n$$ This maps exactly to array notation. Explain that the array x refers to the entire set of values and that x[i] refers to a single element in the set. Then show a simple loop that performs the computation.


5

I had a student some time back who also really struggled with concepts like this, but who was interested in research in psychology which for her was largely about statistics. Statistical data is nothing but arrays, or perhaps tables, that is, 2-dimensional arrays. Statisticians conduct trials consisting of observations. An observation is a simultaneous ...


5

Your list of items is very complete and would fill a good part of a Bachelor's degree curriculum. One thing to not overlook is that some of the aspects you highlight make little sense in the context of Python. For instance, interfaces (as in Java Interfaces) express the behavior of classes that implements them, and can simulate multiple-inheritance. In ...


4

Full disclosure: I'm one of the founders of CodeHS. We have a python course on CodeHS that you can try. The curriculum is free to use, and you can sign up as a teacher account to be able to see your students' code and test out their programs. You can see more about the course here: https://codehs.com/info/curriculum/intropython It's designed for high ...


4

I am not aware that cognitive modeling of memory structures in early programming education has been directly studied, so anything that I say here is entirely speculative. However, I suspect that the models themselves would somewhat depend on teacher presentation, and would otherwise be relatively stable. Take negative indexing as an example. A reasonable ...


4

For the editor You can use the same editor for every language. You can use the same editor for every system. You can use the same editor every year: I learnt emacs (and vi) in 1991, and still use them. They are much simpler, and pupils need to learn the editor/ide at same time as the language. IDEs can reinforce the separateness of your program: you program ...


4

Your example demonstrates how to declare and use a function with a parameter, but not why they should do so. Actually, there are no reason (for them) why they should bother with a new concept (function) instead of writing name = input("Enter your name: ") print("Hello " + name) which can be done with the programming elements they already know. And is both ...


4

I'm not a fan of full IDEs for beginners. A few years ago I switched my first year students (Java) from NetBeans to an online tool without any autocomplete or helpers for most assignments and found that they've gotten way stronger at writing code. I think the automatic stuff that helps out while programming becomes a crutch for newbies. Our intro teacher, ...


Only top voted, non community-wiki answers of a minimum length are eligible