如何成为一名开源程序员
程序员 开源
科技世界的探索总是让我们兴奋不已。很多科技日新月异，你探索得越深远，你看到的世界就越广阔无穷，这就像是[一只驼一只的海龟](https://en.wikipedia.org/wiki/Turtles_all_the_way_down)一样。因此，科技世界也像宇宙一样无穷无尽。如果你也渴望加入到推动技术世界发展的社区中，你应该如何开始呢？你要做的第一步是什么？以后应该怎么做？


![](/data/attachment/album/201702/20/000846wjgt4t9tteigvd4j.jpg)


首先，你得明白开源指的是开放软件源代码的意思。这个很好理解，但是“开源”这个词最近一段时间经常出现在我们身边，所以估计有时候大家都忘记了开源只是用来形容一种文化现象，而不是一家世界 500 强公司的名字。跟其它公司或组织不同的是，你不用去参加面试或填个申请表、注册表的方式来成为一名开源程序员。你需要做的就是**编程**，然后把代码共享出来，并且完全保证在任何情况下该代码都保持开放状态。


只需要这样，你就已经成为一名开源程序员了！


现在你有了目标，那么你为之奋斗的基础能力怎么样了？


### 技能树


你玩过 RPG 游戏吗？在那些游戏中就有关于线性“技能树”的概念。当你玩游戏时，你掌握了基本技能后，便会“升级”，并且获得新的技能，然后你使用这些新的技能再次“升级”到一个更高的等级，你又会得到更多新的技能。通过这样不断的升级，获取新技能，以让你的游戏角色变得更强大。


成为一个程序员有点像提升你的技能树等级。你掌握了一些基础的技术，在参与开源项目开发的过程中，你不断实践，直至自己的技术等级上升到一个新的层次，之后你又懂了一些新的技术，并在项目开发过程中不断实践，不断提升技术等级，然后你再沿着这个技能树不断成长，不断进步。


你会发现自己面临的不只一棵技能树。开源软件涉及到的技术比较多，包括很多参与者自身的优势、能力及兴趣爱好等。然而，有一些非常重要的技能有助于你成为一名伟大的程序员，不断的提高这些技能是成功参与到开源项目中的重要组成部分。


### 脚本编程


![](/data/attachment/album/201702/20/000908f7whdh6dbifwub1z.png)


对于像 Linux 或 BSD 系统这样的 POSIX 系统而言，最大的优势之一就是在你每次使用电脑的过程中，你都有机会练习编程。如果你不知道如何开始编程，你可以从解决工作中的一些基本问题做起。想想你日常工作中有哪些重复性的工作，你可以通过编写脚本的方式来让它们自动执行。这一步非常简单，比如说批量转换文件格式或重置图片的大小、检查邮件，甚至是通过单击运行你最常用的五个应用程序。无论是什么任务，你可以花一些时间去编写脚本以让它们自动完成。


如果有些工作需要在控制终端下操作，那么你就可以编写脚本来完成。学习 bash 或 tsch 编程，把编写系统脚本作为你写代码和理解系统的工作原理的第一步。


### 系统管理


![](/data/attachment/album/201702/20/000908vjub44bwjqtnpbpu.png)


从这一点来讲，你也可以转变成一个程序员，也可以整个跳到另外一个不同的技能树上：那就是系统管理工作。跟程序员比起来，这两个职业在技能上有一些相似（一个优秀的系统管理员应该有一些编程经验，并能够熟练使用 Python、Perl，或者其它类似的编程言语来解决一些独特的问题），而*程序员*指的是那些一直编写代码的人。


### 程序员


![](/data/attachment/album/201702/20/000908rospov9r31yf3f8o.png)


开源是学习编程技巧最好的方式：你可以查看其他人写的代码，从中借鉴他们的想法和技术，从他们的错误中学习，并跟自己写的代码进行对比以发现两者的优缺点；如果你是使用 Linux 或 BSD 操作系统，**整个**环境对你来说都是开放的，目之所及，随心所欲。


这就像旅游指南里所说的，随意行去。事实上你不大会去深入到一个项目的源代码中，但是如果这样的话，可以让你在某一时刻突然意识到自己会编程了。编程是一份很难的技术活，否则大家都可以从事编程工作了。


幸运的是，编程是有逻辑而结构化的，这些特性跟编程语言相关。你也许不会深入的去研究编程，但是你研究得越深，你懂的越多。


懂得如何控制以及让电脑自动执行任务是一回事，但是知道如何编写其它人想自动实现任务的代码，才能说明你已经真正进入到编程领域了。


### 精通多种编程语言


![](/data/attachment/album/201702/20/000909dv81h5xh5nncs99c.png)


所有的编程语言都旨在处理相同的任务：让计算机能够完成计算工作。选择一种编程语言时你得考虑以下几个因素，学编程的目的是什么，你所做的工作最常用的编程语言是什么，你最容易理解哪一种编程语言以及你的学习方式。


随便查下相关资料，你就可以了解编程语言的复杂性了，然后再根据自己的能力水平来决定先学习哪种编程语言。


选择编程语言的另一个方式是根据你的使用目的来决定，看看你身边的同事使用哪种编程语言。如果你是为了开发桌面环境的工具，你应该学习 C 语言和 Vala 语言，或者 C++ 语言。


总之，不要在各种编程语言之间不知所措。编程语言之间都是相通的。当你学好一种编程语言并能用它来解决工作中的一些实际问题的时候，你会发现学习另外一种编程语言更容易。毕竟，编程语言只是一些语法和相关规则的集合；学会一种编程语言后，再使用同样的方法去搞懂另外一种语言完全不是个事。


主要目的还是学会一种编程语言。选择一个比较适合自己或者你感兴趣的编程语言，或者是你的朋友在用的编程语言，或者是选择文档比较丰富，并且你理解起来也容易的编程语言，但是，最好是只关注并先学会其中的一种编程语言。


### 这是一个开源项目吗？


无论你是编程新手还是一个老司机，在你进入到开源新世界之前，你需要搞明白做开源软件的重要一点就是“开放源代码”。


最近一些厂商惯用的市场营销策略就是宣称他们的软件是开源的。然而，有些厂商只是发布了一个公共的 API 或者表示他们愿意接受其它开源用户提交的代码而已。“开源”这个词不是一个商标，并且也没有任何组织来决定怎么使用这个词。但是， Debian Linux 创造人 Ian Murdock 联合成立的<ruby> <a href="http://opensource.org/">  开放源代码促进会 </a> <rp>  （ </rp> <rt>  Open Source Initiative </rt> <rp>  ） </rp></ruby>对开源这个词进行了[定义](https://opensource.org/licenses)（授权“允许软件被用户自由地使用、随意修改及分享”），并且被正式批准和[授予](https://opensource.org/licenses/category)许可证的软件才属于真正的开源软件。


给你的软件代码应用一个开源许可证，你就成为一名开源程序员了。恭喜你！


### 开源社区


![](/data/attachment/album/201702/20/000909x23c6wp8skwmbkwm.png)


咨询任何开源软件爱好者，他们会告诉你开源软件最关键的是人。没有积极的开源贡献者，软件开发就会中止。计算机需要用户、提交缺陷的人、设计师及程序员。


如果你想加入全球开源社区为开源软件做贡献，你同样需要成为该社区的一个成员，即使你并不善于社交也不要紧。这通常包括订阅邮件列表、加入 IRC 频道，或者在论坛里表现活跃，从最低级别开始。任何成熟的开源社区都已经存在了足够长的时间，见惯了来来往往的人们，所以，在你真正融入这个世界、在他们接纳你之前，你需要证明出你并非流星一逝般的过客，如果你想要做成一件大事，那就得有长期投身于其中的打算。


如果你只是想给他们提供一些小的帮助，这也是可以接受的。我自己也提交一些小的补丁到一些项目中，有时候项目管理者会觉得这个更新比较好，有时候他们也会拒绝我提交的代码补丁。但是，如果这个被拒绝的补丁对我很重要，我就会为我自己和客户维护它，并一直维护下去。


这就是参与到开源项目。


但是这些社区在哪里呢？这个跟开源项目有关。有些项目有专职的社区管理员，他们会把所有的社区参与者招集到一个打大家都能访问的地方。有些项目则围绕论坛运行，他们使用邮件列表，或者使用问题追踪器与参与者联系。找到这些开源社区对你来说也不是个事儿。


还有个重要的事情就是研究他们的源代码。“开源”就是开放“源代码”，所以你可以把他们的代码拿来瞅瞅。尽管要全面了解他们的项目可能超乎你的能力，但是你可以知道这个项目是如何管理的，他们最可能需要帮助的是什么。关于代码是如何组织的？这些代码有注释吗？它们使用统一的程序风格吗？这些问题你可以查阅相关文档，尤其是 README、 LICENSE ，或者是 COPYING 这几个文件。


不要低估遵守开放源代码承诺的重要性。这是你被允许参与进来到开源项目来的原因，因此，你得深入地考虑下你能从中学习到什么，以及你将如何为该项目提供帮助。


找到最佳的开源社区更像是约妹子，尤其是更像在[《偷天情缘》](https://en.wikipedia.org/wiki/Groundhog_Day_(film))里的约会。这需要时间，并且刚开始那几次有可能会失败。你参与这样的聚会越多，你就越了解这些开源项目。最后，你会更了解自己，当你找到了与其它参与者融为一体的方式时，你就已经成功了。总之，你得要有耐心，一切顺其自然。


### 行动比语言更重要


![](/data/attachment/album/201702/20/000910ui0fmfwaimf9fw81.png)


作为一名开源程序员最重要的是写代码（开源中的“源”），任何想法都没多少意义。关键是把你的想法变成实际的东西。你要让大家都知道你在做什么、知道你不怕苦不怕累，也愿意在开源项目上花时间，并且能够通过编程的方式来实现自己的各种想法。


为了更高效地完成那些工作，你需要对开源项目做做功课，包括项目怎么样才能听取你的建议、哪个分支是稳定的哪个是开发的等等。


从下面几点开始：


* 熟悉一个项目及其协作开发的氛围，并且接受这种氛围。
* 编写软件升级包、缺陷修复包，或者一些小的功能需求，并且提交它们。
* 如果你提交的补丁被拒绝了，也不要难过。他们拒绝的不是你个人，而是开发小组在针对你提交的代码进行评估后作出的一个反馈。
* 如果你提交的代码被改得面目全非后才被接受也不要泄气。
* 从头再来，不断努力，再接受更大的挑战。


在开源项目中不应该开设排行榜。然而，有些开源社区却弄了个贡献排名，其实这没必要。大家只需要积极参与、奉献，贡献你的才智、提交你的代码，这样就可以了。


### 开发软件


![](/data/attachment/album/201702/20/000910qwf5k4yy2lefl99l.png)


编程不管在那种情况下都关乎于你自身的发展。无论你是否为了寻找解决问题的新方法，寻找优化代码的方式，学习新的编程语言，或者是学习如何更好的与其它人员合作，你都不会停止成长。你自己成长得越多，对开源项目越有帮助。


个人成长和职业技能的提升是你参与开源项目的终极目标，但是实际上这是一个贯穿整个项目的持续过程。成为一个开源程序员跟得到一份公务员工作不同；这是一个持之以恒的过程。学习、分享、再学习，或许你会去编写一个[“康威生命游戏”](https://en.wikipedia.org/wiki/Conway's_Game_of_Life)，然后你会学到越来越多。


这就是开源的过程：自由地开发，每一行代码。因此，发现你的技能树，激发潜能，付出努力，不断提高自己的技能，并最终参与其中。


（题图素材修改自：[woot.com](http://shirt.woot.com/derby/entry/78479/turtles-all-the-way-down)）




---


作者简介：


Seth Kenlon —— Seth Kenlon 是一位独立多媒体艺术家，开源文化倡导者， Unix 极客。他还是 Slackware 多媒体产品项目的维护人员之一，官网：<http://slackermedia.ml> 。




---


via: <https://opensource.com/article/17/1/how-get-started-open-source-programmer>


作者：[Seth Kenlon](https://opensource.com/users/seth) 译者：[rusking](https://github.com/rusking) 校对：[Bestony](https://github.com/Bestony), [wxy](https://github.com/wxy)


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


OK
Looking out at the world of technology is exciting. It has a lot of moving parts, and it seems the further you dig into it, the deeper it gets, and then it's [turtles all the way down](https://en.wikipedia.org/wiki/Turtles_all_the_way_down). For that very reason, technology is also overwhelming. Where do you start if you're keen to join in and help shape the way the modern world functions? What's the first step? What's the twentieth step?

The first thing to understand is that open source is open. This might seem obvious, but the phrase "open source" is thrown around so often these days that sometimes people forget it's just a description of a cultural phenomenon, not the name of a Fortune 500 company. Unlike other jobs or groups, you don't have to interview or complete a sign-up sheet or registration form to become an open source programmer. All you do to become an open source programmer is *program* and then share your code, ideally with a guarantee that the code remains open regardless of how it's used.

That's it. You're an open source programmer!

You now have your destination, but what about the logistics?

## Skill trees

Have you ever played an RPG? In these games, there's the concept of linear "skill trees". When you play, you acquire basic skills that you build upon to "level up" and get new skills, which you use to acquire new ones and "level up" again. And so on.

Becoming a programmer is a little like adding to your skill tree. You get some basic skills, you practice them until they're second nature, and then you get new skills, and so on, and then you are progressing along your chosen skill tree.

You'll find you'll encounter more than one skill tree. Open source has many entry points and many individuals with their own unique strengths, talents, and interests. However, certain definable skills contribute to being a great programmer, and developing them is an important part of participating successfully in open source projects.

## Scripting

One of the biggest advantages of a POSIX system like Linux or BSD is that every time you use your computer, you've got the opportunity to practice a little programming. If you have no idea where to start programming, then begin with how you work. Find repetitive tasks that you perform every day, and start automating them. This step can be something simple, like converting or re-sizing batches of photos, checking email, or even just getting the five applications you use each day launched with one click. Whatever the task, take the time to automate something for yourself.

If you can do something from a terminal, then it can be scripted. Learn `bash`

or `tsch`

and let system scripting be your introduction to writing code and to how your system works.

## Sysadmin

From this point, you can continue on to become a programmer, or you can cross over to a different skill tree entirely: that of systems administration. The two careers have some overlap (a good sysadmin ought to have a little programming experience, and should be ready to wield Python, Perl, or a similar language to develop unique solutions), but a *programmer* is someone who builds with code day in and day out.

## Programmer

Open source is a great way to learn programming skills; you get to look at other people's code, borrow ideas and techniques, learn from their mistakes, get a critique of your own code, and if you use Linux or BSD, the *entire* stack is open to you—as far as the eye can see, it's all yours for the taking.

That's what the travel brochure says, anyway. The reality is that you're probably not going to start digging into the source code of a project and come out the other side with the sudden realization that you accidentally learned to code. Programming is hard work. If it wasn't, everyone would do it.

Luckily, programming is logical and structured, so it builds upon itself. You might not fall into programming, but the more you poke at it, the more you start to understand it.

Understanding how to control and automate a computer is one thing, but knowing how to write the stuff that other people want to automate is the point that you cross over into the realm of *programming*.

## Polyglot

All programming languages aim to do the same thing: make computers compute. Choosing one is a mix of what you think you want to do, what (if any) language is in common use in the industry you are targeting, and what language you happen to best understand given the materials available to you and your learning style.

With a little bit of research, you can get a good idea of a language's complexity, and then decide what to try first based on your own level of comfort.

Another way to choose a language is to look at your goal, find out if other people are working toward the same thing, and then look at what they're using. If your aim is to develop desktop tools, you might learn C and Vala for one, or C++ for another.

At the end of the day, though, don't get overwhelmed with all the available choices. Languages stack well. Once you learn one programming language well enough to fall back on it when you need to get something done, you'll find it a lot easier to pick up another one. A "language" is just a set of syntax and rules, after all; learn one, and it's fairly trivial to superimpose new rules over the same theory.

The primary goal is to learn a language. Pick the one that makes sense to you or the one that's most appealing to you or the one that your friends are using or the one that has the documentation you understand best, but focus on one and learn it.

## Open Whazzit?

Whether or not you're just learning to program or you're an old pro just getting into open source, before jumping head first into this brave new world, you need to learn what makes open source, well, "open source."

Claiming software is open source is the latest marketing approach some software vendors are wielding. Unfortunately, some vendors just mean they've released a public API or that they're receptive ("open") to suggestions from their users. The word "open" isn't trademarked and no committee governs how or when the word is used. However, the [Open Source Initiative](http://opensource.org/), co-founded by the late Ian Murdock of Debian Linux, [defines](https://opensource.org/licenses) what open source means (licenses that "allow software to be freely used, modified, and shared"), and formally approves and [tracks](https://opensource.org/licenses/category) licenses deemed truly "open."

Apply one of those licenses to your code, and you're an open source programmer. Congratulations!

## Community

Ask any open source enthusiast and they'll tell you the most important thing about open software is the people. Without motivated contributors, software stagnates. Computers need users, bug reporters, designers, and programmers.

If you want to join or cultivate the global open source community, you need to become a part of the community, even if you're not a people person. This usually encompasses subscribing to mailing lists, joining IRC channels, or hopping onto forums, and starting at the bottom of the totem pole. Any mature community has been around long enough to see prospective members come and go, so you have to understand that when you saunter in ready to change their world, before they all agree to your master plan, you have to prove that you're not going to disappear after three months when something sparkly on the other side of the Net catches your eye. Be ready for the long haul if you aspire to something big.

If you're just around to lend a hand, then that's acceptable, too. I myself have submitted small patches to projects, and sometimes the project leads think these are good and other times they reject them. If the rejected patch is important to me, I maintain it for myself and clients, and otherwise I move forward.

It's part of the process.

Where do these communities exist? It depends on the project. Some projects have dedicated community managers who help bring everyone together in public spaces for everyone to see. Other projects form around forums, use mailing lists, or even issue trackers. Look for the communities, and you'll find them.

Just as importantly, though, look at the code! They call it open "source" for a reason, so be sure to find the code and take a peek. Even if it's still above your level of full comprehension, it gives you an idea of how the software project organizes itself and possibly where they might need assistance. How is the code organized? Does the code have comments? Is it tidy with a consistent style? Review the documentation, particularly the README, LICENSE, or COPYING files.

Don't under estimate the importance of following through on the promise of open code. It's the reason you're getting involved, so look at it critically from every angle to see what you can learn from it and how you might contribute.

Finding the best community is a lot like dating, but specifically it's like dating in [Groundhog Day](https://en.wikipedia.org/wiki/Groundhog_Day_(film)). It takes time, and the first couple of tries might fall flat. The more you go through the process, the more you start to feel déjà vu. Eventually, though, you learn enough about yourself and your interests, you find the right combination of other people, and you settle in somewhere. Have patience, and let it happen naturally.

## Actions > Words

Being an open source programmer is about the code (the "source" part of open source), and ideas are a dime a dozen. What speaks volumes is producing. You need to show you know what you're doing, willing to get your hands dirty, spend your time on the project, and can back up your ideas with something that compiles.

To do that effectively, of course, you should do your homework on the project itself, including learning how a project prefers to receive submissions and which branches are the stable and development ones.

To approach getting started:

- Get familiar with a project and its development culture, and be respectful of it.
- Write patches, bug fixes, or small, requested features, and submit them.
- Don't get discouraged if your work is rejected. You are not being rejected personally, your work was evaluated and the development team made a call.
- Don't get discouraged if your work is accepted, but changed beyond recognition.
- Rinse, repeat, and try new and bigger changes.

There is no leaderboard in open source. Some sites try to make it seem like they have such a thing, but there isn't one. Participate, contribute, add to the pool of ideas, add to the stash of commits, and you're doing it right.

## Develop

Programming in any environment is always, ultimately, about personal development. Whether you're searching for new ways of solving problems, looking for new ways to optimize code, learning a new language, or learning how to deal with other people better, you never want to stop growing. The more you develop yourself, the more a project benefits.

Growth, both personal and professional, is the final one on the list, but it actually persists through the entire process. Becoming an open source programmer isn't like getting a government job; it's a process. You learn, you share, you keep learning, you get distracted and write a [Game of Life](https://en.wikipedia.org/wiki/Conway's_Game_of_Life) implementation, and you learn some more.

This process is what open source is about: the freedom to develop, in every sense of the word. So go find your skill tree, choose your super powers, pay your dues, level up, and get involved.

## 8 Comments