编程学习之前先学习那些英文
by Amy M Haddad
通过艾米·M·哈达德(Amy M Haddad)
在学习编程之前我应该问的一个问题 (The one question I should’ve asked before learning to program)
There’s one question I wish I’d taken the time to think about when I began to program. I was reminded of it recently at a Python meetup in Boston.
我希望有一个问题可以让我花些时间考虑何时开始编程。 最近在波士顿举行的Python聚会上让我想起了它。
I had just sat down at the “beginners table” when a young, energetic man in a green sweater enthusiastically introduced himself. He promptly asked how long I’d been programming.
当我刚坐在“初学者餐桌”上时,一个穿着绿色毛衣的年轻活力男子热情地介绍了自己。 他立即问我要编程多久了。
“A few months,” I said. That was the answer he was looking for. He had begun to program the week before, so in his eyes I was a seasoned Python-ista (even though I clarified that I was still a beginner). He crossed his arms, leaned across the table, and asked what resources I used to learn Python.
“几个月,”我说。 那就是他要找的答案。 他已经在前一周开始编程,所以在他看来,我是一位经验丰富的Python程序员(即使我澄清说我仍然是一个初学者)。 他双臂交叉,斜倚在桌子上,问我过去用来学习Python的资源是什么。
I hesitated. Instead of rattling off a list of resources, I wanted to ask him a question: “How do you learn best?”
我犹豫了 我没有浪费资源清单,而是想问他一个问题:“您如何学习得最好?”
But that would’ve initiated an in-depth conversation minutes before the meetup was to begin. Instead, I just mentioned a few books and websites that I found useful and let it go.
但这将在聚会开始之前几分钟就进行了深入的对话。 相反,我只提到了一些我认为有用的书和网站,然后放手去做。
In retrospect, I should’ve asked myself that same question when I began to program. Learning to program is hard. It’s even harder when your instructor’s teaching style doesn’t mesh with your learning style.
回想起来,当我开始编程时,我应该问自己同样的问题。 学习编程很难。 当您的老师的教学风格与您的学习风格不一致时,就更难了。
I learned that lesson the hard way. If I’d taken the time to think about how I learn, I would’ve selected different resources from the start and saved myself a ton of time and energy in the process.
我以艰难的方式学到了这一课。 如果我花时间考虑如何学习,那么我将从一开始就选择其他资源,并在此过程中为自己节省了大量时间和精力。
您如何学习得最好? (How do you learn best?)
I was brand-new to programming and eager to start, so I naively took a Python book recommendation from a software engineer. I didn’t do much of my own research to evaluate the source — I just took his word. That was a mistake, though I didn’t realize it at the time.
我是编程的新手,并且渴望入门,所以我天真地接受了软件工程师的Python推荐书。 我并没有做太多的研究来评估消息来源-我只是听了他的话。 那是一个错误,尽管当时我还没有意识到。
I began my self-study in March, and the frustration was almost immediate. I persisted but each lesson was a struggle, mostly due to how the material was presented. The examples were abstract, the explanations were unclear, and there were too few practice problems.
我从三月份开始自学,而这种挫败感几乎是立竿见影的。 我坚持不懈,但是每节课都是一个挣扎,主要是由于材料的呈现方式。 这些例子是抽象的,解释不清楚,实践问题也很少。
After a few lessons, I went back to the same software engineer to ask for another recommendation. “There has to be a better way — a clearer way — to learn Python,” I told him.
经过几堂课,我回到了同一位软件工程师那里,要求其他建议。 我告诉他:“必须有更好的方法-更清晰的方法-学习Python。”
He recommended another source with a different approach to programming: rote memorization. This source was problematic from the start. I found myself memorizing how to write a function, but I had no idea why I was writing a function in the first place or when I’d use one. I got through the lessons, but never felt like I fully understood the material.
他推荐了另一种采用不同编程方法的资料:死记硬背。 这个来源从一开始就是有问题的。 我发现自己在记住如何编写函数,但是我不知道为什么要首先编写函数或何时使用函数。 我完成了所有课程,但从未感到自己完全了解这些材料。
By a stroke of luck, during this time of extreme frustration, I listened to a podcast that changed everything. Host Shane Parrish interviewed Barbara Oakley, an engineering professor and author. The topic was “learning how to learn.”
幸运的是,在这个极度沮丧的时期,我听了一个播客,它改变了一切。 主持人Shane Parrish采访了工程学教授兼作家Barbara Oakley。 主题是“学习如何学习”。
Intrigued by the podcast, I picked up one of Oakley’s books, A Mind for Numbers. It details strategies for learning math and science, but her suggestions can be applied to other subjects, including programming.
我对播客感兴趣,因此拿起了奥克利(Oakley)的一本书, 《数字观念》 。 它详细介绍了学习数学和科学的策略,但是她的建议可以应用于其他学科,包括编程。
I had an “aha” moment. Not once in my years of schooling did a teacher explain how to learn effectively. Nor did it occur to me to evaluate how I learn before starting my programming endeavors.
我有一个“啊哈”的时刻。 在我上学的那几年,没有一次老师解释如何有效学习。 在开始编程工作之前,我也没有想到要评估自己的学习方式。
But it wasn’t too late, since the learning never stops with programming. The sooner I could figure out how I learned best — especially how I learned technical topics — the better.
但这还不算太晚,因为学习永远不会因编程而停止。 我越早想出自己的最佳学习方式,尤其是学习技术主题的方式,就越好。
学习,正确的方法 (Learning, the right way)
The solution wasn’t immediate. For several weeks, I read books and watched lectures online about how to learn. I also evaluated my own learning style and the programming resources I’d used, both in terms of what they offered and what they lacked. The effort paid off. What I needed from a resource became abundantly clear.
解决方案不是立即的。 几个星期以来,我在网上读书和观看有关学习的讲座。 我还评估了我自己的学习风格和所使用的编程资源,无论它们提供了什么,也缺少了什么。 努力得到了回报。 我从资源中所需要的变得非常清楚。
I didn’t have programming experience. So, I needed straightforward explanations of major programming concepts, like loops, functions, and conditionals. I wanted the source to focus on understanding, not memorizing. I wanted many real-world examples with many practice problems. Did such a resource exist?
我没有编程经验。 因此,我需要对主要编程概念(如循环,函数和条件)进行简单说明。 我希望消息来源专注于理解,而不是背诵。 我想要许多有很多实践问题的实际例子。 是否存在这样的资源?
It was a warm Saturday evening in June and my husband and I walked to the MIT Coop, a bookstore in Cambridge. I had my pick of books that promised to teach me Python, but Eric Matthes’s book Python Crash Course caught my eye.
六月是一个温暖的星期六晚上,我和我丈夫走到剑桥的一家书店MIT Coop。 我挑选了一些可以教我Python的书,但是Eric Matthes的书Python Crash Course引起了我的注意。
As I scanned various chapters and practice problems, I felt confident Matthes’s book would teach me what I needed to know in a way that fit with my learning style. So I gave it a try, and instantly noticed a difference.
当我浏览各个章节和练习问题时,我感到自信的Matthes的书会以适合我的学习方式的方式教给我我需要了解的知识。 因此,我尝试了一下,立即发现了区别。
The topics Matthes covers are simple to learn and remember, largely because he chunks information.
Matthes涵盖的主题易于学习和记住,主要是因为他对信息进行了分块。
“Chunking helps you unite bits of information together through meaning,” Oakley writes in A Mind for Numbers.
奥克利在《数字思维 》一书中写道:“分类帮助您通过意义将信息的各个部分统一在一起。”
She uses a puzzle as an analogy. A new concept is like a bunch of scattered puzzle pieces. “Just memorizing a fact… without understanding or context doesn’t help you understand what’s really going on, or how the concept fits together with the other concepts you are learning.”
她用一个难题作比喻。 一个新概念就像一堆分散的拼图。 “仅仅记住一个事实……没有理解或上下文就不会帮助您了解实际发生的事情,或者该概念如何与您正在学习的其他概念相适应。”
This explains why the second resource I used never clicked. It lacked the understanding that chunking offers.
这就解释了为什么我使用的第二个资源从未被点击过。 它缺乏分块提供的理解。
Chunking brings the puzzle pieces together to form an image. “Gaining context” is part of the chunking process that helps you see the bigger picture. With context “you see not just how, but also when to use this chunk,” writes Oakley (emphasis Oakley).
块将拼图碎片组合在一起以形成图像。 “获取上下文”是分块过程的一部分,可帮助您看到更大的图景。 在上下文中,“您不仅看到如何使用此块,而且还看到了何时使用此块,” Oakley(强调Oakley)写道。
Matthes seems to share a similar view. He begins the functions chapter, much like his others, with context. He describes what functions are and when to use one. Sprinkled throughout are real-world examples of effective functions.
问题似乎也有类似的看法。 就像其他人一样,他从上下文开始了功能章节。 他描述了什么是功能以及何时使用该功能。 遍布各处的是有效功能的真实示例。
Plus, he weaves previously studied topics together with the new topic at hand. His functions chapter explains how to use a function to return a dictionary and modify a list, for instance. This further enhanced my knowledge base.
此外,他还编织了以前研究过的主题以及手头的新主题。 例如,他的函数一章说明了如何使用函数返回字典和修改列表。 这进一步增强了我的知识基础。
Matthes helps the budding programmer build a solid understanding of important programming fundamentals. His approach spearheaded my chunking process, but I didn’t just passively read a chapter and “get it.”
Matthes可帮助新兴的程序员深入了解重要的编程基础。 他的方法带头推动了我的分块过程,但我不只是被动地阅读一章并“得到它”。
In fact, I’m still working hard to strengthen my programming chunks. They take time to build. The aim is to build effective programming chunks, so I can actively recall the best one to use when solving a problem.
实际上,我仍在努力加强编程块。 他们需要时间来建造。 目的是建立有效的编程块,因此我可以积极地回忆解决问题时使用的最佳程序块。
Part of the chunking process involves completing practice problems, both those related and unrelated to the chunk that I’m trying to build. That way, Oakley suggests, “you see not only when to use the chunk, but [also] when not to use it” (emphasis Oakley). To build a “for loop” chunk, for example, I’ll complete problems that use a for loop and those that don’t.
分块过程的一部分涉及完成练习问题,这些问题与我要构建的块相关或无关。 这样,Oakley建议:“您不仅可以看到何时使用该块,而且还可以看到何时不使用它”(强调Oakley)。 例如,要构建“ for循环”块,我将完成使用for循环的问题和不使用for循环的问题。
This is why I needed a resource that offered a lot of practice. Here, too, Matthes’s book came through. Each chapter consists of several lessons, each with multiple questions that drill a concept.
这就是为什么我需要提供大量练习的资源的原因。 Matthes的书也在这里出现。 每章都包含几节课,每节课都包含钻研概念的多个问题。
However, completing practice problems unrelated to a chunk that I’m trying to build, as Oakley suggests, has been mostly up to me and often involves resolving problems at random.
但是,正如Oakley所建议的那样,完成与我尝试构建的块无关的练习问题主要取决于我,并且经常涉及随机解决问题。
Importantly, Matthes doesn’t provide the solutions to the problems. That may seem like a detriment, but I’ve found that when you’re given the answers immediately, you’re deprived of the struggle. The cycle of trying, failing, trying again, failing many more times, and persevering. That’s essential to the learning process and that makes programming so rewarding.
重要的是,Matthes并未提供解决问题的方法。 这看似有害,但我发现当您立即获得答案时,您就摆脱了挣扎。 尝试,失败,再次尝试,失败多次和坚持不懈的循环。 这对于学习过程至关重要,并且使编程如此有意义。
In the moment, the struggle can be tedious and frustrating. But it’s worth it. I learn the most when I struggle the most. Plus, the learning stays with me long after I’ve completed a problem.
目前,斗争可能是乏味而令人沮丧的。 但这是值得的。 我在最努力的时候学习最多。 另外,在我完成一个问题后很长一段时间里,学习仍然伴随着我。
After about three months of tinkering with multiple resources, Python finally started to click with Matthes’s book. But that was only part of the solution.
经过大约三个月的多种资源修补,Python终于开始点击Matthes的书。 但这只是解决方案的一部分。
学习策略 (A learning strategy)
Did I really understand functions? What about conditionals and classes?
我真的了解功能吗? 那么条件和类呢?
To find out, I wanted to put the knowledge I was gaining from Matthes’s book to the test. So I devised an overall learning plan that involved a lot of practice from other resources.
为了找出答案,我想将我从Matthes的书中获得的知识用于测试。 因此,我制定了一个总体学习计划,其中涉及来自其他资源的大量练习。
This is how it worked: I studied a chapter in Matthes’s book and completed the practice problems. Then I turned to Brian Hogan’s book Exercises for Programmers, which gave me more practice and solidified the concepts I was learning about at the time.
它是这样工作的:我研究了Matthes的书中的一章,并解决了练习中的问题。 然后我转向Brian Hogan的《 程序员的练习 》一书,该书为我提供了更多的练习,并巩固了我当时所学的概念。
Plus, Hogan’s book was in sync with my learning style. It was practical, real-world problems (without answers) and organized mostly by concept, though the problems range in difficulty. The two sources complemented each other.
另外,霍根的书与我的学习风格保持同步。 这是实际的,现实世界中的问题(没有答案),并且主要是按概念来组织的,尽管这些问题的难度范围很大。 两种来源相辅相成。
Matthes’s book provided foundational Python knowledge. Hogan’s book challenged that knowledge and pushed me outside of my comfort zone. Some of the problems in Hogan’s book took me hours, even days to solve. I experimented. I failed. I tried again. I researched new techniques, and re-studied ones I had learned about in Matthes’s book.
Matthes的书提供了Python的基础知识。 霍根的书挑战了这种知识,使我脱离了自己的舒适范围。 霍根(Hogan)的书中的某些问题使我花了数小时甚至数天才能解决。 我做了实验 我失败了。 我再次尝试。 我研究了新技术,然后重新研究了在Matthes的书中学到的技术。
By using these resources in tandem, I not only enhanced my programming knowledge, but sharpened my problem-solving skills.
通过同时使用这些资源,我不仅增强了编程知识,而且提高了解决问题的能力。
A big part of my overall learning strategy is what I call “random repetition.”
我的整体学习策略的很大一部分就是所谓的“随机重复”。
Randomness is a way to test my knowledge — to see if I can recall how and when to use a list as opposed to a dictionary. And repetition helps consolidate concepts.
随机性是测试我的知识的一种方法-看看我是否可以回忆起如何以及何时使用列表而不是字典。 重复有助于巩固概念。
After I completed the exercises in Hogan’s book, I did them once more, but this time at random. I’d test my knowledge by randomly selecting exercises that I’d completed in Matthes’s book as well. The Anki app has also been a lifesaver, since it checks my knowledge on a range of programming topics. It’s a constant reminder of what I know, but, more importantly, of what I don’t.
在完成了Hogan的书中的练习之后,我再次进行了练习,但这一次是随机的。 我会通过随机选择我在Matthes的书中完成的练习来测试我的知识。 Anki应用程序也成为了救命稻草,因为它检查了我对一系列编程主题的了解。 它不断提醒着我所知道的,但更重要的是,我不知道。
最后的想法 (Final thoughts)
Understanding how to learn effectively has made my entry into programming much more effective and enjoyable. In fact, the number of learning opportunities is one aspect that attracted me to programming in the first place.
了解如何有效学习使我对编程的了解更加有效和愉快。 实际上,学习机会的数量是吸引我起初编程的一个方面。
Now I realize how I can learn better. I’ve since moved onto a new learning phase with new materials and a new learning goal and strategy. At the start I took a few days to “test drive” potential sources. I identified the ones that would help me achieve my goals much quicker this time around.
现在,我意识到如何才能更好地学习。 从那以后,我进入了一个新的学习阶段,学习了新的材料和新的学习目标和策略。 一开始,我花了几天时间来“测试”潜在资源。 我确定了可以帮助我这次更快实现目标的目标。
Knowing what I know now, I would have given that young man at the Python meetup a different answer.
知道了我现在所知道的,我会给那个在Python聚会上的年轻人一个不同的答案。
The earlier you take control and figure out how you learn best, the better. The field of programming is evolving quickly. There’s a vast amount of information to learn about, from multiple languages to databases to testing.
您越早控制并弄清楚如何最好地学习,就会越好。 编程领域正在Swift发展。 从多种语言到数据库到测试,都有大量信息需要学习。
Learning the foundations of a programming language is just the beginning of a career of learning.
学习编程语言的基础仅仅是学习生涯的开始。
I write about technology, productivity, and art (amymhaddad.com).
我写有关技术,生产力和艺术的文章( amymhaddad.com )。
编程学习之前先学习那些英文