教初学者编程的最好方法是什么?

时间:2022-03-30 18:22:14

Original Question

最初的问题

I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. (And he actually wants to learn). I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. (But the answers to this post have helped a lot.)

我目前正在教我弟弟学习编程。他是个新手,但很聪明。(实际上他想学习)。我注意到我们的一些会议在细节上陷入了困境,我觉得我没有组织好。(但这篇文章的答案帮了大忙。)

What can I do better to teach him effectively? Is there a logical order that I can use to run through concept by concept? Are there complexities I should avoid till later?

我能做些什么来有效地教他呢?是否有一个逻辑顺序,我可以用概念来贯穿概念?有什么复杂的事情我要等到以后再说?

The language we are working with is Python, but advice in any language is welcome.

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


How to Help

如何帮助

If you have good ones please add the following in your answer:

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

  • Beginner Exercises and Project Ideas
  • 初学者练习和项目想法。
  • Resources for teaching beginners
  • 教学资源的初学者
  • Screencasts / blog posts / free e-books
  • 视频/博客文章/免费电子书。
  • Print books that are good for beginners
  • 印刷对初学者有益的书籍。

Please describe the resource with a link to it so I can take a look. I want everyone to know that I have definitely been using some of these ideas. Your submissions will be aggregated in this post.

请用一个链接来描述这个资源,这样我就可以看一看。我想让每个人都知道,我确实一直在使用这些想法。你的意见书将在这篇文章中聚合。


Online Resources for teaching beginners:

在线教学资源:


Recommended Print Books for teaching beginners

推荐给初学者的印刷书籍。

86 个解决方案

#1


119  

I've had to work with several beginner (never wrote a line of code) programmers, and I'll be doing an after school workshop with high school students this fall. This is the closest thing I've got to documentation. It's still a work in progress, but I hope it helps.

我不得不和几个初学者一起工作(从来没有写过一行代码),我将在今年秋天和高中生一起参加一个课后研讨会。这是我最接近的文件。这仍然是一项正在进行中的工作,但我希望它能有所帮助。

1) FizzBuzz. Start with command line programs. You can write some fun games, or tools, very quickly, and you learn all of the language features very quickly without having to learn the GUI tools first. These early apps should be simple enough that you won't need to use any real debugging tools to make them work.

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

If nothing else things like FizzBuzz are good projects. Your first few apps should not have to deal with DBs, file system, configuration, ect. These are concepts which just confuse most people, and when you're just learning the syntax and basic framework features you really don't need more complexity.

如果没有其他的事情像FizzBuzz是好的项目。你的前几个应用程序不应该处理DBs、文件系统、配置等。这些概念只会让大多数人感到困惑,当你学习语法和基本框架时,你真的不需要更多的复杂性。

Some projects:

一些项目:

  • 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)
  • 要求一个方向(向上、向下、左、右),然后告诉用户他们的命运(在一个洞中,找到一个蛋糕,ect)。(布尔逻辑)
  • 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)
  • 根据他们的年龄,有些人真的喜欢一款应用程序,在某个时间段里给用户一个随机的侮辱。(循环,数组,定时器,和随机的如果你使间隔随机)

2) Simple Project Once they have a good grasp of language features, you can start a project(simple, fun games work good.). You should try to have the first project be able to be completed within 6-12 hours. Don't spend time to architect it early. Let them design it even if it sucks. If it falls apart, talk about what happened and why it failed, then pick another topic and start again.

2)简单的项目一旦他们掌握了语言的特点,你就可以开始一个项目(简单,有趣的游戏工作很好)。你应该试着让第一个项目在6-12小时内完成。不要花时间提前架构。让他们设计它,即使它很烂。如果它失败了,谈谈发生了什么,为什么失败了,然后选择另一个话题,重新开始。

This is where you start introducing the debugging capabilities of your tools. Even if you can see the problem by reading the code you should teach them how to use the tools, and then show them how you could see it. That serves the dual purpose of teaching the debugging tools and teaching how to ID errors without tools.

在这里,您将开始介绍工具的调试功能。即使你能通过阅读代码看出问题,你也应该教他们如何使用这些工具,然后告诉他们你是怎么看的。这提供了教学调试工具的双重目的,以及如何在没有工具的情况下进行ID错误的教学。

Once, or if, the project gets functional you can use it to introduce refactoring tools. Its good if you can then expand the project with some simple features which you never planned for. This usually means refactoring and significant debugging, since very few people write even half decent code their first time.

一旦,或者如果,项目有了功能,你可以用它来介绍重构工具。如果您可以将项目扩展到一些您从来没有计划过的简单特性,那么它就很好了。这通常意味着重构和重要的调试,因为很少有人第一次编写出一半像样的代码。

Some projects:

一些项目:

  • Hangman game
  • 刽子手的游戏
  • Experimenting with robotics(Vex and Mindstorms are options)
  • 试验机器人技术(Vex和Mindstorms是选项)

3) Real Project Start a real project which may take some time. Use proper source control, and make a point to have a schedule. Run this project like a real project, if nothing else its good experience having to deal with the tools.

3)真正的项目启动一个真正的项目,可能需要一段时间。使用适当的源码控制,并制定一个时间表。像一个真正的项目一样运行这个项目,如果没有其他的经验,必须处理这些工具。

Obviously you need to adjust this for each person. The most important thing I've found is to make even the first simple apps apply to what the person is interested in.

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

Some projects:

一些项目:

  • Tetris
  • 俄罗斯方块
  • Text file based blog engine
  • 基于文本文件的博客引擎。
  • More advanced robotics work
  • 更先进的机器人工作

#2


30  

You could try using Alice. It's a 3D program designed for use in introductory programming classes.

你可以试着用爱丽丝。它是一个3D程序,设计用于介绍编程类。

The two biggest obstacles for new programmers are often:

对于新程序员来说,最大的两个障碍通常是:

  • syntax errors
  • 语法错误
  • motivation (writing something meaningful and fun rather than contrived)
  • 动机(写一些有意义、有趣而不是做作的东西)

Alice uses a drag and drop interface for constructing programs, avoiding the possibility of syntax errors. Alice lets you construct 3D worlds and have your code control (simple) 3D characters and animation, which is usually a lot more interesting than implementing linked lists.

Alice使用拖放接口来构造程序,避免了语法错误的可能性。Alice让您构建3D世界,并拥有您的代码控制(简单)3D角色和动画,这通常比实现链表更有趣。

Experienced programmers may look down at Alice as a toy and scoff at dragging and dropping lines of code, but research shows that this approach works.

有经验的程序员可能会把Alice看作是一个玩具,并嘲笑拖拽代码行,但是研究表明这种方法是有效的。

Disclaimer: I worked on Alice.

免责声明:我在Alice工作。

#3


28  

I recommend Logo (aka the turtle) to get the basic concepts down. It provides a good sandbox with immediate graphical feedback, and you can demostrate loops, variables, functions, conditionals, etc. This page provides an excellent tutorial.

我推荐Logo(也就是乌龟)把基本概念弄清楚。它提供了一个很好的沙箱,提供了即时的图形反馈,您可以演示循环、变量、函数、条件等。这个页面提供了一个优秀的教程。

After Logo, move to Python or Ruby. I recommend Python, as it's based on ABC, which was invented for the purpose of teaching programming.

在徽标之后,移动到Python或Ruby。我推荐Python,因为它是基于ABC的,它是为了教学编程而发明的。

When teaching programming, I must second EHaskins's suggestion of simple projects and then complex projects. The best way to learn is to start with a definite outcome and a measurable milestone. It keeps the lessons focused, allows the student to build skills and then build on those skills, and gives the student something to show off to friends. Don't underestimate the power of having something to show for one's work.

在教授编程的时候,我必须要第二点EHaskins的建议,简单的项目,然后是复杂的项目。最好的学习方法就是从一个明确的结果和一个可衡量的里程碑开始。它使课程集中,让学生建立技能,然后在这些技能上建立,并给学生一些可以向朋友炫耀的东西。不要低估了展示自己作品的力量。

Theoretically, you can stick with Python, as Python can do almost anything. It's a good vehicle to teach object-oriented programming and (most) algorithms. You can run Python in interactive mode like a command line to get a feel for how it works, or run whole scripts at once. You can run your scripts interpreted on the fly, or compile them into binaries. There are thousands of modules to extend the functionality. You can make a graphical calculator like the one bundled with Windows, or you can make an IRC client, or anything else.

理论上,您可以使用Python,因为Python几乎可以做任何事情。它是教授面向对象编程和(大多数)算法的好工具。您可以像命令行那样在交互模式下运行Python,以了解它是如何工作的,或者同时运行整个脚本。您可以运行您的脚本,或者将它们编译成二进制文件。有数千个模块可以扩展功能。您可以创建一个图形计算器,比如与Windows捆绑的那个,或者您可以创建一个IRC客户端,或者其他任何东西。

XKCD describes Python's power a little better: 教初学者编程的最好方法是什么?

XKCD对Python的能力进行了更好的描述:

You can move to C# or Java after that, though they don't offer much that Python doesn't already have. The benefit of these is that they use C-style syntax, which many (dare I say most?) languages use. You don't need to worry about memory management yet, but you can get used to having a bit more freedom and less handholding from the language interpreter. Python enforces whitespace and indenting, which is nice most of the time but not always. C# and Java let you manage your own whitespace while remaining strongly-typed.

在那之后,您可以移动到c#或Java,尽管它们并没有提供Python所没有的很多功能。它们的好处是它们使用了c风格的语法,其中很多(我敢说大多数?)语言使用。您不必担心内存管理,但是您可以习惯从语言解释器中获得更多的*和更少的握手。Python执行空格和缩进,这在大多数情况下是不错的,但并不总是如此。c#和Java让您在保持强类型的同时管理自己的空白。

From there, the standard is C or C++. The freedom in these languages is almost existential. You are now in charge of your own memory management. There is no garbage collection to help you. This is where you teach the really advanced algorithms (like mergesort and quicksort). This is where you learn why "segmentation fault" is a curse word. This is where you download the source code of the Linux kernel and gaze into the Abyss. Start by writing a circular buffer and a stack for string manipulation. Then work your way up.

从那里,标准是C或c++。这些语言中的*几乎是存在的。现在,您负责自己的内存管理。没有垃圾收集来帮助你。这就是你教真正高级算法的地方(比如归并排序和快速排序)。这就是为什么“分割错误”是一个诅咒词。这是您下载Linux内核源代码并凝视深渊的地方。首先编写一个循环缓冲区和一个用于字符串操作的堆栈。然后努力向上。

#4


15  

A good python course is MIT's A Gentle Introduction to Programming Using Python. It's all free online, and you don't have to be an MIT uberstudent to understand it.

一个好的python课程是MIT对使用python编程的温和介绍。这一切都是免费的,你不必成为麻省理工学院的uberstudent。

Edit [Justin Standard]

编辑(Justin标准)

This course uses this free online book: How To Think Like a Computer Scientist
I'm definitely finding it quite useful.

本课程使用这本免费的在线书籍:如何像计算机科学家一样思考,我肯定觉得它很有用。

#5


12  

Python package VPython -- 3D Programming for Ordinary Mortal (video tutorial).

Python包VPython——普通凡人的3D编程(视频教程)。

Code example:

代码示例:

from visual import *

floor = box (pos=(0,0,0), length=4, height=0.5, width=4, color=color.blue)
ball = sphere (pos=(0,4,0), radius=1, color=color.red)
ball.velocity = vector(0,-1,0)
dt = 0.01

while 1:
    rate (100)
    ball.pos = ball.pos + ball.velocity*dt
    if ball.y < ball.radius:
        ball.velocity.y = -ball.velocity.y
    else:
        ball.velocity.y = ball.velocity.y - 9.8*dt

VPython bouncing ball http://vpython.org/bounce.gif

http://vpython.org/bounce.gif VPython弹力球

#6


12  

Begin with Turtle graphics in Python.

从Python中的Turtle图形开始。

I would use the turtle graphics which comes standard with Python. It is visual, simple and you could use this environment to introduce many programming concepts like iteration and procedure calls before getting too far into syntax. Consider the following interactive session in python:

我将使用使用Python来达到标准的海龟图形。它是可视化的,简单的,您可以使用这个环境引入许多编程概念,比如迭代和过程调用,然后再深入到语法。在python中考虑以下交互式会话:

>>> from turtle import *
>>> setup()
>>> title("turtle test")
>>> clear()
>>>
>>> #DRAW A SQUARE
>>> down()        #pen down
>>> forward(50)   #move forward 50 units
>>> right(90)     #turn right 90 degrees
>>> forward(50)
>>> right(90)
>>> forward(50)
>>> right(90)
>>> forward(50)
>>>
>>> #INTRODUCE ITERATION TO SIMPLIFY SQUARE CODE
>>> clear()
>>> for i in range(4):
        forward(50)
        right(90)
>>>
>>> #INTRODUCE PROCEDURES   
>>> def square(length):
        down()
        for i in range(4):
            forward(length)
            right(90)
>>>
>>> #HAVE STUDENTS PREDICT WHAT THIS WILL DRAW
>>> for i in range(50):
        up()
        left(90)
        forward(25)
        square(i)
>>>
>>> #NOW HAVE THE STUDENTS WRITE CODE TO DRAW
>>> #A SQUARE 'TUNNEL' (I.E. CONCENTRIC SQUARES
>>> #GETTING SMALLER AND SMALLER).
>>>
>>> #AFTER THAT, MAKE THE TUNNEL ROTATE BY HAVING
>>> #EACH SUCCESSIVE SQUARE TILTED

In trying to accomplish the last two assignments, they will have many failed attempts, but the failures will be visually interesting and they'll learn quickly as they try to figure out why it didn't draw what they expected.

在尝试完成最后两项任务时,他们会有很多失败的尝试,但是失败会在视觉上很有趣,当他们试图弄明白为什么它没有画出他们所期望的时,他们会很快的学习。

#7


11  

The key thing is that the person in question needs to have some problem that they want solving. If you don't have a program that you want to write (and something sensible and well-defined, not "I want to write the next Quake!") then you can't learn to program, because you have nothing to motivate you. I mean, you could read a book and have a rough understanding of a language's syntax and semantics, but until you have a program that you want written you'll never grasp the nettle.

关键是这个人需要解决他们想要解决的问题。如果你没有一个你想写的程序(以及一些明智而明确的东西,而不是“我想写下一次地震!”),那么你就不能学习编程,因为你没有什么可以激励你。我的意思是,你可以读一本书,对一门语言的语法和语义有一个大致的了解,但是,除非你有一个你想写的程序,否则你永远也无法理解它。

If that impetus exists then everything else is just minor details.

如果这种推动力存在,那么其他一切都只是次要的细节。

#8


8  

I don't know if anyone has mentioned this here, yet, but You might want to check out Zed Shaw's Learn Python the Hard Way

我不知道是否有人在这里提到过这个,但是你可能想要看看Zed Shaw的学习Python。

Hope this Helps

希望这有助于

#9


7  

http://tryruby.hobix.com/">Try Ruby (In Your Browser)

http://tryruby.hobix.com/“>尝试Ruby(在您的浏览器中)

#10


7  

How to Design Programs

如何设计程序

Structure and Interpretation of Computer Programs . Videos lectures at http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/

计算机程序的结构和解释。在http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/的视频讲座

#11


5  

This is a fantastic book which my little brothers used to learn:

这是一本很棒的书,我的小弟弟们曾经学过:

http://pine.fm/LearnToProgram/

http://pine.fm/LearnToProgram/

Of course, the most important thing is to start on a real, useful program of some kind IMMEDIATELY after finishing the book.

当然,最重要的是在读完这本书之后立即开始一个真正有用的程序。

#12


4  

If he's interested, aren't the minor details the good parts? Using python, you've already cut the GUI off of it so that confusion is gone. Why not pick a project, a game or something, and implement it. The classic hi-lo number guessing game can be simply implemented from the command line in 20-30 lines of code (depending on language of course) and gives you variables, conditions, loops, and user input.

如果他感兴趣,小细节不是好的部分吗?使用python,您已经减少了它的GUI,这样混乱就消失了。为什么不选择一个项目,一个游戏或什么,并实现它。经典的hi-lo数字猜谜游戏可以简单地从20-30行代码(当然取决于语言)的命令行实现,并提供变量、条件、循环和用户输入。

#13


4  

I'd just let him write tons of code. Let him drive in everything you guys do, and just be available to answer questions.

我只是让他写了大量的代码。让他在你们做的每一件事上开车,只要能回答问题就可以了。

Believe it or not, after a few months of writings tons of crappy code, he'll start to get the idea and start writing better programs. At that point, you can get bogged down in details (memory, etc), and also talk about general design principles.

信不信由你,经过几个月的冗长的代码,他将开始了解这个想法并开始编写更好的程序。在这一点上,您可能会陷入细节(内存等),还会讨论一般的设计原则。

I've heard that what separates the great artists from the mediocre ones, is that every time they practice, they improve on something, no matter how small. Let your brother practice, and he'll improve every time he sits down at the keyboard.

我听说过,伟大的艺术家和平庸的艺术家之间的区别在于,他们每次练习的时候,都在进步,无论多么渺小。让你哥哥练习,他每次坐在键盘前都会进步。

Edit: [Justin Standard]

编辑(Justin标准):

Esteban, this reminds me of a recent coding horror post, and I do think you are right. But I think its still worthwhile to find methods to guide his practice. No question, I want him writing as much code as he knows how to do. Thats one reason I'm asking for sample projects.

埃斯特班,这让我想起了最近的一个编码恐怖帖子,我认为你是对的。但我认为找到指导他实践的方法还是值得的。毫无疑问,我希望他写的代码和他知道的一样多。这就是我要求样本项目的一个原因。

#14


2  

First of all, start out like everyone else does: with a Hello World program. It's simple, and it gives them a basic feel for the layout of a program. Try and remember back to when you were first programming, and how difficult some of the concepts were - start simple.

首先,像其他所有人一样开始:使用Hello World程序。它很简单,它给了他们一个程序布局的基本感觉。试着回想一下你第一次编程时的情形,以及一些概念的难度——从简单开始。

After Hello World, move on to creating some basic variables, arithmetic, then onto boolean logic and if/else statements. If you've got one of your old programming textbooks, check out some of the early examples and have him run through those. Just don't try to introduce too much all at once, or it will be overwhelming and confusing.

在Hello World之后,继续创建一些基本的变量,算术,然后是布尔逻辑和if/else语句。如果你有一个旧的编程课本,看看一些早期的例子,让他跑过那些。不要试着一次性介绍太多,否则会让你不知所措。

#15


2  

Something you should be very mindful of while teaching your brother to program is for him not to rely too heavily on you. Often when I find myself helping others they will begin to think of me as answer book to all of their questions and instead of experimenting to find an answer they simply ask me. Often the best teacher is experimentation and every time your brother has a question like "What will happen if I add 2 to a string?" you should tell him to try it out and see for himself. Also I have noticed that when I cannot get a concept through to someone, it helps to see some sample code where we can look at each segment individually and explain it piece by piece. As a side note people new to programming often have trouble with the idea of object oriented programming, they will say they understand it when you teach it to them but will not get a clear concept of it until actually implementing it.

当你教你弟弟学习的时候,你应该注意的是不要太依赖你。当我发现自己在帮助别人的时候,他们会开始把我当成是他们所有问题的答案,而不是去尝试寻找答案,他们只是问我。通常最好的老师都是做实验的,每次你的哥哥都有这样的问题:“如果我把2加到一个字符串里会发生什么?”你应该告诉他自己试试。我也注意到,当我无法将一个概念传递给某人时,可以看到一些示例代码,我们可以逐个查看每个片段并逐个解释。作为一种附加说明,人们对编程的新认识常常会遇到面向对象编程的问题,他们会说,当你教他们的时候,他们会理解它,但是在实际实现它之前,他们不会得到一个清晰的概念。

#16


2  

I used to teach programming and your brother has one main advantage over most of my students he wants to learn :)

我曾经教过编程,而你哥哥比我的大多数学生都有一个主要优势:

If you decide to go with C a friend has a site that has the sort of programs those of use from older generations remember as basic type-ins. The more complex of them use ncurses which sort of negates their use as a teaching aid somewhat but some of them are tiny little things and you can learn loads without being taught to.

如果你决定和C一起去,你的朋友有一个网站,它有一些从老一辈人那里使用的程序,记住它是基本的类型。更复杂的是使用ncurses,这是一种否定他们作为教学辅助工具的使用,但其中一些是很小的东西,你可以在不被教导的情况下学习负荷。

Personally I think Python and Ruby would make great first languages.

我个人认为Python和Ruby将会成为伟大的第一语言。

EDIT: list of beginner programming assignments appeared overnight might be just what you are looking for.

编辑:一夜间出现的编程初学者列表可能正是你想要的。

#17


2  

It really depends on your brother's learning style. Many people learn faster by getting their hands dirty & just getting into it, crystallising the concepts and the big picture as they progress and build their knowledge.

这取决于你弟弟的学习方式。许多人通过弄脏自己的手来学得更快。他们只是进入其中,在进步和积累知识的过程中,将概念和蓝图具体化。

Me, I prefer to start with the big picture and drill down into the nitty-gritty. The first thing I wanted to know was how it all fits together then all that Object-oriented gobbledygook, then about classes & instances and so-on. I like to know the underlying concepts and a bit of theory before I learn the syntax. I had a bit of an advantage because I wrote some games in BASIC 20 years ago but nothing much since.

我,我更喜欢从大局开始,深入到细节。我想知道的第一件事是,它是如何组合在一起的,然后是面向对象的gobbledygook,然后是类和实例,等等。在学习语法之前,我喜欢了解基本概念和一些理论。我有一点优势,因为我在20年前写了一些基本的游戏,但从那以后就没什么了。

Perhaps it is useful to shadow a production process by starting with an overall mission statement, then a plan and/or flowchart, then elaborate into some pseudo code (leaning towards the syntax you will ultimately use) before actually writing the code.

也许,通过从总体任务语句开始,然后是一个计划和/或流程图,然后在实际编写代码之前,详细介绍一些伪代码(倾向于您最终使用的语法),这可能是有用的。

The golden rule here is to suss out your student's leaning style.

这里的黄金法则是让学生了解你学生的学习风格。

#18


2  

If your brother has access to iTunes, he can download video lectures of an introductory computer science course given by Richard Buckland at the University of New South Wales. He's an engaging instructor and covers fundamentals of computing and the C language. If nothing else, tell your brother to play the vids in the background and some concepts might sink in through osmosis. :)

如果你的兄弟可以访问iTunes,他可以下载新南威尔士大学理查德·巴克兰(Richard Buckland)提供的计算机科学入门课程的视频课程。他是一位迷人的教师,涵盖了计算机和C语言的基础知识。如果没有其他的事情,告诉你的兄弟在背景中播放vids,一些概念可能会渗透到渗透中。:)

COMP1917 Higher Computing - 2008 Session 1 http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444

《高等计算- 2008》第1期:http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444。

If the link doesn't work, here's a path:

如果链接不起作用,这里有一条路径:

Home -> iTunes U --> Engineering --> COMP1917 Higher Computing - 2008 Session 1

Home -> iTunes U ->工程-> COMP1917高等计算- 2008年第1期。

#19


2  

there's a wikibook that is pretty good for learning python.

有一本维基教科书非常适合学习python。

I don't know how the wikibooks are for other languages, but I personally learned python from the wikibook as it was in Feb 2007

我不知道维基教科书是如何使用其他语言的,但我个人从*上学习了python,就像2007年2月一样。

ps - if you're unfamiliar with wikibooks, it's basically the wikipedia version of book authoring. it's sort of hard to describe, but if you check out a few of the books on there you'll see how it works

ps -如果你不熟悉*,它基本上就是*的版本。这很难描述,但如果你看一下其中的一些书,你会发现它是如何运作的。

#20


2  

Python Programming for the absolute beginner

绝对初学者的Python编程。

Python Programming for the absolute beginner cover http://safari.oreilly.com/images/1592000738/1592000738_xs.jpg

Python编程的绝对初学者封面http://safari.oreilly.com/images/1592000738/1592000738_xs.jpg。

#21


2  

I think Python is a great idea. I would give him a few basic assignments to do on his own and tell him that any dead ends he hits can probably be resolved by a trip to google. For me, at least, solving a problem on my own always made it stick better than someone telling me the solution.

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

Some possible projects (in no particular order):

一些可能的项目(没有特定的顺序):

  • 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

    这里有一个扩展转换器的例子,它的想法相同: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.

    编写一个程序,它接受一个数字输入,并显示它将转化为的字母等级。它最终会对if和elif语句的输入进行评估,以找到适合的位置。

  • 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.

    取一些(大概是大的)硬币的输入,把它转换成更大的面值。例如,149便士= 1美元,1 / 4,2角,4便士。

  • 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

    创建一个简单的列表管理器。能够添加/删除列表并在这些列表中添加/删除条目。下面是一个圣诞列表管理器的例子: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

    创建一个程序,该程序将构建并测试输入的数字是否构成一个神奇的正方形(带有一个2D数组)。这里有一些示例代码,但它应该在每个步骤中真正打印出square,以显示用户在哪些地方使用了square: http://pastebin.org/6544。

I would also suggest doing some stuff with xTurtle or another graphics module to mix things up and keep him from getting boring. Of course, this is very much practice programming and not the scripting that a lot of people would really be using python for, but the examples I gave are pretty much directly taken from when I was learning via python and it worked out great for me. Good luck!

我还建议用xTurtle或其他图形模块做一些事情,把事情弄混,让他不要变得无聊。当然,这是非常多的练习编程,而不是很多人真正使用python的脚本,但是我给出的例子非常直接地从我通过python学习的过程中得到,而且对我来说非常有用。好运!

#22


2  

Just make it fun !

让它变得有趣!

Amazingly Scala might be the easiest if you try Kojo

令人惊奇的是,如果您尝试使用Kojo, Scala可能是最简单的。

#23


2  

If your brother likes puzzles, I would recommend Python Challenge. I wouldn't use it as a formal teaching tool in a 1 on 1 tutorial, but it's something he can do when you're not together to challenge himself and have some fun.

如果你哥哥喜欢猜谜游戏,我会推荐Python挑战。我不会把它作为一种正式的教学工具,在1 / 1的教程中,但是当你们不一起挑战自己并且有一些乐趣时,它是他可以做的事情。

#24


2  

Python Challenge

Python的挑战

#25


2  

After going through a few free e-books, I found the best book for learning to program was Head First Programming published by O'Reily Press. It uses Python as the language and gives you programs to work on from the very start. They are all more interesting that 'Hello World'. It's well worth the money I spent on it, and since it's been out for a bit you may be able to find a cheaper used copy on Ebay or Amazon.

在浏览了几本免费的电子书之后,我发现学习编程的最佳书籍是O'Reily Press出版的《Head First Programming》。它使用Python作为语言,并从一开始就为您提供程序。他们更有趣的是“你好世界”。我花在这上面的钱很值,因为它已经卖出去了,你可以在Ebay或亚马逊上找到便宜的二手书。

#26


1  

If you want to teach the basics of programming, without being language specific, there is an application called Scratch that was created in MIT. It's designed to help people develop programming skills. As users create Scratch projects, they learn to create conditions, loops, etc. There is a also a community of scratch projects, form which projects can be downloaded - that way you can explore other people's programs and see how they were built.

如果您想要教授编程的基础知识,而不是特定于语言,那么有一个应用程序叫做Scratch,它是在MIT创建的。它的目的是帮助人们开发编程技能。当用户创建Scratch项目时,他们会学习创建条件、循环等等。还有一个Scratch项目社区,可以下载项目,这样你就可以探索其他人的程序,看看他们是如何构建的。

#27


1  

I think that once he has the basics (variables, loops, etc) down you should try to help him find something specific that he is interested in and help him learn the necessities to make it happen. I know that I am much more inclined and motivated to do something if it's of interest to me. Also, make sure to let him struggle though some of the tougher problems, nothing is more satisfying than the moment you figure it out on your own.

我认为,一旦他有了基本的(变量,循环,等等),你应该试着帮助他找到他感兴趣的东西,并帮助他学习如何让它发生。我知道,如果我感兴趣的话,我更愿意做一些事情。同时,一定要让他在一些更棘手的问题上挣扎,没有什么比你自己想出来的时候更令人满意的了。

#28


1  

I was taught by learning how to solve problems in a language agnostic way using flowcharts and PDL (Program Design Language). After a couple weeks of that, I learned to convert the PDL I had written to a language. I am glad I learned that way because I have spent the majority of my years programming, solving problems without being tied to a language. What language I use has always been an implementation detail and not part of the design.

通过学习如何用流程图和PDL(程序设计语言)来解决语言不可知的问题,我学会了如何解决问题。几周之后,我学会了把我写的PDL转换成一种语言。我很高兴我学会了这种方法,因为我花了大部分时间来编程,解决问题而不被语言束缚。我使用的语言一直是实现细节,而不是设计的一部分。

Having to solve the problem by breaking it down into it's basic steps is a key skill. I think it is one of the things that separates those that can program from those that can't.

必须通过将问题分解为基本步骤来解决问题是一项关键技能。我认为这是区分那些能编程的和不能编程的东西之一。

As far as how you tackle the order of concepts of a language I believe the easiest way is to decide that is to have a project in mind and tackle the concepts as they are needed. This lets you apply them as they are needed on something that you are interested in doing. When learning a language it is good to have several simple projects in mind and a few with progressive complexity. Deciding on those will help you map out the concepts that are needed and their order.

至于你如何处理一种语言的概念,我认为最简单的方法是决定是否有一个项目在头脑中,并在需要的时候处理这些概念。这可以让你在你感兴趣的事情上应用它们。在学习一门语言的时候,有几个简单的项目和一些渐进的复杂性是很好的。决定这些将帮助您规划需要的概念和它们的顺序。

#29


1  

I would recommend also watching some screencasts - they are generally created in context of a specific technology not a language, though if there's Python code displayed, that'll do :). The point is - they're created by some good programmers and watching how good programmers program is a good thing. You and your brother could do some peer programming as well, that might be an even better idea. Just don't forget to explain WHY you do something this way and not that way. I think the best way to learn programming is from good examples and try not to even see the bad ones.

我还建议看一些视频——它们通常是在特定技术的背景下创建的,而不是一种语言,不过如果有Python代码显示,那就可以了:)。重点是——它们是由一些优秀的程序员创建的,他们关注的是程序员程序是多么优秀。你和你的兄弟也可以做点同伴编程,这可能是个更好的主意。别忘了解释你为什么要这样做,而不是那样做。我认为学习编程最好的方法就是从好的例子中学习,尽量不要去看那些不好的例子。

#30


1  

Robert Read wrote a useful guide, How to be a Programmer, which covers a wide area of programming issues that a beginner would find helpful.

Robert Read写了一本有用的指南,如何成为一名程序员,它涵盖了编程问题的广泛领域,初学者可以从中找到帮助。

#1


119  

I've had to work with several beginner (never wrote a line of code) programmers, and I'll be doing an after school workshop with high school students this fall. This is the closest thing I've got to documentation. It's still a work in progress, but I hope it helps.

我不得不和几个初学者一起工作(从来没有写过一行代码),我将在今年秋天和高中生一起参加一个课后研讨会。这是我最接近的文件。这仍然是一项正在进行中的工作,但我希望它能有所帮助。

1) FizzBuzz. Start with command line programs. You can write some fun games, or tools, very quickly, and you learn all of the language features very quickly without having to learn the GUI tools first. These early apps should be simple enough that you won't need to use any real debugging tools to make them work.

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

If nothing else things like FizzBuzz are good projects. Your first few apps should not have to deal with DBs, file system, configuration, ect. These are concepts which just confuse most people, and when you're just learning the syntax and basic framework features you really don't need more complexity.

如果没有其他的事情像FizzBuzz是好的项目。你的前几个应用程序不应该处理DBs、文件系统、配置等。这些概念只会让大多数人感到困惑,当你学习语法和基本框架时,你真的不需要更多的复杂性。

Some projects:

一些项目:

  • 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)
  • 要求一个方向(向上、向下、左、右),然后告诉用户他们的命运(在一个洞中,找到一个蛋糕,ect)。(布尔逻辑)
  • 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)
  • 根据他们的年龄,有些人真的喜欢一款应用程序,在某个时间段里给用户一个随机的侮辱。(循环,数组,定时器,和随机的如果你使间隔随机)

2) Simple Project Once they have a good grasp of language features, you can start a project(simple, fun games work good.). You should try to have the first project be able to be completed within 6-12 hours. Don't spend time to architect it early. Let them design it even if it sucks. If it falls apart, talk about what happened and why it failed, then pick another topic and start again.

2)简单的项目一旦他们掌握了语言的特点,你就可以开始一个项目(简单,有趣的游戏工作很好)。你应该试着让第一个项目在6-12小时内完成。不要花时间提前架构。让他们设计它,即使它很烂。如果它失败了,谈谈发生了什么,为什么失败了,然后选择另一个话题,重新开始。

This is where you start introducing the debugging capabilities of your tools. Even if you can see the problem by reading the code you should teach them how to use the tools, and then show them how you could see it. That serves the dual purpose of teaching the debugging tools and teaching how to ID errors without tools.

在这里,您将开始介绍工具的调试功能。即使你能通过阅读代码看出问题,你也应该教他们如何使用这些工具,然后告诉他们你是怎么看的。这提供了教学调试工具的双重目的,以及如何在没有工具的情况下进行ID错误的教学。

Once, or if, the project gets functional you can use it to introduce refactoring tools. Its good if you can then expand the project with some simple features which you never planned for. This usually means refactoring and significant debugging, since very few people write even half decent code their first time.

一旦,或者如果,项目有了功能,你可以用它来介绍重构工具。如果您可以将项目扩展到一些您从来没有计划过的简单特性,那么它就很好了。这通常意味着重构和重要的调试,因为很少有人第一次编写出一半像样的代码。

Some projects:

一些项目:

  • Hangman game
  • 刽子手的游戏
  • Experimenting with robotics(Vex and Mindstorms are options)
  • 试验机器人技术(Vex和Mindstorms是选项)

3) Real Project Start a real project which may take some time. Use proper source control, and make a point to have a schedule. Run this project like a real project, if nothing else its good experience having to deal with the tools.

3)真正的项目启动一个真正的项目,可能需要一段时间。使用适当的源码控制,并制定一个时间表。像一个真正的项目一样运行这个项目,如果没有其他的经验,必须处理这些工具。

Obviously you need to adjust this for each person. The most important thing I've found is to make even the first simple apps apply to what the person is interested in.

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

Some projects:

一些项目:

  • Tetris
  • 俄罗斯方块
  • Text file based blog engine
  • 基于文本文件的博客引擎。
  • More advanced robotics work
  • 更先进的机器人工作

#2


30  

You could try using Alice. It's a 3D program designed for use in introductory programming classes.

你可以试着用爱丽丝。它是一个3D程序,设计用于介绍编程类。

The two biggest obstacles for new programmers are often:

对于新程序员来说,最大的两个障碍通常是:

  • syntax errors
  • 语法错误
  • motivation (writing something meaningful and fun rather than contrived)
  • 动机(写一些有意义、有趣而不是做作的东西)

Alice uses a drag and drop interface for constructing programs, avoiding the possibility of syntax errors. Alice lets you construct 3D worlds and have your code control (simple) 3D characters and animation, which is usually a lot more interesting than implementing linked lists.

Alice使用拖放接口来构造程序,避免了语法错误的可能性。Alice让您构建3D世界,并拥有您的代码控制(简单)3D角色和动画,这通常比实现链表更有趣。

Experienced programmers may look down at Alice as a toy and scoff at dragging and dropping lines of code, but research shows that this approach works.

有经验的程序员可能会把Alice看作是一个玩具,并嘲笑拖拽代码行,但是研究表明这种方法是有效的。

Disclaimer: I worked on Alice.

免责声明:我在Alice工作。

#3


28  

I recommend Logo (aka the turtle) to get the basic concepts down. It provides a good sandbox with immediate graphical feedback, and you can demostrate loops, variables, functions, conditionals, etc. This page provides an excellent tutorial.

我推荐Logo(也就是乌龟)把基本概念弄清楚。它提供了一个很好的沙箱,提供了即时的图形反馈,您可以演示循环、变量、函数、条件等。这个页面提供了一个优秀的教程。

After Logo, move to Python or Ruby. I recommend Python, as it's based on ABC, which was invented for the purpose of teaching programming.

在徽标之后,移动到Python或Ruby。我推荐Python,因为它是基于ABC的,它是为了教学编程而发明的。

When teaching programming, I must second EHaskins's suggestion of simple projects and then complex projects. The best way to learn is to start with a definite outcome and a measurable milestone. It keeps the lessons focused, allows the student to build skills and then build on those skills, and gives the student something to show off to friends. Don't underestimate the power of having something to show for one's work.

在教授编程的时候,我必须要第二点EHaskins的建议,简单的项目,然后是复杂的项目。最好的学习方法就是从一个明确的结果和一个可衡量的里程碑开始。它使课程集中,让学生建立技能,然后在这些技能上建立,并给学生一些可以向朋友炫耀的东西。不要低估了展示自己作品的力量。

Theoretically, you can stick with Python, as Python can do almost anything. It's a good vehicle to teach object-oriented programming and (most) algorithms. You can run Python in interactive mode like a command line to get a feel for how it works, or run whole scripts at once. You can run your scripts interpreted on the fly, or compile them into binaries. There are thousands of modules to extend the functionality. You can make a graphical calculator like the one bundled with Windows, or you can make an IRC client, or anything else.

理论上,您可以使用Python,因为Python几乎可以做任何事情。它是教授面向对象编程和(大多数)算法的好工具。您可以像命令行那样在交互模式下运行Python,以了解它是如何工作的,或者同时运行整个脚本。您可以运行您的脚本,或者将它们编译成二进制文件。有数千个模块可以扩展功能。您可以创建一个图形计算器,比如与Windows捆绑的那个,或者您可以创建一个IRC客户端,或者其他任何东西。

XKCD describes Python's power a little better: 教初学者编程的最好方法是什么?

XKCD对Python的能力进行了更好的描述:

You can move to C# or Java after that, though they don't offer much that Python doesn't already have. The benefit of these is that they use C-style syntax, which many (dare I say most?) languages use. You don't need to worry about memory management yet, but you can get used to having a bit more freedom and less handholding from the language interpreter. Python enforces whitespace and indenting, which is nice most of the time but not always. C# and Java let you manage your own whitespace while remaining strongly-typed.

在那之后,您可以移动到c#或Java,尽管它们并没有提供Python所没有的很多功能。它们的好处是它们使用了c风格的语法,其中很多(我敢说大多数?)语言使用。您不必担心内存管理,但是您可以习惯从语言解释器中获得更多的*和更少的握手。Python执行空格和缩进,这在大多数情况下是不错的,但并不总是如此。c#和Java让您在保持强类型的同时管理自己的空白。

From there, the standard is C or C++. The freedom in these languages is almost existential. You are now in charge of your own memory management. There is no garbage collection to help you. This is where you teach the really advanced algorithms (like mergesort and quicksort). This is where you learn why "segmentation fault" is a curse word. This is where you download the source code of the Linux kernel and gaze into the Abyss. Start by writing a circular buffer and a stack for string manipulation. Then work your way up.

从那里,标准是C或c++。这些语言中的*几乎是存在的。现在,您负责自己的内存管理。没有垃圾收集来帮助你。这就是你教真正高级算法的地方(比如归并排序和快速排序)。这就是为什么“分割错误”是一个诅咒词。这是您下载Linux内核源代码并凝视深渊的地方。首先编写一个循环缓冲区和一个用于字符串操作的堆栈。然后努力向上。

#4


15  

A good python course is MIT's A Gentle Introduction to Programming Using Python. It's all free online, and you don't have to be an MIT uberstudent to understand it.

一个好的python课程是MIT对使用python编程的温和介绍。这一切都是免费的,你不必成为麻省理工学院的uberstudent。

Edit [Justin Standard]

编辑(Justin标准)

This course uses this free online book: How To Think Like a Computer Scientist
I'm definitely finding it quite useful.

本课程使用这本免费的在线书籍:如何像计算机科学家一样思考,我肯定觉得它很有用。

#5


12  

Python package VPython -- 3D Programming for Ordinary Mortal (video tutorial).

Python包VPython——普通凡人的3D编程(视频教程)。

Code example:

代码示例:

from visual import *

floor = box (pos=(0,0,0), length=4, height=0.5, width=4, color=color.blue)
ball = sphere (pos=(0,4,0), radius=1, color=color.red)
ball.velocity = vector(0,-1,0)
dt = 0.01

while 1:
    rate (100)
    ball.pos = ball.pos + ball.velocity*dt
    if ball.y < ball.radius:
        ball.velocity.y = -ball.velocity.y
    else:
        ball.velocity.y = ball.velocity.y - 9.8*dt

VPython bouncing ball http://vpython.org/bounce.gif

http://vpython.org/bounce.gif VPython弹力球

#6


12  

Begin with Turtle graphics in Python.

从Python中的Turtle图形开始。

I would use the turtle graphics which comes standard with Python. It is visual, simple and you could use this environment to introduce many programming concepts like iteration and procedure calls before getting too far into syntax. Consider the following interactive session in python:

我将使用使用Python来达到标准的海龟图形。它是可视化的,简单的,您可以使用这个环境引入许多编程概念,比如迭代和过程调用,然后再深入到语法。在python中考虑以下交互式会话:

>>> from turtle import *
>>> setup()
>>> title("turtle test")
>>> clear()
>>>
>>> #DRAW A SQUARE
>>> down()        #pen down
>>> forward(50)   #move forward 50 units
>>> right(90)     #turn right 90 degrees
>>> forward(50)
>>> right(90)
>>> forward(50)
>>> right(90)
>>> forward(50)
>>>
>>> #INTRODUCE ITERATION TO SIMPLIFY SQUARE CODE
>>> clear()
>>> for i in range(4):
        forward(50)
        right(90)
>>>
>>> #INTRODUCE PROCEDURES   
>>> def square(length):
        down()
        for i in range(4):
            forward(length)
            right(90)
>>>
>>> #HAVE STUDENTS PREDICT WHAT THIS WILL DRAW
>>> for i in range(50):
        up()
        left(90)
        forward(25)
        square(i)
>>>
>>> #NOW HAVE THE STUDENTS WRITE CODE TO DRAW
>>> #A SQUARE 'TUNNEL' (I.E. CONCENTRIC SQUARES
>>> #GETTING SMALLER AND SMALLER).
>>>
>>> #AFTER THAT, MAKE THE TUNNEL ROTATE BY HAVING
>>> #EACH SUCCESSIVE SQUARE TILTED

In trying to accomplish the last two assignments, they will have many failed attempts, but the failures will be visually interesting and they'll learn quickly as they try to figure out why it didn't draw what they expected.

在尝试完成最后两项任务时,他们会有很多失败的尝试,但是失败会在视觉上很有趣,当他们试图弄明白为什么它没有画出他们所期望的时,他们会很快的学习。

#7


11  

The key thing is that the person in question needs to have some problem that they want solving. If you don't have a program that you want to write (and something sensible and well-defined, not "I want to write the next Quake!") then you can't learn to program, because you have nothing to motivate you. I mean, you could read a book and have a rough understanding of a language's syntax and semantics, but until you have a program that you want written you'll never grasp the nettle.

关键是这个人需要解决他们想要解决的问题。如果你没有一个你想写的程序(以及一些明智而明确的东西,而不是“我想写下一次地震!”),那么你就不能学习编程,因为你没有什么可以激励你。我的意思是,你可以读一本书,对一门语言的语法和语义有一个大致的了解,但是,除非你有一个你想写的程序,否则你永远也无法理解它。

If that impetus exists then everything else is just minor details.

如果这种推动力存在,那么其他一切都只是次要的细节。

#8


8  

I don't know if anyone has mentioned this here, yet, but You might want to check out Zed Shaw's Learn Python the Hard Way

我不知道是否有人在这里提到过这个,但是你可能想要看看Zed Shaw的学习Python。

Hope this Helps

希望这有助于

#9


7  

http://tryruby.hobix.com/">Try Ruby (In Your Browser)

http://tryruby.hobix.com/“>尝试Ruby(在您的浏览器中)

#10


7  

How to Design Programs

如何设计程序

Structure and Interpretation of Computer Programs . Videos lectures at http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/

计算机程序的结构和解释。在http://www.swiss.ai.mit.edu/classes/6.001/abelson-sussman-lectures/的视频讲座

#11


5  

This is a fantastic book which my little brothers used to learn:

这是一本很棒的书,我的小弟弟们曾经学过:

http://pine.fm/LearnToProgram/

http://pine.fm/LearnToProgram/

Of course, the most important thing is to start on a real, useful program of some kind IMMEDIATELY after finishing the book.

当然,最重要的是在读完这本书之后立即开始一个真正有用的程序。

#12


4  

If he's interested, aren't the minor details the good parts? Using python, you've already cut the GUI off of it so that confusion is gone. Why not pick a project, a game or something, and implement it. The classic hi-lo number guessing game can be simply implemented from the command line in 20-30 lines of code (depending on language of course) and gives you variables, conditions, loops, and user input.

如果他感兴趣,小细节不是好的部分吗?使用python,您已经减少了它的GUI,这样混乱就消失了。为什么不选择一个项目,一个游戏或什么,并实现它。经典的hi-lo数字猜谜游戏可以简单地从20-30行代码(当然取决于语言)的命令行实现,并提供变量、条件、循环和用户输入。

#13


4  

I'd just let him write tons of code. Let him drive in everything you guys do, and just be available to answer questions.

我只是让他写了大量的代码。让他在你们做的每一件事上开车,只要能回答问题就可以了。

Believe it or not, after a few months of writings tons of crappy code, he'll start to get the idea and start writing better programs. At that point, you can get bogged down in details (memory, etc), and also talk about general design principles.

信不信由你,经过几个月的冗长的代码,他将开始了解这个想法并开始编写更好的程序。在这一点上,您可能会陷入细节(内存等),还会讨论一般的设计原则。

I've heard that what separates the great artists from the mediocre ones, is that every time they practice, they improve on something, no matter how small. Let your brother practice, and he'll improve every time he sits down at the keyboard.

我听说过,伟大的艺术家和平庸的艺术家之间的区别在于,他们每次练习的时候,都在进步,无论多么渺小。让你哥哥练习,他每次坐在键盘前都会进步。

Edit: [Justin Standard]

编辑(Justin标准):

Esteban, this reminds me of a recent coding horror post, and I do think you are right. But I think its still worthwhile to find methods to guide his practice. No question, I want him writing as much code as he knows how to do. Thats one reason I'm asking for sample projects.

埃斯特班,这让我想起了最近的一个编码恐怖帖子,我认为你是对的。但我认为找到指导他实践的方法还是值得的。毫无疑问,我希望他写的代码和他知道的一样多。这就是我要求样本项目的一个原因。

#14


2  

First of all, start out like everyone else does: with a Hello World program. It's simple, and it gives them a basic feel for the layout of a program. Try and remember back to when you were first programming, and how difficult some of the concepts were - start simple.

首先,像其他所有人一样开始:使用Hello World程序。它很简单,它给了他们一个程序布局的基本感觉。试着回想一下你第一次编程时的情形,以及一些概念的难度——从简单开始。

After Hello World, move on to creating some basic variables, arithmetic, then onto boolean logic and if/else statements. If you've got one of your old programming textbooks, check out some of the early examples and have him run through those. Just don't try to introduce too much all at once, or it will be overwhelming and confusing.

在Hello World之后,继续创建一些基本的变量,算术,然后是布尔逻辑和if/else语句。如果你有一个旧的编程课本,看看一些早期的例子,让他跑过那些。不要试着一次性介绍太多,否则会让你不知所措。

#15


2  

Something you should be very mindful of while teaching your brother to program is for him not to rely too heavily on you. Often when I find myself helping others they will begin to think of me as answer book to all of their questions and instead of experimenting to find an answer they simply ask me. Often the best teacher is experimentation and every time your brother has a question like "What will happen if I add 2 to a string?" you should tell him to try it out and see for himself. Also I have noticed that when I cannot get a concept through to someone, it helps to see some sample code where we can look at each segment individually and explain it piece by piece. As a side note people new to programming often have trouble with the idea of object oriented programming, they will say they understand it when you teach it to them but will not get a clear concept of it until actually implementing it.

当你教你弟弟学习的时候,你应该注意的是不要太依赖你。当我发现自己在帮助别人的时候,他们会开始把我当成是他们所有问题的答案,而不是去尝试寻找答案,他们只是问我。通常最好的老师都是做实验的,每次你的哥哥都有这样的问题:“如果我把2加到一个字符串里会发生什么?”你应该告诉他自己试试。我也注意到,当我无法将一个概念传递给某人时,可以看到一些示例代码,我们可以逐个查看每个片段并逐个解释。作为一种附加说明,人们对编程的新认识常常会遇到面向对象编程的问题,他们会说,当你教他们的时候,他们会理解它,但是在实际实现它之前,他们不会得到一个清晰的概念。

#16


2  

I used to teach programming and your brother has one main advantage over most of my students he wants to learn :)

我曾经教过编程,而你哥哥比我的大多数学生都有一个主要优势:

If you decide to go with C a friend has a site that has the sort of programs those of use from older generations remember as basic type-ins. The more complex of them use ncurses which sort of negates their use as a teaching aid somewhat but some of them are tiny little things and you can learn loads without being taught to.

如果你决定和C一起去,你的朋友有一个网站,它有一些从老一辈人那里使用的程序,记住它是基本的类型。更复杂的是使用ncurses,这是一种否定他们作为教学辅助工具的使用,但其中一些是很小的东西,你可以在不被教导的情况下学习负荷。

Personally I think Python and Ruby would make great first languages.

我个人认为Python和Ruby将会成为伟大的第一语言。

EDIT: list of beginner programming assignments appeared overnight might be just what you are looking for.

编辑:一夜间出现的编程初学者列表可能正是你想要的。

#17


2  

It really depends on your brother's learning style. Many people learn faster by getting their hands dirty & just getting into it, crystallising the concepts and the big picture as they progress and build their knowledge.

这取决于你弟弟的学习方式。许多人通过弄脏自己的手来学得更快。他们只是进入其中,在进步和积累知识的过程中,将概念和蓝图具体化。

Me, I prefer to start with the big picture and drill down into the nitty-gritty. The first thing I wanted to know was how it all fits together then all that Object-oriented gobbledygook, then about classes & instances and so-on. I like to know the underlying concepts and a bit of theory before I learn the syntax. I had a bit of an advantage because I wrote some games in BASIC 20 years ago but nothing much since.

我,我更喜欢从大局开始,深入到细节。我想知道的第一件事是,它是如何组合在一起的,然后是面向对象的gobbledygook,然后是类和实例,等等。在学习语法之前,我喜欢了解基本概念和一些理论。我有一点优势,因为我在20年前写了一些基本的游戏,但从那以后就没什么了。

Perhaps it is useful to shadow a production process by starting with an overall mission statement, then a plan and/or flowchart, then elaborate into some pseudo code (leaning towards the syntax you will ultimately use) before actually writing the code.

也许,通过从总体任务语句开始,然后是一个计划和/或流程图,然后在实际编写代码之前,详细介绍一些伪代码(倾向于您最终使用的语法),这可能是有用的。

The golden rule here is to suss out your student's leaning style.

这里的黄金法则是让学生了解你学生的学习风格。

#18


2  

If your brother has access to iTunes, he can download video lectures of an introductory computer science course given by Richard Buckland at the University of New South Wales. He's an engaging instructor and covers fundamentals of computing and the C language. If nothing else, tell your brother to play the vids in the background and some concepts might sink in through osmosis. :)

如果你的兄弟可以访问iTunes,他可以下载新南威尔士大学理查德·巴克兰(Richard Buckland)提供的计算机科学入门课程的视频课程。他是一位迷人的教师,涵盖了计算机和C语言的基础知识。如果没有其他的事情,告诉你的兄弟在背景中播放vids,一些概念可能会渗透到渗透中。:)

COMP1917 Higher Computing - 2008 Session 1 http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444

《高等计算- 2008》第1期:http://deimos3.apple.com/WebObjects/Core.woa/Browse/unsw.edu.au.1504975442.01504975444。

If the link doesn't work, here's a path:

如果链接不起作用,这里有一条路径:

Home -> iTunes U --> Engineering --> COMP1917 Higher Computing - 2008 Session 1

Home -> iTunes U ->工程-> COMP1917高等计算- 2008年第1期。

#19


2  

there's a wikibook that is pretty good for learning python.

有一本维基教科书非常适合学习python。

I don't know how the wikibooks are for other languages, but I personally learned python from the wikibook as it was in Feb 2007

我不知道维基教科书是如何使用其他语言的,但我个人从*上学习了python,就像2007年2月一样。

ps - if you're unfamiliar with wikibooks, it's basically the wikipedia version of book authoring. it's sort of hard to describe, but if you check out a few of the books on there you'll see how it works

ps -如果你不熟悉*,它基本上就是*的版本。这很难描述,但如果你看一下其中的一些书,你会发现它是如何运作的。

#20


2  

Python Programming for the absolute beginner

绝对初学者的Python编程。

Python Programming for the absolute beginner cover http://safari.oreilly.com/images/1592000738/1592000738_xs.jpg

Python编程的绝对初学者封面http://safari.oreilly.com/images/1592000738/1592000738_xs.jpg。

#21


2  

I think Python is a great idea. I would give him a few basic assignments to do on his own and tell him that any dead ends he hits can probably be resolved by a trip to google. For me, at least, solving a problem on my own always made it stick better than someone telling me the solution.

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

Some possible projects (in no particular order):

一些可能的项目(没有特定的顺序):

  • 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

    这里有一个扩展转换器的例子,它的想法相同: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.

    编写一个程序,它接受一个数字输入,并显示它将转化为的字母等级。它最终会对if和elif语句的输入进行评估,以找到适合的位置。

  • 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.

    取一些(大概是大的)硬币的输入,把它转换成更大的面值。例如,149便士= 1美元,1 / 4,2角,4便士。

  • 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

    创建一个简单的列表管理器。能够添加/删除列表并在这些列表中添加/删除条目。下面是一个圣诞列表管理器的例子: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

    创建一个程序,该程序将构建并测试输入的数字是否构成一个神奇的正方形(带有一个2D数组)。这里有一些示例代码,但它应该在每个步骤中真正打印出square,以显示用户在哪些地方使用了square: http://pastebin.org/6544。

I would also suggest doing some stuff with xTurtle or another graphics module to mix things up and keep him from getting boring. Of course, this is very much practice programming and not the scripting that a lot of people would really be using python for, but the examples I gave are pretty much directly taken from when I was learning via python and it worked out great for me. Good luck!

我还建议用xTurtle或其他图形模块做一些事情,把事情弄混,让他不要变得无聊。当然,这是非常多的练习编程,而不是很多人真正使用python的脚本,但是我给出的例子非常直接地从我通过python学习的过程中得到,而且对我来说非常有用。好运!

#22


2  

Just make it fun !

让它变得有趣!

Amazingly Scala might be the easiest if you try Kojo

令人惊奇的是,如果您尝试使用Kojo, Scala可能是最简单的。

#23


2  

If your brother likes puzzles, I would recommend Python Challenge. I wouldn't use it as a formal teaching tool in a 1 on 1 tutorial, but it's something he can do when you're not together to challenge himself and have some fun.

如果你哥哥喜欢猜谜游戏,我会推荐Python挑战。我不会把它作为一种正式的教学工具,在1 / 1的教程中,但是当你们不一起挑战自己并且有一些乐趣时,它是他可以做的事情。

#24


2  

Python Challenge

Python的挑战

#25


2  

After going through a few free e-books, I found the best book for learning to program was Head First Programming published by O'Reily Press. It uses Python as the language and gives you programs to work on from the very start. They are all more interesting that 'Hello World'. It's well worth the money I spent on it, and since it's been out for a bit you may be able to find a cheaper used copy on Ebay or Amazon.

在浏览了几本免费的电子书之后,我发现学习编程的最佳书籍是O'Reily Press出版的《Head First Programming》。它使用Python作为语言,并从一开始就为您提供程序。他们更有趣的是“你好世界”。我花在这上面的钱很值,因为它已经卖出去了,你可以在Ebay或亚马逊上找到便宜的二手书。

#26


1  

If you want to teach the basics of programming, without being language specific, there is an application called Scratch that was created in MIT. It's designed to help people develop programming skills. As users create Scratch projects, they learn to create conditions, loops, etc. There is a also a community of scratch projects, form which projects can be downloaded - that way you can explore other people's programs and see how they were built.

如果您想要教授编程的基础知识,而不是特定于语言,那么有一个应用程序叫做Scratch,它是在MIT创建的。它的目的是帮助人们开发编程技能。当用户创建Scratch项目时,他们会学习创建条件、循环等等。还有一个Scratch项目社区,可以下载项目,这样你就可以探索其他人的程序,看看他们是如何构建的。

#27


1  

I think that once he has the basics (variables, loops, etc) down you should try to help him find something specific that he is interested in and help him learn the necessities to make it happen. I know that I am much more inclined and motivated to do something if it's of interest to me. Also, make sure to let him struggle though some of the tougher problems, nothing is more satisfying than the moment you figure it out on your own.

我认为,一旦他有了基本的(变量,循环,等等),你应该试着帮助他找到他感兴趣的东西,并帮助他学习如何让它发生。我知道,如果我感兴趣的话,我更愿意做一些事情。同时,一定要让他在一些更棘手的问题上挣扎,没有什么比你自己想出来的时候更令人满意的了。

#28


1  

I was taught by learning how to solve problems in a language agnostic way using flowcharts and PDL (Program Design Language). After a couple weeks of that, I learned to convert the PDL I had written to a language. I am glad I learned that way because I have spent the majority of my years programming, solving problems without being tied to a language. What language I use has always been an implementation detail and not part of the design.

通过学习如何用流程图和PDL(程序设计语言)来解决语言不可知的问题,我学会了如何解决问题。几周之后,我学会了把我写的PDL转换成一种语言。我很高兴我学会了这种方法,因为我花了大部分时间来编程,解决问题而不被语言束缚。我使用的语言一直是实现细节,而不是设计的一部分。

Having to solve the problem by breaking it down into it's basic steps is a key skill. I think it is one of the things that separates those that can program from those that can't.

必须通过将问题分解为基本步骤来解决问题是一项关键技能。我认为这是区分那些能编程的和不能编程的东西之一。

As far as how you tackle the order of concepts of a language I believe the easiest way is to decide that is to have a project in mind and tackle the concepts as they are needed. This lets you apply them as they are needed on something that you are interested in doing. When learning a language it is good to have several simple projects in mind and a few with progressive complexity. Deciding on those will help you map out the concepts that are needed and their order.

至于你如何处理一种语言的概念,我认为最简单的方法是决定是否有一个项目在头脑中,并在需要的时候处理这些概念。这可以让你在你感兴趣的事情上应用它们。在学习一门语言的时候,有几个简单的项目和一些渐进的复杂性是很好的。决定这些将帮助您规划需要的概念和它们的顺序。

#29


1  

I would recommend also watching some screencasts - they are generally created in context of a specific technology not a language, though if there's Python code displayed, that'll do :). The point is - they're created by some good programmers and watching how good programmers program is a good thing. You and your brother could do some peer programming as well, that might be an even better idea. Just don't forget to explain WHY you do something this way and not that way. I think the best way to learn programming is from good examples and try not to even see the bad ones.

我还建议看一些视频——它们通常是在特定技术的背景下创建的,而不是一种语言,不过如果有Python代码显示,那就可以了:)。重点是——它们是由一些优秀的程序员创建的,他们关注的是程序员程序是多么优秀。你和你的兄弟也可以做点同伴编程,这可能是个更好的主意。别忘了解释你为什么要这样做,而不是那样做。我认为学习编程最好的方法就是从好的例子中学习,尽量不要去看那些不好的例子。

#30


1  

Robert Read wrote a useful guide, How to be a Programmer, which covers a wide area of programming issues that a beginner would find helpful.

Robert Read写了一本有用的指南,如何成为一名程序员,它涵盖了编程问题的广泛领域,初学者可以从中找到帮助。