为了账号安全,请及时绑定邮箱和手机立即绑定

程序员哑巴英语修炼指南

标签:
职场生活

上大学的时候,学校东花园环境优美,四季都春意洋洋,每个星期的那个晚上,都会有英语角,据说草坪上三五成群、六八一圈地杵满了追求上进的好青年和美丽女学霸以及奇形怪状的外国友人。我没有去过,也不知道女学霸有多美。当时我还没觉得英语有多重要,也不知道自己将来会成为一名程序员,所以,英语,过了四级,就任它飘飞云霄了。

如果当时我能预料到将来自己会成为一名程序员,我发誓,一定要好好学习英语。然而往事已不可追,过去的未来也成了现在的过去,很多事情都无可挽回地被定格在旧时光里了。

啊,我没料到一上来就陷入了回忆和感慨,其实我是想来聊一聊:对于程序员来讲,英语应该好到什么程度,以及,如何修炼哑巴英语。

程序员的英语应该好到什么程度

因为我曾经写了两本关于Qt的书,《Qt on Android核心编程》和《Qt Quick核心编程》,就有朋友把我当英文API翻译来使唤,经常找我问Qt帮助里某段话是什么意思。这两者有什么关系吗?

你懂的,多数语言和技术框架都是老外搞出来的,老外就是牛,不承认不行。老外在创建一种语言和技术框架时,很少考虑中国读者的感受,所以他们提供的文档多数是英文的(不是源自英语系国家的语言和技术框架也多数会提供英文文档)。英文是IT界的世界通用语。所以,有人会说“Are you OK”,也有人会说“We're 伐木累”……

多数程序员其实不必“”英语,但必须得“英语和”英语。这没错吧,错了来找我,送你一瓶冰峰消消暑。人们把不能说的英语叫哑巴英语,虽然这不是什么褒义,但对于程序员来讲,好的哑巴英语足够应付生活里大多数情况。所以,我先要说的是:哑巴英语应该好到什么程度

其实这也很简单:

  1. 读得懂英文SDK

  2. 看得懂Stackoverflow上的帖子

  3. 能够用英文在Stackoverflow上提问和交流

  4. 可以和人用英文在邮件里讨论技术问题

你可以把上面的顺序当做是循序渐进的,看看你到哪一步了。一般滴,到第3种程度就可以在程序世界里谈笑风生挥斥方遒了。当然到了第3,第4就是咫尺之隔了。

提供几段英文文档,当场检测一下。首先是来自Qt的SDK文档的一段话,讲Model/View的,窃以为比较好懂。

Qt contains a set of item view classes that use a model/view architecture to manage the relationship between data and the way it is presented to the user. The separation of functionality introduced by this architecture gives developers greater flexibility to customize the presentation of items, and provides a standard model interface to allow a wide range of data sources to be used with existing item views. In this document, we give a brief introduction to the model/view paradigm, outline the concepts involved, and describe the architecture of the item view system. Each of the components in the architecture is explained, and examples are given that show how to use the classes provided.

然后是来自Node.js的在线文档里HTTP模块的API文档:

In order to support the full spectrum of possible HTTP applications, Node's HTTP API is very low-level. It deals with stream handling and message parsing only. It parses a message into headers and body but it does not parse the actual headers or the body.

Defined headers that allow multiple values are concatenated with a , character, except for the set-cookie and cookie headers which are represented as an array of values. Headers such as content-length which can only have a single value are parsed accordingly, and only a single value is represented on the parsed object.

The raw headers as they were received are retained in the rawHeaders property, which is an array of [key, value, key2, value2, ...]. For example, the previous message header object might have a rawHeaders list like the following:

这个和前面Qt的差不多,都是写得还不错的英文文档。再来看两个来自Stackoverflow上的问题。第一个,Have computer criminals been known to exploit easily-edited websites like Wikipedia to embed malicious scripts?(吐槽一下,这标题也忒长啦):

When I was reading a page on Wikipedia several months ago (December 2014) I saw what looked like a pop-up window from BT, but I soon realized that when I closed the page the pop-up disappeared. I then opened Firebug and inspected the box and saw that it was actually part of the webpage itself and that clicking its confirmation button would take me somewhere I didn't want to go. It was very cleverly disguised to look real.

I've never before seen anything like this. Is this the only case or has this been known to happen? I've provided a screenshot to show what it looked like:

下面是被采纳的答案

Assuming that you are coming from a BT connection, it's possible that this is part of the BT parental controls program.

There is a discussion of a similar looking pop-up here , which seems to tie into what you're seeing, and also a thread here on the BT site which has a link to a process to turn off that setting.

To test this theory you could log into your account and opt-out of parental controls. I wouldn't advice doing it from any link presented in the pop-up in case it is malicious though.

Once you've done that try accessing the same page to see if the issue re-occurs.

Another way to test it would be to access the site over HTTPS as then they shouldn't be able to inject any content unless they've installed a trusted root certificate in your browser, for which you would have needed to install BT software on the affected system.

As to your original questions about criminals injecting content into legitimate websites, this is a common vector of attack, either via compromise of the website (e.g. through exploitation of outdated software) or via content injected into the site such as adverts (this is common enough to have it's own wikipedia definition "malvertising")

As to whether it could happen to wikipedia, I'm not aware of that occuring and with wikipedia being such a well trafficked site, I'd expect it to be a large target.

这个帖子涉及的主题是一般性问题。第二个帖子是关于iOS image的,iOS - Different images based on device OR scaling the same image?……标题还是很长……内容如下:

It seems that developers always create different image assets for different devices and load them based on the device. But are there any drawbacks to just creating images for the largest resolution device (iPad) and then scaling that image down for iPhone 6, 5, etc?

I use SpriteKit, so I would just create SKSpriteNodes of different sizes and apply the same texture to them and scale it to fit the node.

I know that performance can be something to consider (loading large images for older devices). But that aside, is there anything else? Would these images appear more pixelated/blurry?

被采纳的答案在下面

The perfect/purist answer would be to use separate images and code for each device resolution.

However from your own time and sanity perspective, it makes sense to use a limited set given that the number of resolutions and screen sizes is not going to get less any time soon. So why waste hours preparing multiple images unless it can be made simpler to do so by the likes of xcode.

For images which are square or fixed aspect ratios I think you only need one image. There is the issue for images like backgrounds where regardless of resolution you will need to cater at least for different aspect rations: so separate aspect ratio images are essential (like 3:2 and 16:9) unless you don't mind squashing, stretching or cropping the images.

If you find performance suffers in testing, you can always add lower resolution images later.

In terms of pixelation, that is something you can not avoid. If you think about what is happening when you go from a x3 to an x1 resolution, you are having to blend 3x3 pixels into 1x1. At high resolution, anything which is a single pixel wide (like a line) or has rapid color change over a few pixels will suffer most. There are many articles online about this you can look at.

The only way to avoid pixelation would be to use vector images, but that would require special software to load vector images and render them into UIImages.

Every image will suffer differently when you scale down. A thought might be to go for x2 images which you scale down 1 for iPhone 3 and up 1 to x3 for iPhone 6+. That would cover the majority of current devices at native resolution and perhaps offer less noticeable pixelation.

当然这些帖子你都可以跟进去看看,看所有人的回复,看是否能懂。

再来看github上的AngularJS的readme:

AngularJS lets you write client-side web applications as if you had a smarter browser. It lets you use good old HTML (or HAML, Jade and friends!) as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. It automatically synchronizes data from your UI (view) with your JavaScript objects (model) through 2-way data binding. To help you structure your application better and make it easy to test, AngularJS teaches the browser how to do dependency injection and inversion of control.

Oh yeah and it helps with server-side communication, taming async callbacks with promises and deferreds. It also makes client-side navigation and deeplinking with hashbang urls or HTML5 pushState a piece of cake. Best of all?? It makes development fun!

哇哈哈哈哈,字数终于凑够了!接下来该说说怎么修炼哑巴英语了。

哑巴英语修炼秘笈

哑巴英语相对好练,你不必去找李阳,也不必去报学习班,更不用在大街上尾随老外求指教,只要按我说的秘笈修行就可以练好。

坚持看英文SDK

欲练神功,挥刀自宫。这是必须的,要先收起自己的老看中文文档的习惯,坚持看英文SDK,看不懂也要看,坚持自虐,必有所获。

比如要是你做Android开发,你就去看https://developer.android.com/index.html,这里有一切你要的美好。如果打不开,就买个VPN吧。或者参考我博客上的文章:离线使用Android开发者文档

比如你用Qt,就坚持看自带的帮助,比如你搞Node.js,也直接看英文的。

总之,当你需要了解什么技术和文档的时候,就先找官网,就先拿英文文档练自己,炼不死不罢休。游坦之资质平庸,照着几张图破图就修成了绝世神功,你根骨上乘,绝无失败之可能。

背单词

词汇量其实是很重要的一点,这是不得不承认的事实。这一事实让我沮丧,因为我的词汇量一直停留在初中水平……不过,也有助手,你可以用有道词典之类的软件帮助你,每天记一点,或者看不懂直接划词翻译。

手机上有很多背单词的App,碎片时间就可以练练,比如公交车上、等菜上桌、等车、陪女友逛街、蹲马桶等场景。

看英文书

有一些英文技术书籍写得简单易懂,比如《Head First Design Patterns》、《The C++ Standard Library(A Tutorial and Reference)》,我都是看的影印版,也能看个八九不离十。我建议有志于练习哑巴英语的阿猿和阿媛买几本影印版的书常翻常看,必然能很快提高水准。

我还买过几本英文小说,比如约翰·高尔斯华绥的《the Apple Tree》,艾捷尔·丽莲·伏尼契的《the Gadfly》,不过都是装B的,翻了几次也没看完。

我想说的是,作为程序员,要看完一本英文技术书,比看完一本英文小说简单多了。这是我的经验,信不信由你。

翻译技术文档

因为很多技术文档都是英文的,你就有机会干翻译这种事情了。别的回报咱不谈,咱要论的就是翻译技术文档带给你的最大好处:提升哑巴英语水平。

别怕自己英语水平还不到能将文档翻译到信达雅的程度,那都是不必要的担心,是准备翻译出书时才需要考虑的事情。

作为一种练习,你只需要按你的理解把英文翻译成中文,然后看看自己是否能看懂,也可以发到博客上,看看别人是否能看懂。当然也可以找那种别人翻译过的文档,自己从英文翻译成中文,再和别人的译本对照着比较。

重要的是翻译这个过程,能够锻炼你的英文阅读能力,还能锻炼你的语言组织能力,非常有好处。

用英文写注释

如果你执意要联系哑巴英语,写英文注释也是不错的一种练习。在你的代码里该添加注释的时候,用英文,不要用中文!

额,是不是太虐了……不过我总觉得英文的注释比中文的逼格高,这是什么道理……

写英文文档

如果你的项目需要写技术文档,接口文档,产品文档,你用英文写写试试。

除了这一条,其他我都实践过。所以,这一条,我只是随便说说,如果你真的这么做了……神呐,请接受我的膜拜。


点击查看更多内容
4人点赞

若觉得本文不错,就分享一下吧!

评论

作者其他优质文章

正在加载中
感谢您的支持,我会继续努力的~
扫码打赏,你说多少就多少
赞赏金额会直接到老师账户
支付方式
打开微信扫一扫,即可进行扫码打赏哦
今天注册有机会得

100积分直接送

付费专栏免费学

大额优惠券免费领

立即参与 放弃机会
意见反馈 帮助中心 APP下载
官方微信

举报

0/150
提交
取消