编程编程练习网站_您解决编程问题还是完成练习? (差异很重要。)

编程编程练习网站

People tend to use the terms “problems” and “exercises” interchangeably. But there’s a difference—and it matters.

人们倾向于交替使用术语“问题”和“锻炼”。 但是有区别,这很重要。

Professor Paul Zeitz makes the distinction.

Paul Zeitz教授对此加以区分。

Take 5 × 5. That’s easy, and that’s an exercise. So is 5,490,900 × 496. It’s a bit harder and will take you more time to solve, but you know what to do. That’s the key point.

取5×5。这很容易,而且是一种练习。 5,490,900×496也是如此。这有点困难,需要更多时间来解决,但是您知道该怎么做。 这就是关键。

“An exercise is a mathematical question that you immediately know how to answer,” explains Zeitz in a lecture series on problem-solving. “You may not answer it correctly, in fact you may never answer it correctly...but there’s no doubt about how to proceed.”

蔡茨在有关解决问题的系列讲座中解释说:“练习是一个数学问题,您会立即知道如何回答。” “您可能无法正确回答,实际上您可能永远无法正确回答...但是毫无疑问如何进行。”

Not so with problems. A problem, according to Zeitz, “is a mathematical question that you do not know how to answer, at least initially.”

问题并非如此。 根据Zeitz所说,问题“至少在最初是一个数学问题,您不知道如何回答。”

He defines problems and exercises through the lens of mathematical problem-solving, but they’re applicable to programming as well.

他通过数学问题解决的角度定义问题和练习,但是它们也适用于编程。

Each day we put our problem-solving skills to work as programmers: debugging code, learning a new topic, or even solving a problem. Exercises have their place, but as a programmer there’s no replacement for solving problems.

每天,我们都将解决问题的技能用作程序员:调试代码,学习新主题,甚至解决问题。 练习有其应有的地位,但是作为程序员,解决问题是无可替代的。

锻炼运动 (Exercise with Exercises)

There are two ways you can benefit from exercises. First, they’re helpful when learning a new topic.

您可以通过两种方式从练习中受益。 首先,它们在学习新主题时会很有帮助。

I’m learning JavaScript right now and using a mix of exercises and problems to do so. The exercises help me see patterns and get comfortable with concepts and syntax.

我现在正在学习JavaScript,并结合使用各种练习和问题来进行学习。 这些练习可以帮助我了解模式并熟悉概念和语法。

Here’s an example of an exercise from a project that asked me to write a function, which took an array of cars.

这是一个要求我编写一个函数的项目的示例,该函数需要一系列汽车。

const cars = [
  { id: 1, car_make: "Lincoln", car_model: "Navigator", car_year: 2009 },
  { id: 2, car_make: "Mazda", car_model: "Miata MX-5", car_year: 2001 },
  { id: 3, car_make: "Land Rover", car_model: "Defender Ice Edition", car_year: 2010 },
  ...
 ]

I had to sort the array of objects by the car_model key, in ascending order.

我必须按car_model键对对象数组进行升序排序。

It’s not to say this exercise was a breeze—it wasn’t. It took me time and I got my fair share of error messages.

这并不是说此练习轻而易举-并非如此。 我花了一些时间,并且得到了很多错误消息。

However, it qualifies as an exercise because I knew what I needed to do from the start.

但是,它有资格作为练习,因为我从一开始就知道我需要做的事情。

I’d recently learned about arrays in JavaScript. I was familiar with sorting data from my experience with Python, though I had to research how to do this in JavaScript. The explicit directions helped, too.

我最近了解了JavaScript中的数组。 尽管我不得不研究如何使用JavaScript进行数据处理,但我还是很熟悉根据Python经验对数据进行排序的方法。 明确的指示也有所帮助。

But the concepts were still new. I needed practice putting them together, which is why this exercise was valuable. Repetition breeds familiarity, and the concepts began to solidify in my mind.

但是这些概念仍然是新的。 我需要练习将它们放在一起,这就是为什么此练习很有价值的原因。 重复会滋生熟悉感,这些概念在我的脑海中开始固化。

维持您获得的收益 (Maintain What You’ve Gained)

Exercises also help keep learned information fresh.

练习还有助于使学习到的信息保持最新。

As I learn JavaScript, I don’t want to forget everything I’ve learned about the first language I learned, Python. So I use Anki, a flashcard program, multiple times per day.

在学习JavaScript的过程中,我不想忘记我所学到的关于第一门语言Python的所有知识。 因此,我每天多次使用抽认卡程序Anki。

In this context, exercises help you keep a mountain of material straight, remind you of important concepts, and get more comfortable using a particular data structure or approach. It’s maintenance work on the body of knowledge you’ve gained so far.

在这种情况下,练习可以帮助您保持笔直的资料,提醒您重要的概念,并可以使用特定的数据结构或方法更加自如。 到目前为止,这是对您所掌握的知识的维护工作。

I have over 1,000 cards that are filled with material I’ve seen many times before. Some cards have questions about syntax. Others ask me to write SQL queries or command-line or Git commands. Many others are filled with exercises, like “rotate a list of numbers to the right by one place value.”

我有超过1000张卡片,里面装满了我以前看过很多次的材料。 有些卡对语法有疑问。 其他人要求我编写SQL查询或命令行或Git命令。 许多其他活动充满了练习,例如“将数字列表向右旋转一个位值”。

It’s important to note that this exercise was once a problem for me. If you do a problem enough, it can become an exercise. At the same time, you can make an exercise a problem by adding a constraint.

重要的是要注意,此练习对我来说曾经是一个问题。 如果您做的足够多,那么它就可以成为练习。 同时,您可以通过添加约束来使练习成为一个问题。

Exercises are a slippery slope. On the one hand, they’re useful for learning purposes. On the other, it’s easy to get comfortable by sticking with exercises exclusively.

练习是湿滑的斜坡。 一方面,它们对于学习目的很有用。 另一方面,仅坚持锻炼很容易感到舒适。

That’s the downside: staying in your comfort zone.

缺点是:待在舒适区。

处理歧义 (Dealing with Ambiguity)

Programming is about problem-solving. And solving problems will take you outside of your comfort zone. This is a good thing.

编程是解决问题的方法。 解决问题将带您走出舒适区。 这是一件好事。

For me, problems have two distinctive qualities. The first is ambiguity. Problem-solving is largely about how to effectively deal with ambiguity.

对我而言,问题具有两种独特的品质。 首先是模棱两可。 解决问题在很大程度上与如何有效处理歧义有关。

  • An error message appears each time your program runs. Why? What’s going on? Where’s the bug? How can you fix it?

    每次您的程序运行时,都会出现一条错误消息。 为什么? 这是怎么回事? 错误在哪里? 您该如何解决?
  • You pull up a new problem statement. You read it and re-read it. At first glance, you’ve got no idea what’s going on, let alone what you need to do to solve it. You may even get the “deer in headlights” sensation that’s accompanied by a pit in the bottom of your stomach. (You picked a good problem!)

    您提出了新的问题说明。 您阅读并重新阅读。 乍一看,您不知道发生了什么,更不用说您需要做什么来解决它了。 您甚至可能会得到“头灯鹿”的感觉,并伴有胃底凹陷。 (您选择了一个好问题!)
  • You need to learn about relational databases. That’s pretty broad. How are you going to go about it? What to focus on first? What matters most? What do you really need to know right now?

    您需要了解关系数据库。 那很广泛。 你打算怎么做? 首先要关注什么? 最重要的是什么? 您现在真正需要了解什么?

These examples all involve ambiguity. And all of them require solving problems, whether that’s finding and trouble-shooting a bug, solving an actual problem, or learning a new topic.  

这些例子都含糊不清。 所有这些都需要解决问题 ,无论是查找错误并解决错误,解决实际问题还是学习新话题。

To make progress, you research, experiment, pull out the facts, create a plan, and apply a variety of problem-solving tactics. In short, you learn to figure it out. The more time you spend with a problem and the different perspectives you gain, the more layers it reveals and the closer you get to the “aha” moment.

为了取得进步,您需要进行研究,实验,找出事实,制定计划并应用各种解决问题的策略。 简而言之,您将学会弄清楚。 您花在解决问题上的时间越多,获得的观点越多,它揭示的层次就越多, 就越接近“ aha”时刻。

拥抱斗争 (Embrace the Struggle)

The other difference with problems is the struggle. It’s real.

问题的另一个区别是斗争。 它是真实的。

Problem-solving will test your mental stamina and patience. Progress can be slow, and the process tedious. I’ve toiled away at problems for hours, days, and even weeks.

解决问题的能力将测试您的精神耐力和耐心。 进展可能很慢,而且过程很繁琐。 我辛苦工作了几个小时,几天甚至几周。

It’s not to say that exercises won’t challenge you. They can. It’s one thing when you know that you need to use a particular method; you just need to get it to work properly. That’s a challenge, which can sometimes be downright frustrating.

并不是说练习不会挑战您。 他们能。 当您知道需要使用特定方法时,这是一回事。 您只需要使其正常工作即可。 这是一个挑战,有时可能会令人沮丧。

But it’s something else entirely when you have no idea what to do from the start, which may happen multiple times when solving a problem. To me, problems are a struggle.

但这完全是另一回事,当您一开始就不知道要做什么时,解决问题时可能会发生多次。 对我来说,问题是一场斗争。

The best solution is to endure it and get yourself unstuck. In my experience, the struggle means I’m learning a lot and the breakthrough is usually around the corner.

最好的解决方案是忍受它并使自己陷入困境 。 根据我的经验,奋斗意味着我学到了很多东西,而突破通常就在眼前。

As you push through the mental discomfort, you’ll find yourself thinking creatively and devising solutions you never thought of before. (You surprise and impress yourself—you know more than you think!) You’re becoming a stronger programmer.

克服精神不适时,您会发现自己创造性地思考并设计出从未想过的解决方案。 (您会感到惊讶并给自己留下深刻的印象-您知道的比您想象的要多!)您正在成为一个更强大的程序员。

You’ll even find yourself having fun. Problem-solving is challenging, to be sure, and even frustrating at times. But it’s also incredibly rewarding.

您甚至会发现自己很开心。 当然,解决问题具有挑战性,有时甚至令人沮丧。 但这也令人难以置信。

It’s like crossing the finish line of a half-marathon. No doubt the past 13.1 miles were grueling, but crossing the finish line was worth it and I’d do it again. Solving a problem feels the same way.

就像越过半程马拉松的终点线一样。 毫无疑问,过去的13.1英里非常艰苦,但是越过终点线是值得的,我会再做一次。 解决问题的感觉是一样的。

是什么:问题或练习? (Which Is It: Problems or Exercises?)

When you crack open your laptop, are you going to solve problems or complete exercises?  

当您打开笔记本电脑时,是要解决问题还是完成练习?

Exercises have benefits, and it’s fine to incorporate them into your programming sessions. I use exercises as a warm-up prior to a programming session. I’ll flip through an Anki flashcard deck for ten or fifteen minutes and work through some exercises. If I’m learning something new, like JavaScript, I may have an entire programming session devoted to exercises.

练习有好处,可以将它们纳入您的编程课程中。 在编程会议之前,我将练习用作热身。 我将翻看Anki抽认卡十到十五分钟,并进行一些练习。 如果我正在学习诸如JavaScript之类的新知识,那么我可能会进行整个编程课程来练习。

However, I devote time each day to solving problems—no matter what else I’m learning or building. Even on the days when I allocate a large chunk of time to exercises, I allocate plenty of time to solving problems, too.  

但是,我每天都花时间解决问题,无论我正在学习或正在学习什么。 即使在我分配大量时间进行锻炼的日子里,我也分配了大量时间来解决问题。

So when you’re about to start a programming session, be aware what you’re setting out to do: exercises or problems. And no matter what, make time for solving problems.

因此,当您要开始编程会话时,请注意要执行的操作:练习或问题。 无论如何,都要花时间解决问题。

Problem-solving is a skill that takes a lot of practice and time to develop. The only way to get better is to work at it each day. It’s that important, and for good reason.

解决问题是一项需要大量实践和时间才能发展的技能。 变得更好的唯一方法就是每天工作。 这很重要,并且有充分的理由。

We solve problems each day as programmers, and in a variety of ways. Making time to problem-solve is a no-brainer; our work as programmers depends on it.

我们每天都以程序员的方式并以多种方式解决问题。 花时间解决问题是不费吹灰之力的; 我们作为程序员的工作依赖于此。

I write about learning to program, and the best ways to go about it (amymhaddad.com).

我写了有关学习编程的文章,以及进行编程的最佳方法 ( amymhaddad.com )。

翻译自: https://www.freecodecamp.org/news/do-you-solve-programming-problems-or-complete-exercises-the-difference-matters/

编程编程练习网站

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值