需要学习的是编程,而不是编程语言(译)

信息来源:阮一峰每周分享

文章来源:Learning programming is different from learning a programming language


Learning programming is different from learning a programming language

We are all programmers, and we are all learners. It's surprising to see how many people(learners) who are bashing their head against the walls thinking they are learning to programme.

我们是程序员,但同时我们也是学员。令人惊讶的是许多钻进死胡同的人(学员)以为他们正在学习编程。

You might be learning a programming language instead of programming itself

你可能在在学习编程语言而非编程本身

Don't feel surprised to know that computer science does not study computers. Instead, it's the study of automated problem solving using. Problem-solving is computer science, not programming. That's why many computer science students seem not to understand why they learn algorithm or mathematics.

计算机科学不用来研究计算机,知道这个后不要感觉惊讶。相反,计算机科学是用来研究如何使用自动化解决问题的。计算机科学是为了解决问题的,而不是编程。这也就是许多计算机科学的学生对他们要学习算法和数学感到不解的原因。

If you have been to a computer science class before, you won't be surprised by what I am saying here. Because you would have noticed that programming has few to do with programming languages. Ask yourself why the pseudo code is so common in those classes.

如果你之前上过计算机科学的相关课程,你就会对我现在所说的话不会感到惊奇。因为你已经注意到编程其实和编程语言没有太大关系。不信你问一下自己为什么伪代码在课堂中使用得如此广泛。

But, most self-thought programmers always fall into the trap. We learn programming language for decades before we realize what exactly we've got to do: programming. I myself have been a victim.

不过,大多数自己思考问题的程序员都会掉入这种陷阱,我们学了数十年编程语言后才明白我们最应该学的是什么:是编程而不是编程语言,我自己也是这些观念的受害者。

I took more than a decade learning bit by bit various programming languages. The more I learn, the harder it is to build something simple. I have had that sensation of not finding the right tool. But, the issue is that I forgot to look for the right job to do instead of the right tool when I don't even know the job to do.

我花了十多年一点一点地学习了各种编程语言,学的语言越多,越难以构建一些简单的程序,我当时觉得是自己没有找到合适的工具。但问题是,当我甚至不知道要做的工作时,我忘了去寻找合适工作,而是专注于合适的工具。

And the strange things with programming languages is that they always evolve. Programming languages change almost every single day. It's very hard to follow up. And most good programs use only a little part of a programming language.

另外,与编程语言相关的奇怪问题也是不断发展变化着的,编程语言几乎每一天都在变化,你很难时刻跟进,而且许多编程高手也仅仅只是用了编程语言的一小部分特性。

The problem with learning programming languages first is like learning how to use a carpenter saw, a hammer, and all sort of cutting machines before learning carpentry. Carpentry requires attention: ideas, analysis of feasibility, measurements, tests, customer behavior. The boss carpenter will be more interested in those things than the hammer and nails. During his scientific study of the job, he would also take time to check the quality of the nails, colorants, woods, etc.

学习编程语言时遇到的第一个问题就像木匠在学习木工之前要学习如何使用木工据、锤子和各种切割机。木工需要重视:创意、可行性分析、测量、测试、顾客行为喜好。老木匠比较重视的是上面提到的这些,而不是锤子或者钉子,在他们进行专业学习期间,他们也会花时间检查一下钉子、着色剂、木材等工具的质量。

What is the difference between learning programming and learning a programming language?

学习编程和学习一门编程语言究竟有什么不同?

To program is setting a system free to operate by giving it instructions only once. We do that every day in everything. We teach our kids, our soldiers, our customers. We give them or we receive instructions to be free/independent to live in a given way. Your parent doesn't need to follow you and instruct you on every move you make in your life. They would have already programmed you in many aspects of life.

编程是通过给予仅有的一次指令来让系统自己运行起来,我们每个人每天都在做这样的的事情。我们教育孩子,训练士兵,与顾客交流,我们给予他们一些指令信息同时也受到一些来自他们的指令信息来自由或独立地生活在特定的环境中。你的父母不需要一直跟着指导你人生中的每一步该怎么走,他们已经在你生活的各个方面对你产生了类似于向你发送“指令信息”的影响。

Most schools and educational websites will teach a programming language's syntax. They could add some design patterns(while you ignore what exactly design is), a few arithmetic calculations, how variables are declared and how to use them, the data types and how to declare/create them.

多数学校和在线教育网站会教一些编程语言的语法知识,他们还可以增加一些设计模式(而设计模式到底是什么正是你所忽略的)、一些算术计算、变量应该怎么声明和使用、数据类型以及数据类型的声明和创建。

This does not teach you reasoning. With such method, you will discover reasoning methods, but later. It will make you feel like you wasted or it took a lot of time to learn to program.

这不是在教你推理,而是有了上面的这些方法,你会自己发现推理方法,但是是在很久以后的事了。这会让你觉得你为了学习编程花费太多时间啦。

We solve problems with programming and programming languages are tools which help us do that.

我们通过编程解决一些问题,而编程语言就是我们解决问题的工具。

They are like tool boxes. We call them frameworks. They help you organize your thoughts.

编程语言就像是工具箱,我们称之为框架,框架可以帮助你整理和组织思路。

If you are learning to programme and you can't still plan and code a real application, it means you are learning more about the programming language than programming.

如果你正在学习编程并且你还不会规划和编码一个实际的应用,这意味着你更多的是在学习编程语言而不是编程本身。

How many time do we meet people(learners) who still wonder how to create a program. To a programmer, a program is a problem to solve. He solves it with critical analysis, before even involving any programming language. When you solve any problem, it can be coded in any programming language. Let's take the case of the square. To square something, we times it by itself. We could have it implemented in various languages like:

有多少次我们遇到那些想知道如果创建一个程序的初学者?对程序员来说,编程就是解决问题,在引入任何编程语言之前已经通过辨证分析解决掉了问题。当你解决了一个问题,你可以用任何编程语言来实现它。我们以求平方值为例,求某个数的平方,我们用它自身来乘以自身,我们可以通过多种编程语言实现它,比如=:

In C
function square(int * x) {
    return x * x;
}

In PHP
function square ($x){
    return $x * $x;
}

In Javascript
function square(x){
    return x * x
}

In Scheme (a Lisp dialect)
(define (square x) (* x x))

You can notice that only the syntax matters in the implementations. The solution is the same. And this is one of the main reasons why you can almost use any programming language at which you are more comfortable to build any type of software.

你应该能注意到在实现过程中只有语法是不同的,解决问题的方法都是一样的。这就是你几何可以使用任意一种你用起来觉得舒服的编程语言来构建任意你想构建的软件程序。

It's easier to discover a language through programming

通过编程更容易探究一门语言

The issue generally is the human language. The human language is fraught with limitation and errors. It's impossible to use to instruct machines since they can't feel.

人类的语言充满限制和错误,不可能用于控制机器运作因为机器根本理解不了。

When learning to programme, you would learn a new jargon and new tools to help you write your logic in a manner that computers or other programmers could understand and agree on.

学习编程时,你会学习使用一些行话和新的工具来帮助你以一种计算机和其他编程人员可以理解和赞成的方式编写逻辑代码。

Usually, you would start from a simple and human-language-like symbolic called pseudo code. It's a good transition tool from human language to computer programming language. That is usually done to prevent you from wasting time on the language. That way you have full focus on reasoning. Through that, you will discover core parts that make up a good programming tool(language). You understand what exactly is needed. You understand the core goals of a programming language. With that, you learn it without realizing when you did it.

通常,你会以一种简单的、人性化的伪代码开始学习编程,这是一种很好的用于从人类语言到计算机编程语言过渡的工具。这通常会防止你在语言上浪费太多时间,让你完全专注于推理。通过上述方式,你就可以发现一个编程工具或编程语言最核心的组成部分,你就会明白什么是真正需要学习的,明白一个编程语言最核心的目标是什么。通过上面讲的,你就会在无意识的情况下学习到了编程。


2018.11.16 北京 晴 无霾

你可能感兴趣的:(需要学习的是编程,而不是编程语言(译))