沉迷于网络的人数_检查您是否完全沉迷于编程的两件事

沉迷于网络的人数

程式设计 (PROGRAMMING)

Learning to code is hard.

学习编码很难。

I’ve gone through countless YouTube videos, online courses, and personal projects. Yet somehow, I feel like I’m no further along than when I started.

我经历了无数的YouTube视频,在线课程和个人项目。 然而,不知何故,我觉得我距离开始时还很遥远。

As I continue reading articles on programming, data science, and cloud computing, it’s hard not to feel overwhelmed and intimidated by the cool stuff everyone else is doing. Even looking at the Python subreddit makes me wonder how people who have only been learning for a few months can build such complex projects.

当我继续阅读有关编程,数据科学和云计算的文章时,很难不被其他人正在做的好事所淹没和吓倒。 即使查看Python subreddit,也让我想知道仅仅学习了几个月的人如何构建如此复杂的项目。

I started the CS50 course by Harvard, which I would highly recommend to anyone looking for an introduction to Computer Science. After every lecture, you’re tasked to write code to solve an assignment based on that week’s topic. I recently finished Week 3 on “Algorithms” and completed the second assignment.

我开办了哈佛大学CS50课程 ,我强烈推荐给任何寻求计算机科学入门的人。 每堂课后,您都需要编写代码来解决基于该周主题的作业。 我最近完成了第3周的“算法”并完成了第二个作业。

It took me almost six hours.

我花了将近六个小时。

When my code finally passed all the tests, I was more relieved than ecstatic. Staring at a seemingly simple problem and not knowing how to fix bug after bug for so long made me question whether I even had any problem-solving skills to speak of. I also wondered how long it took others to solve. Surely most people (from students of Harvard to the thousands of enrolled in the online course) didn’t need to spend half a day on one assignment.

当我的代码最终通过所有测试时,我欣喜若狂。 盯着一个看似简单的问题,而且不知道如何解决一个错误一个问题这么长时间,这使我开始怀疑我是否还有任何解决问题的技能。 我还想知道其他人花了多长时间解决问题。 当然,大多数人(从哈佛大学的学生到成千上万的在线课程的参加者)都不需要花半天的时间完成一项作业。

Thankfully, before I spiraled into a black hole of self-doubt (mild exaggeration), two events put me back on track. They helped me realize that while it’s great to always want to learn more, it’s also important to believe in your abilities so far. You might be further along than you think.

值得庆幸的是,在我陷入自我怀疑的黑洞(轻度夸张)之前,有两次事件使我重回正轨。 他们帮助我意识到,虽然总是想学习更多,这很重要,但到目前为止,相信自己的能力也很重要。 您可能比您想像的要远。

Let’s dive into the two things you should do to check if you suck at programming!

让我们深入研究您应该做的两件事,以检查您是否喜欢编程!

1.为某人建造东西 (1. Build something for someone)

I recently looked at some code I wrote for work a few months ago and thought “wow, this is bad.” I shook my head and started to untangle the mess of functions and variables I’d created, wondering all the while why I didn’t add more comments to it.

我最近查看了几个月前为工作编写的一些代码,并认为“哇,这很糟糕”。 我摇了摇头,开始解开我创建的函数和变量的混乱局面,一直想知道为什么我没有在其中添加更多注释。

My girlfriend saw me grumbling to myself as I typed away and asked what was wrong. When I told her that my code sucked, she asked, “Does it work?”

当我打字时,我的女朋友看到我对自己抱怨,问什么地方出了问题。 当我告诉她我的代码很烂时,她问:“行得通吗?”

“Yeah, it works, but it’s so messy and I barely remember how I wrote this in the first place.” I said.

“是的,它可以工作,但是它太乱了,我几乎不记得我是怎么写这个的。” 我说。

“Well, you’re already almost done fixing it now, so that means you do remember.” she replied.

“好吧,您现在几乎已经完成了修复,所以这意味着您确实记得。” 她回答。

Then she asked again:

然后她再次问:

“Does it work?”

“行吗?”

It’s a simple question, yes, but it can reveal so much. First, I will preface the rest of this section by saying that yes, it’s important that what you build is built well (scalability, readability, avoiding deep nesting, DRY, etc.). I’m not saying that you should be happy if you write garbage that technically fulfills its intended function.

这是一个简单的问题,但是它可以揭示很多。 首先,我将在本节的其余部分开头说,是的,重要的是要构建好构建好的内容(可伸缩性,可读性,避免深层嵌套,DRY等)。 我并不是说,如果您编写技术上可以实现其预期功能的垃圾,您应该感到高兴。

However, if you what you built serves its purpose and isn’t completely confusing when you need to explain how it works, you should be proud!

但是,如果您构建的产品符合其目的,并且在需要解释其工作原理时不完全感到困惑,那么您应该感到骄傲!

This brings me to how you can test your programming skills by building something for someone. There’s an incredibly satisfying feeling that you get watching code you wrote help someone else.

这使我想到了如何通过为某人建立一些东西来测试自己的编程技能。 有一种令人难以置信的满足感,即您可以观看自己编写的帮助他人的代码。

My girlfriend recently needed to translate text from PDF files. However, the PDFs she’s working with are scanned images. She can’t actually copy any of the text, so she’s had to manually type paragraphs into Google Translate. Also, since she only needs a few paragraphs of the PDF translated, using an online service that would translate the whole document (or even a page) wouldn’t be very helpful.

我的女友最近需要翻译PDF文件中的文本。 但是,她正在使用的PDF是扫描图像。 她实际上无法复制任何文本,因此不得不手动将段落键入Google Translate。 另外,由于她只需要翻译几段PDF,因此使用可以翻译整个文档(甚至页面)的在线服务不是很有帮助。

I saw what she was doing and thought to myself “Hm, I could probably help with that”.

我看到她在做什么,心想:“嗯,我可能可以帮上忙。”

I then wrote a really, really simple CLI application for her that would take an image as an argument, get all the text from the image with pytesseract, then copy that text to the clipboard.

然后,我为她编写了一个非常非常简单的CLI应用程序,该应用程序将图像作为参数,使用pytesseract从图像中获取所有文本,然后将其复制到剪贴板。

Typing paragraphs into Google Translate isn’t a hugely time-consuming task. With that being said, even if I’ve only shaved off 30 minutes of her work every day, that’s still an extra 30 minutes of her life that she gets back!

在Google翻译中输入段落并不是一项耗时的工作。 话虽这么说,即使我每天只削减了她30分钟的工作时间,她仍然可以再度节省30分钟!

Identifying a solution and building it to help her, strangely enough, helped me realize that all my learning so far isn’t confined to my head. I could actually use it to make other peoples’ lives better.

奇怪的是,找到一个解决方案并构建它来帮助她,这使我意识到,到目前为止,我的所有学习并不局限于我自己。 我实际上可以使用它来改善其他人的生活。

And you can too! Look around to the people close to you, whether it’s your family or colleagues, and I’m sure you’ll be able to find something that you can help them automate. Being able to think of and develop a solution, even if its one for a trivial problem, is programming.

而且您也可以! 环顾周围的人,无论是您的家人还是同事,我相信您都可以找到可以帮助他们实现自动化的东西 。 能够思考和开发解决方案,即使它是解决一个小问题的方案, 也是编程。

2.教某人 (2. Teach something to someone)

This is advice that you’ve probably seen before. Teaching someone a concept you just learned is a great way for you to retain information. This is because it’s impossible to teach without first understanding the subject. If you try to teach someone a new concept without having mastered it, you may be able to recite a basic summary, but you won’t be able to answer any of their follow up questions.

这是您以前可能见过的建议。 向某人传授您刚刚学到的概念是保留信息的好方法。 这是因为如果不先了解该主题就不可能进行教学。 如果您尝试在不掌握新概念的情况下教别人一个新概念,则您可能可以背诵基本摘要,但无法回答他们的任何后续问题。

I first learned about list comprehensions in Python a while back and I’ve used them in various scenarios since. However, I only really knew that I understood them when I helped my girlfriend with one of her scripts.

一段时间以前,我首先了解了Python中的列表推导,从那时起,我在各种场景中使用了它们。 但是,当我帮助女友编写她的剧本之一时,我才真正了解它们。

She was looking for a way to automate moving files into different folders based on part of the filename matching a folder name. She first wanted to create all the folders based on the filenames. For example, a file called 12345_file.pdf was in the directory, which meant that she needed to create a folder called 12345.

她正在寻找一种方法,根据与文件夹名称匹配的部分文件名,将文件自动移动到不同的文件夹中。 她首先想根据文件名创建所有文件夹。 例如,目录中存在一个名为12345_file.pdf的文件,这意味着她需要创建一个名为12345的文件夹。

To do this, she wanted to implement a for loop to get the first digits of all the file names and put them in a list, then loop through that list to create all the folders. However, there were some cases where some of the first digits were duplicated. There could be another file called 12345_newfile.pdf, 12345_oldfile.pdf, and so on. This would lead to a list containing duplicate values, which would not work.

为此,她想实现一个for循环以获取所有文件名的前几位并将其放在列表中,然后循环浏览该列表以创建所有文件夹。 但是,在某些情况下,某些第一位数字是重复的。 可能还有另一个名为12345_newfile.pdf12345_oldfile.pdf文件,依此类推。 这将导致包含重复值的列表不起作用。

To simultaneously avoid using for loop to create a list and remove all duplicates from the list, I wrote this for her:

为了同时避免使用for循环创建列表并从列表中删除所有重复项,我为她编写了此代码:

folder_name_list = set([i[:5] for i in original_filepath_list])

We already had a list of the file paths, so I explained to her that you could use a list comprehension to create a list. You could define the components of the list and any conditions for it using a list comprehension instead of making an empty list and looping through and appending new elements to it. In this example, I would take the first 5 characters of each element in the existing list of file paths. Then, to remove all duplicates from the list, I just converted the list into a set, because a set in Python cannot have duplicate values.

我们已经有了文件路径的列表,因此我向她解释说,您可以使用列表推导来创建列表。 您可以使用列表理解来定义列表的组成部分以及列表的任何条件,而不是创建一个空列表并遍历并向其添加新元素。 在此示例中,我将采用现有文件路径列表中每个元素的前5个字符。 然后,要从列表中删除所有重复项,我只是将列表转换为集合,因为Python中的集合不能具有重复值。

Going through that process felt great because:

经历这个过程感觉很棒,因为:

  1. Removing duplicates from a list is an incredibly common task, so being able to explain how to do it quickly and without looking anything up meant I had really practiced doing it enough.

    从列表中删除重复项是一项非常普通的任务,因此能够解释如何快速进行并且无需查找任何内容,这意味着我已经足够练习。
  2. Being able to explain a (relatively) more advanced operation like list comprehensions meant that I was doing more than just concatenating strings and stuff.

    能够解释(相对)更高级的操作(如列表推导)意味着我所做的不只是连接字符串和东西。
  3. I got to help someone out again! I watched as someone learned something new and got to implement it in their own code, which meant that my learning resulted in a positive tangible impact in someone else’s life.

    我必须再次帮助某人! 我看着有人学习了一些新东西,并且必须用自己的代码来实现它,这意味着我的学习对他人的生活产生了积极的切实影响。

Sidenote: I know there are many other ways to accomplish the above process- she ended up using shutil to move everything into folders by checking if each file keyword was present in the list of folder names. If you've got another solution you'd like to share, please do. I'll send them to her and you can say you helped some random person on the internet with your code.

Sidenote: I know there are many other ways to accomplish the above process- she ended up using shutil to move everything into folders by checking if each file keyword was present in the list of folder names. If you've got another solution you'd like to share, please do. I'll send them to her and you can say you helped some random person on the internet with your code.

I’m not saying that if you can build something and teach something to someone else that you’re an amazing programmer. In fact, sometimes by building and teaching I realize (yet again) that I still have so much to learn. I will likely never run out of new things to learn, but by helping others, I know one thing for sure: if someone else benefits from something I did for them, I don’t completely suck!

我并不是说,如果您可以构建某些东西并向他人传授一些东西,那么您就是一个了不起的程序员。 实际上,有时通过构建和教学,我再次意识到,我还有很多东西要学习。 我可能永远不会耗尽新的知识来学习,但是通过帮助别人,我肯定知道一件事:如果别人从我为他们所做的事情中受益,我不会完全糟透了!

If you do find yourself stuck in a rut, read this encouraging excerpt from a very wise friend:

如果您发现自己陷入困境,请阅读一个非常明智的朋友的鼓励节录:

Image for post
Some programming (and life) advice
一些编程(和生活)建议

“… [programming] it’s like math man. You can spend your whole life learning math and you can always learn more… Everyone has a certain affinity for it but it’s mostly practice anyways… It’s never too late to learn.”

“……(编程)就像数学人一样。 您可以毕生学习数学,并且可以始终学习更多……每个人对此都有一定的亲和力,但是无论如何它大多都是练习……学习永远不会太晚。”

And that’s all!

就这样!

I hope I’ve made it clear that you most likely don’t completely suck at programming. You may not be a prodigy, an expert, or even just competent yet, but keep practicing and helping others, and you’ll be well on your way.

我希望我已经明确表示您很可能不会完全沉迷于编程。 您可能不是天才,专家,甚至还不是干练的人,而是继续练习和帮助他人,这样您会顺利进行的。

Happy coding!

编码愉快!

翻译自: https://towardsdatascience.com/two-things-to-do-to-check-if-you-completely-suck-at-programming-ce48b906243d

沉迷于网络的人数

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值