正在加载图片...
中 Preface seeing this example are looking at their first program.Some of them are undoubt- edly a little nervous,having heard that computer programming is difficult to learn. The C++version has always forced me to choose between two unsatisfying op- tions:either to explain #include,void main(),{and }and risk confusing or intimidating some of the students right at the start,or to tell them,"Just don't worry about all of that stuff now;we will talk about it later,"and risk the same thing.The educational objectives at this point in the course are to introduce students to the idea of a programming language and to get them to write their first program,thereby introducing them to the programming environment.The Python program has exactly what is needed to do these things,and nothing more. Comparing the explanatory text of the program in each version of the book fur- ther illustrates what this means to the beginning student.There are thirteen paragraphs of explanation of "Hello,world!"in the C++version;in the Python version,there are only two.More importantly,the missing eleven paragraphs do not deal with the "big ideas"in computer programming but with the minutia of C++syntax.I found this same thing happening throughout the book.Whole paragraphs simply disappear from the Python version of the text because Python's much clearer syntax renders them unnecessary. Using a very high-level language like Python allows a teacher to postpone talking about low-level details of the machine until students have the background that they need to better make sense of the details.It thus creates the ability to put "first things first"pedagogically.One of the best examples of this is the way in which Python handles variables.In C++a variable is a name for a place that holds a thing.Variables have to be declared with types at least in part because the size of the place to which they refer needs to be predetermined.Thus,the idea of a variable is bound up with the hardware of the machine.The powerful and fundamental concept of a variable is already difficult enough for beginning students (in both computer science and algebra).Bytes and addresses do not help the matter.In Python a variable is a name that refers to a thing.This is a far more intuitive concept for beginning students and is much closer to the meaning of "variable"that they learned in their math courses.I had much less difficulty teaching variables this year than I did in the past,and I spent less time helping students with problems using them. Another example of how Python aids in the teaching and learning of programming is in its syntax for functions.My students have always had a great deal of difficulty understanding functions.The main problem centers around the difference between a function definition and a function call,and the related distinction between a parameter and an argument.Python comes to the rescue with syntax that is nothing short of beautiful.Function definitions begin with the keyword def,so I simply tell my students,"When you define a function,begin with def,followed by the name of the function that you are defining;when you call a function,simplyx Preface seeing this example are looking at their first program. Some of them are undoubt￾edly a little nervous, having heard that computer programming is difficult to learn. The C++ version has always forced me to choose between two unsatisfying op￾tions: either to explain #include, void main(), {, and }, and risk confusing or intimidating some of the students right at the start, or to tell them, “Just don’t worry about all of that stuff now; we will talk about it later,” and risk the same thing. The educational objectives at this point in the course are to introduce students to the idea of a programming language and to get them to write their first program, thereby introducing them to the programming environment. The Python program has exactly what is needed to do these things, and nothing more. Comparing the explanatory text of the program in each version of the book fur￾ther illustrates what this means to the beginning student. There are thirteen paragraphs of explanation of “Hello, world!” in the C++ version; in the Python version, there are only two. More importantly, the missing eleven paragraphs do not deal with the “big ideas” in computer programming but with the minutia of C++ syntax. I found this same thing happening throughout the book. Whole paragraphs simply disappear from the Python version of the text because Python’s much clearer syntax renders them unnecessary. Using a very high-level language like Python allows a teacher to postpone talking about low-level details of the machine until students have the background that they need to better make sense of the details. It thus creates the ability to put “first things first” pedagogically. One of the best examples of this is the way in which Python handles variables. In C++ a variable is a name for a place that holds a thing. Variables have to be declared with types at least in part because the size of the place to which they refer needs to be predetermined. Thus, the idea of a variable is bound up with the hardware of the machine. The powerful and fundamental concept of a variable is already difficult enough for beginning students (in both computer science and algebra). Bytes and addresses do not help the matter. In Python a variable is a name that refers to a thing. This is a far more intuitive concept for beginning students and is much closer to the meaning of “variable” that they learned in their math courses. I had much less difficulty teaching variables this year than I did in the past, and I spent less time helping students with problems using them. Another example of how Python aids in the teaching and learning of programming is in its syntax for functions. My students have always had a great deal of difficulty understanding functions. The main problem centers around the difference between a function definition and a function call, and the related distinction between a parameter and an argument. Python comes to the rescue with syntax that is nothing short of beautiful. Function definitions begin with the keyword def, so I simply tell my students, “When you define a function, begin with def, followed by the name of the function that you are defining; when you call a function, simply
<<向上翻页向下翻页>>
©2008-现在 cucdc.com 高等教育资讯网 版权所有