程序编写经验教训_编写38本编程书籍的经验教训

程序编写经验教训

重点 (Top highlight)

Unless you’ve spent a couple of decades coding, you may not remember the days when some of the most important information about frameworks, APIs, and even programming languages was as scarce as semicolons in a .py file. But there was a time when programming information was so valuable that well-worn books (like Petzold’s Programming Windows) were passed around the office from cubicle to cubicle. Sometimes they went missing.

ünless你已经花了几十年的编码,你可能不记得,当时一些关于框架,API和甚至编程语言最重要的信息是稀缺如在.py文件分号。 但是,曾经有一段时间,编程信息如此宝贵,以至于陈旧的书籍(如Petzold的《 Programming Windows》 )在办公室之间从一个小房间传到另一个小房间。 有时他们失踪了。

Books were a particularly valuable source of information about new technology. In 2001, the year before I wrote my first book, one of the most sought-after computer books was a comprehensive guide to the beta version of a new framework. (That was ASP.NET 1.0, still called ASP+ at the time.) That’s how valuable insider information could be. Software companies recognized that books and magazines were a priceless conduit to their developer audience — a fact I realized when I toured the Microsoft campus during their Book Publishing Partners Summit, an intimate gathering with PMs and developers that was far more illuminating than the much bigger MVP conference the following year.

书籍是有关新技术的特别有价值的信息来源。 2001年,也就是我写第一本书的前一年,最受欢迎的计算机书籍之一是有关新框架Beta版的综合指南。 (那是ASP.NET 1.0,当时仍称为ASP +。)这就是内部信息的价值所在。 软件公司认识到书籍和杂志是他们开发人员受众的无价之宝–当我在其书籍出版合作伙伴峰会上参观微软园区时,我意识到这一事实,这是与PM和开发人员的亲密聚会,远比规模更大的MVP更具启发性次年的会议。

The world has come a long way since then. Today, there is no more Publishing Summit, and the information about programming that’s available online — from free books to live playgrounds, video courses, and even chatty Twitch streams — is nothing short of incredible. For new coders, the barriers to entry have come crashing down, and there’s no perspective where that’s a bad thing.

自那时以来,世界已经走了很长一段路。 今天,不再有出版峰会,而且在线提供的有关编程的信息-从免费书籍到现场游乐场,视频课程,甚至是闲聊的Twitch视频流 -简直令人难以置信。 对于新编码人员而言,进入的障碍已经崩溃,并且没有观点认为这是一件坏事。

Someday I may write a post about the business of book writing, then and now. But this article is about something different — it’s about what I learned while writing the thousands of pages I left behind. Here are four lessons that still stick with me today.

有朝一日,我可能会写一篇关于书籍写作业务的文章。 但是这篇文章是与众不同的-它是在写留下的数千页时学到的。 今天有四节课仍然留给我。

1.好老师比好学生学得更多 (1. Good teachers learn more than good students)

I’ve taught programming in print and in a classroom setting, and the experience has flipped my perspective around almost completely. I once thought that experts become authors. I now know that authors become experts.

我曾在印刷厂和教室里教过编程,而这种经历使我的观点几乎完全改变了。 我曾经以为专家成为作者。 我现在知道作者成为专家。

There are a variety of reasons this transformation happens, but here are a few:

发生这种转换的原因多种多样,但有以下几种:

  • To teach something properly — be able to answer every question and contextualize every design practice — you need to understand it thoroughly. I explored the bits of tech that I wrote about far more than the ones I used just to code an application.

    要正确地教授某些东西(能够回答每个问题并根据每种设计实践进行情境介绍),您需要彻底理解它。 与仅用于编写应用程序的技术相比,我所探究的技术远不止于此。
  • Formalizing your opinion forces you to clarify it. As we become experienced programmers, we develop a sense for where dangers lie and caveats apply. You hone a valuable instinct. But until you are called on to explain your opinions, you haven’t tested your assumptions.

    正式化您的意见会迫使您加以澄清。 随着我们成为经验丰富的程序员,我们逐渐意识到存在危险和需要注意的地方。 您磨练了宝贵的本能。 但是直到您被要求解释您的观点之前,您还没有检验过您的假设。
  • You can learn a lot from new people grappling with an old problem. Yes, I spent hours refining explanations and demonstrations for the most commonly asked questions. After a while, you can anticipate them. But even a novice programmer can ask a question that invites you to think more deeply about something you’ve always breezed past.

    您可以从新手解决旧问题中学到很多东西。 是的,我花了几个小时来完善常见问题的解释和演示。 一段时间后,您可以预期它们。 但是,即使是新手程序员也可以提出一个问题,邀请您更深入地思考您一直以来的微妙事物。
Image for post

You don’t need to be a book author or an instructor in a classroom to learn from teaching. You can learn plenty from explaining concepts to a junior programmer, pair programming, giving a workshop at a conference, or even answering questions on a message board. The basic principle remains — you learn more than you expect when you force yourself to share your knowledge.

您无需成为书籍作者或课堂讲师即可从教学中学习。 从向初级程序员讲解概念,结对编程,在会议上举行研讨会,甚至在留言板上回答问题,您可以学到很多东西。 基本原则仍然存在–当您强迫自己分享知识时,您将学到比预期更多的知识。

If you want to learn something more deeply, commit to teaching it.

如果您想更深入地学习一些东西,请致力于教授它。

2.故事塑造了我们的编码方式 (2. Stories shape how we code)

Maybe you don’t call them stories. Maybe you call them “mental models.” But either way, there’s a lot more to digesting programming concepts than following a paint-by-numbers set of instructions.

也许您不称他们为故事。 也许您称它们为“心理模型”。 但是,无论哪种方式,要消化编程概念都比遵循按数字涂漆的指令集要多得多。

A good story shows how different concepts tie together. It outlines the boundaries between different types of problems. It shows how different technologies interact, compliment, or compete with each other. And it puts exciting new features in the context of real application problems.

一个好的故事说明了不同的概念是如何联系在一起的。 它概述了不同类型问题之间的界限。 它显示了不同的技术如何相互作用,相互补充或竞争。 并且它在实际应用程序问题的背景下提供了令人兴奋的新功能。

Here’s an example. As a JavaScript beginner, you’ll understand the limits of client-side programming better once you know how browsers and web servers exchange messages. Without that perspective, all the var/let/const tutorials in the world won’t give you the insight you need. As a JavaScript expert, you’ll understand the role of WebAssembly better if you’ve followed the history of transpiling and the early experiments of asm.js. And so it goes, from threading to cloud computing to artificial intelligence. In most cases, knowing how to do something is easy. The art of programming is deciding when you should.

这是一个例子。 作为JavaScript的初学者,一旦您知道浏览器和Web服务器如何交换消息 ,就会更好地了解客户端编程的局限性。 没有这种观点,世界上所有的var / let / const教程都不会为您提供所需的见识。 作为JavaScript专家,如果您了解转码的历史和asm.js的早期实验 ,您将更好地了解WebAssembly的作用。 从线程到云计算再到人工智能,它是如此。 在大多数情况下, 怎么样 做某事很容易。 编程的技巧决定了何时应该使用。

Good stories are helpful, but bad stories aren’t indifferent. They’re actively harmful. Bad mental models hide reality or encourage risky habits. ASP.NET Web Forms, a massive popular technology, withered away because its story (pretending a server-side web page is a stateful desktop application) didn’t hold up.

好的故事是有帮助的,但是坏的故事却毫不动摇。 它们积极有害 。 不良的心理模型会掩盖现实或鼓励冒险的习惯。 ASP.NET Web Forms是一种流行的流行技术,因为它的故事(假装服务器端网页是一个有状态的桌面应用程序)而停滞不前,因此逐渐枯萎

The bottom line is this — if you’re teaching programming, you’re telling stories, and you have a responsibility to tell ones that are sound. Here are some lazy stories that crop up too often in books, documentation, and courses:

最重要的是-如果您正在教编程,那么您在讲故事,并且您有责任讲一些声音。 以下是一些在书本,文档和课程中经常出现的懒惰故事:

  • The Code-It-All-Yourself Example. This is where you learn about a new API by seeing a technically impressive but wildly impractical example. Often, it involves reinventing the wheel — for example, making a version of something that’s already in your class library. Roll-your-own encryption is a typical (and very pervasive) bad example.

    自己编写代码示例。 在这里,您将看到一个技术上令人印象深刻但不切实际的示例,从而了解新的API。 通常,它涉及重新发明轮子-例如,制作类库中已有内容的版本。 自行拥有的加密是一个典型的(并且非常普遍)的坏例子。

Image for post
Some crimes can never be forgiven
有些罪行永远无法原谅
  • The Paint-By-Numbers Lesson. Do this. Do that. Then do that. It’s easy to fall into this teaching trap, because beginners need some hand holding. But learning a recipe will always pale compared to learning how to cook, and you can’t be an effective developer until you understand the capabilities and limits of the ingredients at your fingertips.

    按数字上课。 做这个。 去做。 然后做。 容易陷入这种教学陷阱中,因为初学者需要一些帮助。 但是,与学习烹饪方法相比,学习食谱始终显得苍白无力,只有当您了解指尖的功能和局限性之后,您才能成为有效的开发人员。

  • The Greatest New Tech Ever. This is the story that many marketing departments graft onto a product after it’s finished. The problem is that this story obscures the truth about where a technology fits into the developer ecosystem. To figure that out, you need to know its assets and its pain points. In the quickly yellowing pages of the books I’ve written, my proudest moments were when I steered readers away from flash-in-the-pan promises or me-too technologies that had obvious flaws.

    有史以来最伟大的新技术。 这是许多市场部门在产品完成后将其嫁接到这个故事的故事。 问题在于,这个故事掩盖了技术在开发人员生态系统中的适用范围的真相。 为了弄清楚这一点,您需要了解其资产痛点。 在我写的书Swift泛黄的页面中,我最感到骄傲的时刻是当我引导读者远离泛滥成灾的承诺或具有明显缺陷的“我也一样”的技术时。

Exposing a flaw is always more useful that explaining a feature.

暴露缺陷总是比解释功能总是有用的。

Image for post
A familiar story
一个熟悉的故事

3.采用胜过技术实力 (3. Adoption trumps technical awesomeness)

This lesson was painful to learn. Poor products will inevitably die. But good ones don’t always win. And sometimes promising technologies will fade away and tempting paths will descend into a wasteland.

这节课很难学。 劣质产品将不可避免地死亡。 但是好人并不总是赢。 有时,有前途的技术会逐渐消失,诱人的道路会沦为荒地。

Most of my books have dealt with the Microsoft programming stack, and Microsoft has cast off plenty of old technologies. Some were bad (like SharePoint Access Services), but most just ran the wrong way against the broader evolution of modern development (say, WPF). You’ve probably never heard of the long-since abandoned Intel P2P kit, but I have. Years ago, I wrote about a book about peer-to-peer programming, and I was overly optimistic that the Intel P2P kit would evolve into a reliable tool that .NET developers could use to traverse firewalls. Instead, it was a successful proof of concept that soon sank without a trace.

我的大部分书籍都涉及Microsoft编程堆栈,并且Microsoft淘汰了许多旧技术。 有些是不好的(例如SharePoint Access Services),但大多数只是对现代开发的更广泛发展(例如WPF)使用了错误的方式。 您可能从未听说过长期废弃的英特尔P2P套件,但是我知道。 几年前,我写了一本关于对等编程的书,我对Intel P2P套件将发展成为.NET开发人员可以用来穿越防火墙的可靠工具感到非常乐观。 相反,这是一个成功的概念证明,很快就无影无踪。

Other examples include open source toolkits that just didn’t have enough community support to keep them going or papered over deeper problems, like the ASP.NET AJAX Control Toolkit and the WPF Community Toolkit. The latest technology to join this neglected family is onetime popularity star Visual Basic, whose relevance is dwindling as it loses its place in the .NET world. (There’s nothing wrong with writing a VB application today, but why would you? You’ve got better tooling support, better documentation, and a larger talent pool to hire from if you stick with C#.)

其他示例包括开放源代码工具箱,它们只是没有足够的社区支持而无法继续前进或解决更深层次的问题,例如ASP.NET AJAX控制工具箱和WPF社区工具箱。 加入这个被忽视的家庭的最新技术是曾经流行的明星Visual Basic,随着它在.NET世界中的地位下降,其相关性正在下降。 (今天编写VB应用程序并没有错,但是为什么呢?如果您坚持使用C#,您将获得更好的工具支持,更好的文档以及更丰富的人才库。)

In the end, it doesn’t matter how good a technology is if it can’t win community support. As a teacher or a developer evangelist, you always need to look your gift horses in the mouth.

最后,如果技术不能赢得社区支持,那么技术的好坏并不重要。 作为老师或开发人员的传播者,您总是需要在嘴里望马。

Image for post
Sometimes you need to look a gift horse in the mouth
有时候你需要在嘴里看一匹礼物马

Without active, continuing development, even the shiniest new product will shrivel into irrelevance.

没有积极,持续的开发,即使是最闪亮的新产品也将变得无关紧要。

4.赌自己永远不会错 (4. It’s never wrong to bet on yourself)

Odds are that most of the people reading this article don’t have secret dreams of publishing a 1,000 page hardcover programming reference (in color!). But chances are that you have your own passion project or off-the-beaten path idea, and odds are good that you’re letting it languish. The hardest challenge I’ve ever faced hasn’t been grokking new toolkits or solving mysterious crashes in pre-alpha builds of new frameworks with no documentation. The hardest challenges have been committing to interesting projects even when I didn’t know who would use them and what shape the end result would take. In the end, my most successful books were often the ugly ducklings — topics I pursued on a whim, because I thought they were interesting, useful, or fun. Usually, I expected them to fail.

奇怪的是,大多数阅读本文的人没有实现发布1000页精装编程参考(彩色!)的秘密梦想。 但是,您很有可能会拥有自己的激情项目或不为人知的想法,而让它陷入困境的可能性很大。 我从未遇到过的最艰巨的挑战不是在没有文档的情况下使用新工具包解决新框架的pre-alpha版本中的崩溃问题。 即使我不知道谁会使用它们以及最终结果将采用何种形状,最困难的挑战仍然是致力于有趣的项目。 最后,我最成功的书通常是丑小鸭-我一时兴起追求的主题,因为我认为它们很有趣,有用或有趣。 通常,我希望他们失败。

So while we all need to survive and there’s nothing wrong with steady paychecks and a stable job, don’t miss the chance to contribute your own unique product to the world. If you have a passion project, make a plan to allocate some regular sliver of your time to it — now!

因此,尽管我们都需要生存,并且稳定的薪水和稳定的工作没有错,但不要错过为世界贡献自己独特的产品的机会。 如果您有一个充满激情的项目,请制定一个计划,将您的时间分配给它—现在就开始吧!

Image for post

Although the tech publishing world won’t ever be the same, I still write the occasional, much less profitable book. Right now I’m working on a quirky free guide for kids learning JavaScript. To get a copy when it releases, sign up to the Young Coder newsletter.

尽管技术出版界将不再一样,但我仍然写偶尔写的,利润不高的书。 现在,我正在为学习JavaScript的孩子编写古怪的免费指南。 要获得发行时的副本,请签署Young Coder 新闻通讯

翻译自: https://medium.com/young-coder/lessons-learned-from-writing-38-programming-books-bd8d95631663

程序编写经验教训

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值