如何开始学习编程？
编程 学习

> 
> 编程初学者可能都思考过这个问题，“我该怎么学编程？”这里我们提供些相关的参考指导来帮助你找到最适合自己学习情况和学习需要的方法。
> 
> 
> 


![](/data/attachment/album/201707/17/123408c3eai8xbqazk9xiw.png)


最近有很多关于学习编程的争论。不仅仅是因为与软件开发公司公开的待应聘的职位数量相比较[符合招聘要求的人远远无法满足缺口](http://www.techrepublic.com/article/report-40-of-employers-worldwide-face-talent-shortages-driven-by-it/)，编程也是[工资最高](http://web.archive.org/web/20170328065655/http://www.businessinsider.com/highest-paying-jobs-in-america-2017-3/#-25)和[工作满足感最强](https://stackoverflow.com/insights/survey/2017/#career-satisfaction)的众多职业之一。也难怪越来越多的人都想进入这个行业。


但是你要怎么做才能正确地入行呢？“**我应该怎么学习编程？**”是初学者常见的一个问题。尽管我没有这些问题的全部答案，但是我希望这篇文章能够给你提供相关指导来帮助你找到最适合你的需求和自身情况发展的解决办法。


### 你的学习方式是什么？


在你开始学习编程之前，你需要考虑的不仅仅是你的方向选择，还要更多的考虑下你自己。古罗马人有句谚语，<ruby> <a href="https://en.wikipedia.org/wiki/Know_thyself">  γνῶθι σεαυτόν </a> <rp>  （ </rp> <rt>  gnothi seauton </rt> <rp>  ） </rp></ruby>，意思是“认识你自己”。投入到一个大型的编程学习过程中难度不小。足够的自我认识是非常有必要的，这能够确保你做出的选择通向成功的机会非常大。你需要思考并诚实地回答接下来的这些问题：


* **你最喜欢什么样的学习方式？**怎么做你才能学到最好？是通过阅读的方式吗？还是听讲座？还是主要通过动手实践？你需要选择对你最有效的方法。不要仅仅因为这种学习方法流行或者有其他人说过这种方法对他们很有用就选择了这种方法。
* **你的需要和要求是什么？**你为什么想学习如何编程？是因为你只是想换一份工作吗？如果是这样的话，你需要多次时间才能完成呢？你要牢记，这些是*需要的* ，不是*想要的* 。你可能*想要*下周就换份新工作，但是*需要*在接下来的一年里供养你正在成长的家庭。当你在人生的道路上面临方向的抉择时，时间的安排特别重要。
* **你能获取的参考资料有哪些？**当然，重返大学并获得一份计算机科学专业的学位证书可能也不错，但是你必须对你自己实事求是面对现实。你的生活必须和你学习相适应。你能承受花费几个月的时间和不菲的费用去参加集训吗？你是否生活在一个可以提供学习机会的地方，比如提供技术性的聚会或者大学课程？你能获取到的参考资料会对你的学习过程产生巨大的影响。在打算学编程换工作前先调查好这些。


### 选择一门编程语言


当你打算开始你的编程学习之路和考虑你的选择的时候，请记住不管其他人说什么，选择哪门编程语言来开始你的编程学习*关系不大*。是的，是有些编程语言比其他的更流行。比如，根据一份调查研究，目前 JavaScript，Java，PHP， 和 Python 处于 [最受欢迎最流行的编程](https://stackoverflow.com/insights/survey/2017/#most-popular-technologies) 中的前排。但是现在正流行的编程语言有可能过几年就过时了，所以不用太纠结编程语言的选择。像那些方法，类，函数，条件，控制流程和其他的编程的概念思想等等，不管你选的哪门编程语言，它们的底层原理基本是一致的。只有语法和社区的最佳实践会变。因此你能够用 [Perl](https://learn.perl.org/tutorials/) 学习编程，也可以用 [Swift](http://shop.oreilly.com/product/0636920045946.do) 或者 [Rust](https://doc.rust-lang.org/book/)。作为一个程序员，你会在你的职业生涯里用很多不同的编程语言来工作。不要认为你被困在了编程语言的选择上。


### 试水


除非你已经涉足过这个行业或者确信你愿意花费你生命的剩余时光来编程，我建议你最好还是下水之前先用脚趾头来试试水温之类的来判断这水适不适合。这种工作不是每个人都能做的。在把全部希望都压在学习编程之前，你可以先尝试花费少量时间金钱来学习一小部分知识点来了解自己是否会享受这种每周起码花费 40 个小时来编码工作的生活。如果你不喜欢这种工作，你不太可能完成编程项目的学习。即便你完成结束了编程的学习阶段，你也会在你以后的编程工作中感到无比痛苦。人生苦短就不要花费你人生三分之一的时间来做你不喜欢的事了。　


谢天谢地，软件开发不仅仅需要编程。熟悉编程概念和理解软件是怎么和他们结合在一起的是非常有用的，但是你不需要成为一个程序员也能在软件开发行业中找到一份报酬不菲的工作。在软件开发过程中，另外的重要角色有技术文档撰写人、项目经理、产品经理、测试人员、设计人员、用户体验设计者、运维/系统管理员和数据科学家等。软件成功的启动需要很多角色之间相互配合。不要觉得学习了编程就要求你成为一个程序员。你需要探索你的选择并确定哪个选择才是最适合你的。


### 参考的学习资料


你对学习参考资料的选择是什么？可能正如你已经发现的那样，可供选择的参考资料非常多，尽管在你的那片区域不是所有的资料都能够获得。


* **训练营**：最近这几年像 [App Academy](https://www.appacademy.io/) 和 [Bloc](https://www.bloc.io/) 这样的训练营越来越流行。训练营通常收费 $10K 或者更多，他们宣称在几周内就能够把一个学生培训成一个称职的程序员。在参加编程集训营前，你需要研究下你将要学习的项目能确保正如它所承诺的那样，在学生学完毕业后能够找到一个高薪的长期供职的职位。一方面花费了数目不小的钱财，而且时间也花费了不少——通常这些都是典型的全日制课程并且要求学生在接下来的连续几周里把其它的事先放在一边专心课程学习。然而时间金钱这两项不菲的消耗通常会使很多未来的程序员无法参加训练营。
* **社区学院/职业培训中心**：社区学院常常被那些调研自己学习编程的方式的人所忽视，不得不说这些人该为自己对社区学院的忽视感到羞愧。你在社区学院或者职业培训中心能够接受到的教育是和你选择其他方式学习编程的学习效果一样有效，而且费用也不高。
* **国家/地方的培训项目**：许多地区都认识到在他们的地区增加技术投资的经济效益，并且已经制定了培训计划来培养受过良好教育和准备好的劳动力。培训项目的案例包括了 [Code Oregon](http://codeoregon.org/) 和 [Minneapolis TechHire](http://www.minneapolismn.gov/cped/metp/TechHire#start)。检查下你的州、省或自治区是否提供这样的项目。
* **在线训练**：许多公司和组织都提供在线技术培训项目。比如，[Linux 基金会](https://training.linuxfoundation.org/)致力于通过开源技术使人们获得成功。其他的像 [O'Reilly Media](http://shop.oreilly.com/category/learning-path.do)、[Lynda.com](https://www.lynda.com/) 和 [Coursera](https://www.coursera.org/) 在软件开发涉及的许多方面提供培训。[Codecademy](https://www.codecademy.com/) 提供对编程概念的在线介绍。每个项目的成本会有所不同，但大多数项目会允许你在你的日程安排中学习。
* **MOOC**：在过去的几年里，大规模开放在线课程的发展势头已经很好了。像 [哈佛](https://www.edx.org/school/harvardx)、[斯坦福](http://online.stanford.edu/courses)、[MIT](https://ocw.mit.edu/index.htm) 和其他的一些世界一流大学他们一直在记录他们的课程，并免费提供在线课程。课程的自我指导性质可能并不适合所有人，但可利用的材料使这成为一个有价值的学习选择。
* **专业书籍**：许多人喜欢用书自学。这是相当经济的，在初步学习阶段后提供了现成的参考资料。尽管你可以通过像 [Safari](https://www.safaribooksonline.com/) 和 [Amazon](https://amazon.com/) 这样的在线服务订购和访问图书，但是也不要忘了检查你本地的公共图书馆。


### 网络支持


无论你选择哪一种学习资源，有网络支持都将获得更大的成功。与他人分享你的经历和挑战可以帮助你保持动力，同时为你提供一个放心的地方去问那些你可能还没有足够自信到其他地方去问的问题。许多城镇都有当地的用户群聚在一起讨论和学习软件技术。通常你可以在 [Meetup.com](https://www.meetup.com/) 这里找到。专门的兴趣小组，比如 [Women Who Code](https://www.womenwhocode.com/) 和 [Code2040](http://www.code2040.org/)，在大多数城市地区经常举行会议和黑客马拉松活动，这是在你学习的时候结识并建立一个支持网络的很好的方式。一些软件会议举办“黑客日”，在那里你可以遇到有经验的软件开发人员，他们能够帮助你解决你所困扰的一些问题。例如，每年的 [PyCon](https://us.pycon.org/) 会议都会提供几天的时间来让人们聚集在一起工作、研讨。一些项目，比如 [BeeWare](http://pybee.org/)，使用这些短暂的时间来帮助新程序员学习和对这些项目做贡献。


你的网络支持不需要来自正式的聚会。一个小的学习小组可以有效地保持你的学习积极性，并且可以像在你最喜欢的社交网络上发布邀请一样容易形成。如果你生活在一个没有大量软件开发人员社区所支持的聚会和用户组的地区，那么这一点特别有用。


### 开始学习编程的几个步骤


简单的来说，既然你决定学习编程，可以参考这几个方法给自己一个尽可能成功的机会：


1. 将你的需要/需求和参考学习资料列出清单并进行收集
2. 搜寻在你的当地那里能够可用的选择
3. 放弃不能符合你的需求和参考学习资料的选择
4. 选择最符合你需求的和最适合你的学习参考资源
5. 找到一个能够得到支持的网络


务必牢记：你的学习过程永远不会结束。高速发展的软件产业，会导致新技术和新进展几乎每天都会出现。一旦你学会了编程，你就必须花时间去学习适应这些新的进步。你不能依靠你的工作来为你提供这种培训。只有你自己负责自己的职业发展，所以如果你想保持最新的技术和工作能力，你必须紧跟行业最新的技术。


祝你好运！




---


作者简介：


VM (Vicky) Brasseur - VM (aka Vicky) 是一个技术人员，也是项目、工作进程、产品和企业的经理。在她的长达 18 年的科技行业里，她曾是一名分析师、程序员、产品经理、软件工程经理和软件工程总监。目前，她是惠普企业上游开源开发团队的高级工程经理。她的博客是 anonymoushash.vmbrasseur.com，推特是 @vmbrasseur。　




---


via: <https://opensource.com/article/17/4/how-get-started-learning-program>


作者：[VM (Vicky) Brasseur](https://opensource.com/users/vmbrasseur) 译者：[WangYueScream](https://github.com/WangYueScream) 校对：[wxy](https://github.com/wxy)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译，[Linux中国](https://linux.cn/) 荣誉推出


OK
There's a lot of buzz lately about learning to program. Not only is there a [shortage of people](http://www.techrepublic.com/article/report-40-of-employers-worldwide-face-talent-shortages-driven-by-it/) compared with the open and pending positions in software development, programming is also a career with one of the [highest salaries](http://web.archive.org/web/20170328065655/http://www.businessinsider.com/highest-paying-jobs-in-america-2017-3/#-25) and [highest job satisfaction rates](https://stackoverflow.com/insights/survey/2017/#career-satisfaction). No wonder so many people are looking to break into the industry!

But how, exactly, do you do that? "**How can I learn to program?**" is a common question. Although I don't have all the answers, hopefully this article will provide guidance to help you find the approach that best suits your needs and situation.


## What's your learning style?

Before you start your learning process, consider not only your options, but also yourself. The ancient Greeks had a saying, [γνῶθι σεαυτόν](https://en.wikipedia.org/wiki/Know_thyself) (gnothi seauton), meaning "know thyself". Undertaking a large learning program is difficult. Self awareness is necessary to make sure you are making the choices that will lead to the highest chance of success. Be honest with yourself when you answer the following questions:

**What is your preferred learning style?**How do you learn best? Is it by reading? Hearing a lecture? Mostly hands-on experimentation? Choose the style that is most effective for you. Don't choose a style because it's popular or because someone else said it worked for them.**What are your needs and requirements?**Why are you looking into learning how to program? Is it because you wish to change jobs? If so, how quickly do you need to do that? Keep in mind, these are*needs*, not*wants*. You may*want*a new job next week, but*need*one within a year to help support your growing family. This sort of timing will matter when selecting a path.**What are your available resources?**Sure, going back to college and earning a computer science degree might be nice, but you must be realistic with yourself. Your life must accommodate your learning. Can you afford—both in time and money—to set aside several months to participate in a bootcamp? Do you even live in an area that provides learning opportunities, such as meetups or college courses? The resources available to you will have a large impact on how you proceed in your learning. Research these before diving in.

## Picking a language

As you start your path and consider your options, remember that despite what many will say, the choice of which programming language you use to start learning simply does *not* matter. Yes, some languages are more popular than others. For instance, right now JavaScript, Java, PHP, and Python are among the [most popular languages](https://stackoverflow.com/insights/survey/2017/#most-popular-technologies) according to one study. But what is popular today may be passé next year, so don't get too hung up on choice of language. The underlying principles of methods, classes, functions, conditionals, control flow, and other programming concepts will remain more or less the same regardless of the language you use. Only the grammar and community best practices will change. Therefore you can learn to program just as well in [Perl](https://learn.perl.org/tutorials/) as you can in [Swift](http://shop.oreilly.com/product/0636920045946.do) or [Rust](https://doc.rust-lang.org/book/). As a programmer, you will work with and in many different languages over the course of your career. Don't feel you're "stuck" with the first one you learn.

## Test the waters

Unless you already have dabbled a bit and know for sure that programming is something you'd like to spend the rest of your life doing, I advise you to dip a toe into the waters before diving in headfirst. This work is not for everyone. Before going all-in on a learning program, take a little time to try out one of the smaller, cheaper options to get a sense of whether you'll enjoy the work enough to spend 40 hours a week doing it. If you don't enjoy this work, it's unlikely you'll even finish the program. If you do finish your learning program despite that, you may be miserable in your subsequent job. Life is too short to spend a third of it doing something you don't enjoy.

Thankfully, there is a lot more to software development than simply programming. It's incredibly helpful to be familiar with programming concepts and to understand how software comes together, but you don't need to be a programmer to get a well-paying job in software development. Additional vital roles in the process are technical writer, project manager, product manager, quality assurance, designer, user experience, ops/sysadmin, and data scientist, among others. Many different roles and people are required to launch software successfully. Don't feel that learning to program requires you to become a programmer. Explore your options and choose what's best for you.

## Learning resources

What are your options for learning resources? As you've probably already discovered, those options are many and varied, although not all of them may be available in your area.

**Bootcamps**: Bootcamps such as[App Academy](https://www.appacademy.io)and[Bloc](https://www.bloc.io)have become popular in recent years. Often charging a fee of $10K USD or more, bootcamps advertise that they can train a student to become an employable programmer in a matter of weeks. Before enrolling in a coding bootcamp, research the program to make sure it delivers on its promises and is able to place its students in well-paying, long-term positions after graduation. The money is one cost, whereas the time is another—these typically are full-time programs that require the student to set aside any other obligations for several weeks in a row. These two costs often put bootcamps outside the budget of many prospective programmers.**Community college/vocational training center**: Community colleges often are overlooked by people investigating their options for learning to program, and that's a shame. The education you can receive at a community college or vocational training center can be as effective as other options, at a fraction of the cost.**State/local training programs**: Many regions recognize the economic benefits of boosting technology investments in their area and have developed training programs to create well-educated and -prepared workforces. Training program examples include[Code Oregon](http://codeoregon.org)and[Minneapolis TechHire](http://www.minneapolismn.gov/cped/metp/TechHire#start). Check to see whether your state, province, or municipality offers such a program.**Online training**: Many companies and organizations offer online technology training programs. Some, such as[Linux Foundation](https://training.linuxfoundation.org), are dedicated to training people to be successful with open source technologies. Others, like[O'Reilly Media](http://shop.oreilly.com/category/learning-path.do),[Lynda.com](https://www.lynda.com), and[Coursera](https://www.coursera.org)provide training in many aspects of software development.[Codecademy](https://www.codecademy.com)provides an online introduction to programming concepts. The costs of each program will vary, but most of them will allow you to learn on your schedule.**MOOCs**: MOOCs—Massive Open Online Courses—have really picked up steam in the past few years. World-class universities, such as[Harvard](https://www.edx.org/school/harvardx),[Stanford](http://online.stanford.edu/courses),[MIT](https://ocw.mit.edu/index.htm), and others have been recording their courses and making them available online for free. The self-directed nature of the courses may not be a good fit for everyone, but the material available makes this a valuable learning option.**Books**: Many people love self-directed learning using books. It's quite economical and provides ready reference material after the initial learning phase. Although you can order and access books through online services like[Safari](https://www.safaribooksonline.com)and[Amazon](https://amazon.com), don't forget to check your local public library as well.

## Support network

Whichever learning resources you choose, the process will be more successful with a support network. Sharing your experiences and challenges with others can help keep you motivated, while providing a safe place to ask questions that you might not feel confident enough to ask elsewhere yet. Many towns have local user groups that gather to discuss and learn about software technologies. Often you can find these listed at [Meetup.com](https://www.meetup.com). Special interest groups, such as [Women Who Code](https://www.womenwhocode.com) and [Code2040](http://www.code2040.org), frequently hold meetings and hackathons in most urban areas and are a great way to meet and build a support network while you're learning. Some software conferences host "hack days" where you can meet experienced software developers and get help with concepts on which you're stuck. For instance, every year [PyCon](https://us.pycon.org/) features several days of the conference for people to gather and work together. Some projects, such as [BeeWare](http://pybee.org), use these sprint days to assist new programmers to learn and contribute to the project.

Your support network doesn't have to come from a formal meetup. A small study group can be as effective at keeping you motivated to stay with your learning program and can be as easy to form as posting an invitation on your favorite social network. This is particularly useful if you live in an area that doesn't currently have a large community of software developers to support several meetups and user groups.

## Steps for getting started

In summary, to give yourself the best chance of success should you decide to learn to program, follow these steps:

- Gather your list of requirements/needs and resources
- Research the options available to you in your area
- Discard the options that do not meet your requirements and resources
- Select the option(s) that best suit your requirements, resources, and learning style
- Find a support network

Remember, though: Your learning process will never be complete. The software industry moves quickly, with new technologies and advances popping up nearly every day. Once you learn to program, you must commit to spending time to learn about these new advances. You cannot rely on your job to provide you this training. Only you are responsible for your own career development, so if you wish to stay up-to-date and employable, you must stay abreast of the latest technologies in the industry.

Good luck!

## 1 Comment