最初的问题

我目前正在教我弟弟编程。他完全是个初学者,但很聪明。(他真的很想学)。我注意到我们的一些会议陷入了一些小细节,我觉得我不是很有条理。(但这篇文章的答案有很大帮助。)

我怎样才能更好地有效地教他?是否有一个逻辑顺序,我可以用一个概念一个概念地运行?是否有什么复杂的问题我应该在以后再讨论?

我们正在使用的语言是Python,但任何语言的建议都是受欢迎的。


如何提供帮助

如果你有好的答案,请在你的答案中添加以下内容:

初级练习和项目想法 初学者教学资源 屏幕视频/博客文章/免费电子书 印刷适合初学者的书籍

请用链接描述资源,以便我可以看一看。我想让每个人都知道,我确实在使用其中的一些想法。你提交的内容将在这篇文章中汇总。


初学者在线教学资源:

A Gentle Introduction to Programming Using Python How to Think Like a Computer Scientist Alice: a 3d program for beginners Scratch (A system to develop programming skills) How To Design Programs Structure and Interpretation of Computer Programs Learn To Program Robert Read's How To Be a Programmer Microsoft XNA Spawning the Next Generation of Hackers COMP1917 Higher Computing lectures by Richard Buckland (requires iTunes) Dive into Python Python Wikibook Project Euler - sample problems (mostly mathematical) pygame - an easy python library for creating games Invent Your Own Computer Games With Python Foundations of Programming for a next step beyond basics. Squeak by Example Snake Wrangling For Kids (It's not just for kids!)


推荐印刷书籍的教学初学者

加速c++ Python编程绝对初学者 Charles Petzold编写的代码 Python编程:计算机科学介绍第二版


当前回答

我认为Python是个好主意。我会给他一些基本的任务让他自己去做,并告诉他,他遇到的任何死胡同都可以通过谷歌来解决。至少对我来说,自己解决问题总比别人告诉我解决方案更好。

一些可能的项目(排名不分先后):

Coin flip simulator. Let the user input a desired number of trials for the coin flipping. Execute it and display the results along with the percentage for heads or tails. Make a temperature converter with a menu that takes user input to choose which kind of conversion the user wants to do. After choosing the conversion and doing it, it should return to the main menu. Here's an example of an extended converter with the same idea: http://pastebin.org/6541 Make a program that takes a numeric input and displays the letter grade it would translate to. It'll end up evaluating the input against if and elif statements to find where it fits. Make a simple quiz that goes through several multiple choice or fill in the blank questions. At the end it will display how the user did. He can pick any questions he wants. Take an input of some (presumably large) number of pennies and convert it into bigger denominations. For example, 149 pennies = 1 dollar, 1 quarter, 2 dimes, and 4 pennies. Create a simple list manager. Be able to add/delete lists and add/delete entries in those lists. Here's an example of a christmas list manager: http://pastebin.org/6543 Create a program that will build and then test whether entered numbers form a magic square (with a 2D array). Here's some sample code, but it should really print out the square at each step in order to show where the user is in terms of buliding the square: http://pastebin.org/6544

我还建议用xTurtle或其他图形模块做一些事情,把事情混合起来,让他不会感到无聊。当然,这是非常多的实践编程,而不是很多人真正使用python的脚本,但我给出的例子几乎直接取自我通过python学习的时候,它对我来说非常有用。好运!

其他回答

在浏览了几本免费电子书之后,我发现最适合学习编程的书是O'Reily出版社出版的《Head First Programming》。它使用Python作为语言,并从一开始就为您提供程序。它们都比“Hello World”更有趣。 我花在这本书上的钱是非常值得的,因为它已经发布了一段时间,你可能会在Ebay或亚马逊上找到更便宜的二手书。

对我来说,在IDE中探索和实验帮助我学习了Java和Visual Basic,但我学习编程的基础是艰苦的:Perl 5。那时候还没有一个免费的IDE,所以这意味着在记事本中输入代码,保存它,然后运行perl解释器。

我想说ide使学习编程基础更容易。先试试控制结构和变量。用Java说:

int a = 5;

for (int i = 0; i < a; i++) {
     System.out.println("i is now " + i);
}

基本上,简单地学习控制结构和变量就可以让初学者开始编写有趣的东西。

我不得不与几个初学者(从未写过一行代码)程序员一起工作,今年秋天我将与高中生一起参加一个课后研讨会。这是我找到的最接近文件的东西了。这项工作仍在进行中,但我希望它能有所帮助。

1) FizzBuzz。从命令行程序开始。你可以很快地编写一些有趣的游戏或工具,而且你可以很快地学习所有的语言特性,而不必先学习GUI工具。这些早期的应用程序应该足够简单,你不需要使用任何真正的调试工具来让它们工作。

至少像FizzBuzz这样的项目都是很好的项目。最初的几个应用程序不应该处理db、文件系统、配置等。这些概念只是让大多数人感到困惑,当你只是学习语法和基本的框架特性时,你真的不需要更多的复杂性。

一些项目:

Hello World! Take the year of my birth, and calculate my age (just (now - then) no month corrections). (simple math, input, output) Ask for a direction(Up, down, left, right), then tell the user their fate (fall in a hole, find a cake, ect). (Boolean logic) FizzBuzz, but count once every second. (Loops, timers, and more logic) Depending on their age some really like an app which calls the users a random insult at some interval. (Loops, arrays, timers, and random if you make the interval random)

一旦他们很好地掌握了语言功能,你就可以开始一个项目(简单、有趣的游戏就可以了。)你应该尽量让第一个项目能够在6-12小时内完成。不要过早地花时间去构建它。让他们去设计,即使它很糟糕。如果它失败了,谈谈发生了什么,为什么失败,然后选择另一个话题,重新开始。

从这里开始介绍工具的调试功能。即使你可以通过阅读代码来发现问题,你也应该教他们如何使用工具,然后向他们展示你是如何发现问题的。这有双重目的:教授调试工具和如何在没有工具的情况下识别错误。

一旦项目开始运作,您就可以使用它来引入重构工具。如果你能用一些你从未计划过的简单功能扩展项目,那就太好了。这通常意味着重构和重要的调试,因为很少有人第一次就能写出像样的代码。

一些项目:

刽子手的游戏 尝试机器人(Vex和Mindstorms都是选择)

开始一个真正的项目,可能需要一些时间。使用适当的源代码控制,并强调有一个时间表。像真正的项目一样运行这个项目,如果没有其他的话,它是处理工具的很好的经验。

显然,你需要为每个人调整这一点。我发现最重要的一点是,即使是第一个简单的应用程序也要适用于用户感兴趣的内容。

一些项目:

俄罗斯方块 基于文本文件的博客引擎 更先进的机器人工作

一行一行地复制一些简单的代码,让他们一边读一边理解。他们很快就会解决的。我开始用Acorn杂志上的代码片段在Acorn Electron上编程。在我6岁的时候,我对编程一无所知,我习惯抄写文本,但渐渐地我学会了不同单词的意思。

Robert Read写了一个很有用的指南,如何成为一个程序员,它涵盖了广泛的编程问题,初学者会发现很有帮助。