初学者学什么编程语言

tech2023-06-08  101

初学者学什么编程语言

Like many of my age and generation, I started learning to program with BASIC. These were the days when you bought magazines full of pages and pages of code for games or basic applications. You spent hours with your friends painstakingly typing these programs into a computer to find there was a typo, or the game didn’t work, and then giving up. It was more about hanging out with your friends, whilst your parents felt like you were learning something.

像我这个年龄段的人一样,我开始学习使用BASIC编程。 过去,您购买的杂志充斥着游戏或基本应用程序的页面和代码页。 您花了几个小时与您的朋友一起努力地将这些程序输入计算机,以发现其中存在拼写错误,或者游戏无法正常工作,然后放弃。 与其说是和朋友出去玩,不如说你的父母觉得你正在学习一些东西。

BASIC had flaws, but one thing I liked about it was that the code was clear and verbose. This is why programs took pages to do anything. There is little chance of any language released now having such “wonderful” syntax as (including mandatory line numbers):

BASIC有缺陷,但是我喜欢它的一件事是代码清晰且冗长。 这就是程序使页面执行任何操作的原因。 现在发布的任何语言都很少有这样的“精彩”语法,包括(包括强制行号):

5 LET S = 0 10 MAT INPUT V 20 LET N = NUM 30 IF N = 0 THEN 99 40 FOR I = 1 TO N 45 LET S = S + V(I) 50 NEXT I 60 PRINT S/N 70 GO TO 5 99 END

(Thanks to Wikipedia)

(感谢维基百科 )

But you must admit that, for a beginner, it’s clear what’s happening.

但是您必须承认,对于初学者来说,很清楚发生了什么事。

Years later, I learned “modern” programming via a series of languages including PHP, Lingo, C++, Visual Basic and Java. I’m sure we covered Object Oriented programming, but mostly I remember it being procedural. This wasn’t helped by my years working with Drupal, which didn’t have solid OOP concepts until version 8.

多年后,我通过一系列语言(包括PHP,Lingo,C ++,Visual Basic和Java)学习了“现代”编程。 我确定我们已经涵盖了面向对象的编程,但是大多数时候我都记得它是过程性的。 我在Drupal工作的几年没有帮助,直到第8版才有了可靠的OOP概念。

Fast forward to the present and some of my motivations for this post. For the past months I’ve been teaching programming to recent Syrian refugees in Berlin, and our language of choice has been Ruby (and Rails).

前进到现在以及我撰写这篇文章的一些动机。 在过去的几个月中,我一直在为柏林的新叙利亚难民教授编程,我们选择的语言是Ruby(和Rails)。

Ruby是适合初学者的正确语言吗? (Is Ruby the Right Language to Teach to Beginners?)

Laying aside a recent growing exodus of programmers from using Ruby (that’s a whole other story), we (the teachers) are unsure if it was a good choice. The Ruby community is amazingly supportive and welcoming, and that makes many students succeed in learning to program through sheer perseverance and the support of the community.

抛开最近越来越多的程序员使用Ruby(这完全是另外一回事),我们(老师)不确定这是否是一个好选择。 Ruby社区令人惊讶地给予支持和欢迎,这使得许多学生通过坚强的毅力和社区的支持而成功地学习了编程。

However, we’ve noticed that some of the characteristics of Ruby that attracted experienced programmers are actually obfuscating and confusing. I don’t want to turn this post into a “Ruby Bash”, because that’s not what it’s supposed to be. I like Ruby, and it’s not the only language that has these problems. My recent experience teaching it to absolute beginners has meant that I have practical examples to illustrate my point(s). I also acknowledge that some of these learnings might be due to teaching the wrong topics in the wrong order, or unlearning some of the common tasks experienced programmers undertake, at least in the short term.

但是,我们注意到,吸引经验丰富的程序员的Ruby的某些特征实际上令人困惑。 我不想把这篇文章变成“ Ruby Bash”,因为那不是应该的。 我喜欢Ruby,这不是唯一存在这些问题的语言。 我最近对绝对初学者进行教学的经验意味着,我有一些实际的例子来说明我的观点。 我也承认,这些学习中的某些原因可能是由于以错误的顺序讲授了错误的主题,或者是至少在短期内没有学习经验丰富的程序员所承担的一些常见任务。

捷径工具 (Shortcut Tools)

Programmers are a little bit lazy — or, to be more accurate, we like to find ways to reduce repeatedly typing the same boilerplate and instead focus on the important and unique parts of a project. With Rails, scaffolding does just this; with a handful of commands you can have the underpinnings of an MVC application.

程序员有点懒惰-或者,更准确地说,我们喜欢找到减少重复键入同一样板代码的方法,而只专注于项目的重要和独特部分。 使用Rails,脚手架可以做到这一点。 使用少量命令,您可以拥有MVC应用程序的基础。

But these tools can completely confuse beginners. They don’t understand what was just created, and why, where or how it fits together.

但是这些工具会使初学者完全迷惑。 他们不了解刚刚创建的内容,以及为什么,在哪里或如何将它们组合在一起。

快捷语法 (Shortcut Syntax)

To an experienced programmer, writing this …

对于有经验的程序员,编写此……

(0..100).each { print i }

… instead of this …

……而不是……

var i; for (i=0;i<100;i++) { print i; }

… is an amazing and sensical shortcut. In fact, it’s efficient: there’s no need to initialize a variable or write all that horrible semi-colon separated syntax. But think about it from a beginner’s perspective. In the Ruby example, the only words that really make sense are each and print. What are the rest actually doing? It’s not to say that a student can’t learn these concepts, but in some respects, whilst learning, the second example is clearer and actually shows a student what’s happening.

……是一个了不起的,感性的捷径。 实际上,它是高效的:无需初始化变量或编写所有用分号分隔的可怕语法。 但是从初学者的角度考虑。 在Ruby示例中,真正有意义的唯一单词是each和print 。 剩下的实际上在做什么? 并不是说学生不能学习这些概念,而是在某些方面,在学习的同时,第二个例子更加清晰,实际上向学生展示了正在发生的事情。

“随心所欲”的语言 (“Do what you like” languages)

At one time, there was a trend towards languages that let you write casually — not having to worry about variable types and so forth. This popularity seems to be waning — or at least, is increasingly being supplemented by much stricter languages. These have advantages of speed and efficiency, but I do wonder if it’s also a case of changing trends. Languages that force you to make certain linguistic steps may take longer to learn, but there’s less “grey area” around what is and isn’t possible.

曾经有一种趋势使您可以随便地编写语言,而不必担心变量类型等。 这种流行似乎正在减弱-至少,越来越多的语言被越来越严格的语言所补充。 这些都具有速度和效率方面的优势,但我确实想知道这是否也在改变趋势。 强迫您采取某些语言步骤的语言可能需要更长的时间来学习,但是在“可能和不可能”周围的“灰色区域”更少。

工作和“带回家”的真实世界 (The Real World of Work and “Take Homes”)

Often, we’re keen to get students onto the most useful and “real word” concepts and practices as quickly as possible. Many contemporary “learn to code” programs are strongly focused on getting participants “work ready” and placed in jobs. I could (and may do) write an entire post about some of the issues with these programs, but in short, they can introduce students to concepts they may not be ready for. Based on my recent experience, some of the more notable ones are as follows below.

通常,我们渴望让学生尽快了解最有用和最“真实的单词”的概念和做法。 许多当代的“学习编码”程序都非常注重使参与者“做好工作”并开始工作。 我可以(也可能会)写整篇文章,介绍这些程序的某些问题,但总而言之,它们可以向学生介绍他们可能尚未准备好的概念。 根据我最近的经验,以下是一些较值得注意的情况。

面向对象编程(OOP) (Object-Oriented Programming (OOP))

OOP is a fundamental concept for many modern programming languages, but often is taught straight after learning complete basics like variables, logic and loops. Students have barely come to grips with what a program even looks like and then are thrown a massive curveball.

OOP是许多现代编程语言的基本概念,但通常是在学习完变量,逻辑和循环等完整的基础知识之后立即进行讲授的。 学生们几乎不了解程序的外观,然后又大吃一惊。

OOP is one of those concepts that makes far more sense in advanced applications. When writing basic programs, it seems an unnecessary and extraneous complication. Teachers can throw around terms and examples built on solid comparisons — such as animals and vehicles — but the practical need and application are still hard to grasp.

OOP是在高级应用程序中更有意义的概念之一。 在编写基本程序时,这似乎是不必要和多余的复杂性。 老师可以扔掉以动物和车辆等可靠的比较为基础的术语和示例,但是实际需求和应用仍然很难掌握。

版本控制 (Version Control)

Version control is similar. If you’re working with a team on a large project with regularly moving and changing parts, then it makes perfect sense. When you’re working alone or in a small team, it can feel like an over-complication. Git is wonderful, but remembering its workflow is a pain — where missing one step can throw things into disarray, and merging for the first dozen times is a confusing process.

版本控制与此类似。 如果您与一个团队合作进行一个大型项目,并且需要定期移动和更换零件,那么这很有意义。 当您独自工作或在一个小团队中工作时,感觉就像是过于复杂。 Git很棒,但是记住它的工作流程是很痛苦的-错过一个步骤可能会使事情陷入混乱,而前十几次合并是一个令人困惑的过程。

克里斯,太好了,但是您对此有何建议? (Great, Chris, but What Do You Suggest We Do about It?)

Good question. It’s easy to criticize, and who’s to say I’m even correct? First, I want mention a tip or two that I’ve found useful in teaching coding, and then try to get some crowd-sourced feedback on what languages people feel are good for beginners and why.

好问题。 批评起来很容易,谁能说我是正确的呢? 首先,我想谈一谈我发现对教授编码有用的技巧,然后尝试从人群中获得一些反馈,这些反馈是关于人们认为哪种语言对初学者有益的以及为什么的。

什么都不做 (Assume nothing)

You’ve heard this before, I’m sure, but I want you to try taking it a stage further. Here’s a little soundbite for you:

可以肯定,您之前已经听说过,但是我希望您尝试进一步。 这是给您的一点声音:

If you assume nothing, there is nothing to lose.

如果您不承担任何责任,就没有损失。

Well, you may lose some time, but not that much. In practice, this means you shouldn’t assume anyone has heard of your favorite build system / language / IDE / editor, or assume that anyone has any of the same experiences as you. Just because you think they should have, doesn’t mean they have. Of course, if you ask first, then go ahead — but do check.

好吧,您可能会浪费一些时间,但不会那么多。 实际上,这意味着您不应该假定任何人都听说过您喜欢的构建系统/语言/ IDE /编辑器,也不应该假定任何人都具有与您相同的体验。 仅仅因为您认为他们应该拥有,并不意味着他们拥有。 当然,如果您先问,然后继续-但要检查一下。

People are generally OK with a little repetition if it’s needed. If they understand something already and have to listen to it explained again, they probably won’t mind, and may even catch something they didn’t know previously.

如果需要的话,人们通常可以稍作重复。 如果他们已经了解了某些内容,并且不得不再次听他们解释,他们可能不会介意,甚至可能会发现他们以前不知道的内容。

语境 (Context)

This is a big one for me. Coders are often great at explaining that something is cool, but not so good at explaining why. When educating people, don’t just mention what it can do faster, better and bigger than before, but also why that is good for them or for you. They’ll listen, learn and remember far better.

对我来说,这是一个很大的机会。 编码人员通常很擅长于解释一些很酷的东西,但不能很好地解释原因。 在教育人们时,不仅要提及可以比以前更快,更好和更大的功能,还要说明为什么这样做对他们或您都有利。 他们会更好地聆听,学习和记住。

社区 (Community)

At the risk of sounding contradictory, some languages (especially Ruby and Python) have amazing communities that try hard to nurture beginners. These communities may not make the languages any easier to understand, but for those who stick it out, they will find it easier to expand and sustain their knowledge. Most importantly, more supportive communities help reduce exposure to noxious influences who may put of a beginner.

冒着听起来矛盾的风险,某些语言(尤其是Ruby和Python)拥有令人难以置信的社区,他们竭力培养初学者。 这些社区可能不会使语言变得更容易理解,但是对于那些坚持使用这些语言的人,他们会发现更容易扩展和维持他们的知识。 最重要的是,更多的支持社区有助于减少接触可能影响初学者的有害影响的机会。

最好的编程语言 (The Best Programming Languages to Learn)

This is where you come in, dear reader! I’d like to hear from you what languages you think are the easiest to learn and understand. I also want to hear why you have that opinion. And if you have any experience of teaching them, what have you found?

亲爱的读者,这就是您的目的地! 我想听听您的意见是什么语言,你认为是最容易学习和理解。 我也想听听你为什么有这种看法。 而且,如果您有教它们的任何经验,您发现了什么?

In a couple of weeks, I’ll gather these stories and write a follow-up article, providing a balanced examination (with beginner assistance) of the true accessibility of these languages and how best to teach them.

在接下来的几周中,我将收集这些故事并撰写后续文章,对这些语言的真正可访问性以及如何最好地教它们进行平衡检查(在初学者的帮助下)。

I’m sure you also have opinions on some of what I’ve written here, and that’s great. Please, when sharing your views, try to be constructive and see things from a beginner’s perspective. Thanks!

我相信您也对我在这里写的一些内容有意见,这很棒。 请在分享您的观点时,尝试具有建设性,并从初学者的角度看事情。 谢谢!



If you enjoyed this article, you may also like What’s the Best Programming Language to Learn in 2016?

如果您喜欢这篇文章,您可能还喜欢2016年学习的最佳编程语言是什么?

翻译自: https://www.sitepoint.com/teaching-programming-whats-the-best-language-for-beginners/

初学者学什么编程语言

最新回复(0)