您的位置:首页 > 职场人生

编写更好的代码---怎样面试一个程序员

2006-08-04 10:58 1146 查看
编写更好的代码
---怎样面试一个程序员
作者:Bill Venners
日期:February 24,2003

翻译: ehui928
日期:2006年8月

---原文出处 http://www.artima.com/wbc/interprog.html
前段时间一次偶然的机会看到这篇文章,觉得挺不错的。对于面试官来说,它可以帮助你去发现合适的雇员,而对于去面试程序员的人来说,也具有很好的参考价值,使你了解大师是怎么选择他们所需要的人的。故将此翻译出来,以便分享!

概要
在众多的应聘者中识别出好的程序员可不是一件容易的事情。本文包含的面试技术,是从最近一次关于书写更好代码的峰会上获得。这些技术可以帮助你找到最适合你的项目的程序员。
2003年1月,我参加了在波特兰俄勒冈州(Portland Oregon)举行的有关编写更好代码的峰会,这次会议由Scott Meyers和Bruce Eckel组织。在这次为期三天的会上,15个人聚集在一起共同探讨代码质量以及怎样去提高质量。经过这次讨论,有一个观点是显而易见的,那就是好的代码是由好的程序员写出来的。因此,在一个组织内部提高代码质量的重要方法就是雇佣好的程序员。但问题就是,从一大批的应聘者当中识别出一个好的程序员并非易事。

寻找好的程序员是很困难的,因为高超的编程技能依赖的不仅仅是编程语言的语法知识,还有很多其它重要的东西。你需要的人应该是这样的一些人,不管他的穿着如何(也许穿了圆点花纹T-恤加条纹裤),然而他对面向对象设计具有很好的理解和判断;他应该具有足够的创造力,能发现所给问题的创造性解决方法;他应该能很谦虚地提出改进意见,但是当他们成为具备领导人的最佳人选的能力时,他们会傲慢并且立场坚定地拒绝担当领导角色。你怎样才能在一间会议室内用短短30分钟时间将以上所有需求内容让一个陌生人知道?

在Writing Better Code大会的最后一个早上,Bruce Eckel宣布他来主持会议。Bruce想要让每个参加会议的人都来分享下他/她的面试技术。他想知道我们是怎样在一次面试之中识别一位好的程序员的。在这篇文章中,我会强调下那天早上我们讨论的一些面试技术。如果你有其他的想法或者想和我们一起讨论文中提到的技术的话,请在News&Ideas论坛的How to Interview a Programmer主题下跟帖发表评论。

探查一个专业知识领域
尽管那天早上提出的面试方法各式各样,其中有一些是基本的技术。例如,你应该寻求应试人的总体编程才能和能力,而不是简单地找寻应试人在其将要工作的特定领域中所具备的专业知识和经验。一种探查和判断一个应试人的才能的方式是对他专业知识中的某个领域进行深入考查。
Dave Thomas: 因才而雇。很多公司犯的最大的错误之一是通过一张清单来招聘人才。清单上的内容为:我需要一个程序员,具有6年java,3年Oracle和2年EJB开发经验。时代已经改变了,因此你也需要雇佣那些随之变化了的伙计。寻找那些懂得计算的人,没必要限制得那么狭窄。他们不仅会很好地适应未来,在现阶段他们也很有可能是具有创造性的。

Chris Sells: 为了确认应试者在技术上表现到底有多好,我会让他们选择一个他们认为专长的领域。我需要他们对某些东西要相当了解,我就会问他们那些方面的问题。我会问他们原因,使其知道那些专业领域中的东西为什么会以它们特定的方式工作。如果他们在过去学会了事物工作的原因,我相信在将来他们也能学会事物工作的前因后果。

让他们去评论某件事情
另一个技术涉及到与应试者建立一次谈话的重要性。要想了解应试人的才能和人品,你不能仅仅问些短答案的问题。你应该找到一种方式来发起一次交谈。为了引起对话,你可以让应试者对一些技术进行评论。

Josh Bloch: 我会叫应试人对我们共同拥有的系统或平台作出评论,特别是他们在工作中用到的一些东西。比方说,我可能会这样问道,“你不喜欢Java的哪些部分,为什么?”

Pete McBreen: 我会把我们当前代码样例给应试人,让他对代码解释和评价。这样会让我对他们的技能有所了解,并且也让他们知道他们所期待的工作是什么。

让他们解决一个问题
酝酿一次对话的还有一种方式是让应试人完成一项任务,去解决一个问题或者创建一个设计。尽管参加会议的每个人似乎都认为这是一种重要且有用的技术,但它也引发了许多问题。大家都认为让应试者解决难题需要一定的耐心。

Josh Bloch: 我喜欢让应试人解决一个小规模的设计问题,来看看他们是怎样思考,思考过程是什么。问题可能是类似于这样的,“你怎样编写一个函数,使其能告诉我它的参数是2的幂?”我不是寻找象((n & -n) == n)这样的优秀的解答。我希望看到的是他们是否得到正确的方法,是否考虑到边界情况,如果他们的算法是合理的,能否解释算法是怎样工作的;他们能够在第一次尝试的基础上做出改进?

Bruce Eckel: 我让应试人创建一只鸡的对象模型。这消除了任何有关问题域不确定性所带来的问题,因为我们每个人都知道鸡是什么。我认为它也将人们从计算机技术细节中解放出来。这个测试是看他们能否对一副大的画面进行思考。

Scott Meyers: 我讨厌任何叫我现场设计的东西。那是一种除了在高强度的工作环境,其他环境中很少需要的技能,而在高强度环境中让应试人精确地证明他们的能力是很困难的。我认为用它来选择应试人,从根本上来说是一件很不公平的事情。

Matt Gerrans: 我不喜欢当我被要求写一个程序时候,被告知在一张纸上完成。不要让应试人在纸上写程序。那是浪费时间和精力。人们不会在纸上写软件,他们是用电脑,用自动补全,宏,带索引的API文档和上下文敏感帮助来完成的。他们思考,修改,甚至重新编写。如果你想看他们的工作,让他们在面试前在笔记本电脑或硬拷贝上编写一些小模块或实现一些接口。然后你可以审阅它,讨论设计、编码风格和对它讨论中的一些决策。这将会让你对一个人的工作和风格作出更加真实和有用的估定。

Kevlin Henney: 我喜欢设计一些没有单一固定答案的对话类问题。采用这种方式时他们会向我提问,这样的话将会激发一次讨论。最好在室内有一块白色写字板。一次对话能让面试者看出应试人是如何工作的,鉴于事实的问题仅仅是电视智力竞猜题目的最佳选择,但是它不会告诉你某人将会怎样工作。一个难题需要知道诀窍,从本质上来说就是对某样事情要么知道要么不知道。我不喜欢难题,因为它们不需要对话。

Josh Bloch: 一个合理问题的组成很大程度上取决于应试人的经验和成熟程度。

Dave Thomas: 我寻找带有好奇心的人。提出问题,但不是难题。

查看他们的代码

Josh Bloch 建议一种我们都喜欢的技术,那就是让应试人将代码放公文包内来面试。查看应试人的代码并且和他们讨论它。尽管我们担心一些应试人也许会不通过合法的途径将代码带来面试,我们发现绝大多数应试人可能含有少量这种情况。至少让应试人将他们以前曾经写过的代码带来面试不会有太大的影响。

Josh Bloch: 我希望看下他们的代码。通过看他们选择的代码,你可以发现他们的价值.通过讨论代码,了解他们是怎样与人交流的。

发现他们读的书是什么
有些人表示他们会问应试人读过哪些编程类书籍,据此来看一个程序员是否具有自我激励精神、是否关心自身编程技能的提高。

Matt Gerrans: 我问应试者,“你读过哪些关于编程的书?”如果这些书超出了语法范围,那会是很重要的。

Randy Stafford: 我会弄清楚他们(应试人)读了什么书,因为这对于我考察他们是否具有意志力来进行自我教育来说是很重要的。

询问一个个人问题

与一个人的技术能力同样重要或者更加重要的是其个人品质。一个人对于一个团队是否适合?他们是否适合某个工作环境?人们使用各种各样的技术来对一个人的个性进行判断。

Randy Stafford: 好的公民素质很可能要比高超的技术更加重要,因为如果你拥有这样的一些人,他们具有正确的态度和行为,那么你就可以帮助他们获得技术知识和软件开发习惯。但是如果你拥有的人是缺乏谦逊品质和不成熟的,那么让他们去合作共同达成一个目标是极其困难的,不管他们是多么的聪明或者过去是多么的辉煌。

Chris Sells: 我会这样问应试人,“告诉我一个你和你老板或同事之间存在的问题,你是怎样处理你和你老板之间的问题的?”

Jack Ganssle: 我检查了推荐人。现在,我知道这些人是应试人的五个最好的朋友,并且不会说应试人任何负面的东西。但我会问那些推荐人谁认识应试人,然后仔细观察其他人。通过这种方式,我将关系网展开,使它超出应试人所能想到的范围。

Kevlin Henney: 我会尽量去想象假设我去一个酒店和他们谈论一些非技术性的东西。这种方式不是用来衡量我是否喜欢他们,而是看我能否与他们一起相处。他们是否有公关能力?我能否和他们在一个非办公环境中交谈?

Dawn McGee: 最令人喜欢的人通常并不是最优秀的人。

Dave Thomas: 由于团队容易变得自满,并固守他们的工作方式,我认为每个具有一定规模的团队都需要一个专门若麻烦的人。他们需要偶尔离开一下他们的舒适乐园,这样他们才能够从一个不同的角度看待问题。这里的麻烦人分两类:一类是有危害性的粗野人,所有的团队中都应当避免出现这种人;另外一类人他们从来都不知道成人不应该一直问“为什么”。后面这类人正是团队应该珍惜的。

了解他们
我们讨论的中心主题就是你需要尽最大努力去了解你的应试者。在面试中和他们进行交谈,对他们争取得出一种感觉。如果可能的话,可以对他们进行试用。这将会给你更多时间去了解应试者,同时也让你的应试者有更多的时间来了解你。

Chuck Allison: 我同他们交谈且对他们有了一些感受。我一直都是询问他们做过什么。我发觉通过了解一个人技术上的兴趣所在,你可以了解很多关于他们的重要的事。以前我经常会让他们(应试者)描述一下他们最感兴趣或认为最具有挑战性和最为成功的一个项目。偶尔我也会问他们做了哪些令他们最引以为豪的工作。这通常揭示了一个人对问题理解的深度和解决问题的熟练程度。同时也让他们打开话闸,你也可以坐在后面得到你需要的更多答案。

Randy Stafford: 我会查看他们简历上所列举的过去做过的项目,然后让他们谈论那些项目,比如说团队是怎么组织的,项目中采用了哪些技术和架构,软件是否成功地用于生产,等等。从他们的回答中我会仔细倾听他们从那些经历中学到的课程,并将它们与我在过去经历中学到的东西进行对比,看看是否有相同的地方。我会简单地观察他们是怎样看待他们与其所处的周围环境之间的关系的。一些人是以傲慢的姿态出现的,一些是采取忽略的态度,还有一些是感到无助。另外有一些人的回答则是谦虚、智慧并且具有激励性。我常常问他们读过那些软件开发方面的著作,因为对于我来说能不断地学习教育是非常重要的。

Angelika Langer: 在德国,雇用职员就象和某人结婚一样。它是“到死才分开的”--- 是一段没有离婚的婚姻, 因为你不能解雇你的职员。解雇某个人仅有的两种机会是:六个月试用期或者公司破产。
对应试者的过滤主要是在面试前根据应试者的简历及前任雇主提交的材料来完成的。(在德国,雇主必须在雇员离开公司的时候,为每个雇员提供一份书面评价。)面试本身通常是很简短的。过滤应试者的主要工具是仔细检查简历和评价材料;应聘人中有98%在这个阶段中就被认为是不合格的。面试过程能让你对从应试人的材料中所获得的印象进行确认并且让你感受到他们的个人品质。幸运的胜出者将会进入试用期。

对应试人的试用肯定不能替代对其过滤的过程;它仅仅在你作出确认之前保持的最后一个开放出口(意即你如果试用期你对应试人不满意,可以通过该途径解雇应试人)。

Andy Hunt: 我们雇佣了一些人,他们在面试时表现得很好,但是在工作时确很糟糕。如果可能的话,请先给他们一段时间的试用期。

Dawn McGee: 你也可以将应试人带来工作半天,看他们在将来可能要从事工作上的表现。

总结
最后我们对在波特兰数小时讨论总结如下:

你应该寻找有才能和更合适的人,而不仅仅是专业技能高超。
问一些有始有终的问题来引出一次可以揭示对方特点的谈话。
让应试人对某事进行评价。
让他们设计某样东西。
调查他们过去的经历。
仔细检查他们的代码。
通过对话,或者如果可能的话,通过一段试用期,你应该尽量熟悉应试者的能力、才能和个性。

你是怎样面试一个程序员的?
对于文章中提到的技术,你有何意见与建议?你有没有一种工具或者技术能帮助你找到好的程序员?请在News&Ideas论坛的How to Internivew a Programmer主题下与我们分享你的经验。

关于作者:
Bill Venners is President of Artima Software, Inc. and Editor-In-Chief of Artima.com. He is the author of Inside the Java Virtual Machine (Computing McGraw-Hill), a programmer-oriented survey of the Java platform's architecture and internals. His popular columns in JavaWorld magazine covered Java internals, object-oriented design, and Jini. Bill has been active in the Jini Community since its inception. He led the Jini Community's ServiceUI project, whose ServiceUI API became the de facto standard for associating user interfaces to Jini services. Bill also serves as an elected member of the Jini Community's initial Technical Oversight Committee (TOC), and in this role helped to define the governance process for the community.

资源:
Chuck Allison is a professor of computer science at Utah Valley State College in Orem, Utah. He has degrees in mathematics and practiced software development professionally from 1978 to 2001, working for defense contractors and other large corporations. He spent most of the 1990s as a contributing member of the C++ Standards Committee and designed the standard bitset class. He has been a columnist for the C/C++ Users Journal (C++ and Java) and the editor since 1992, and is now senior editor of the journal. He is the author of C & C++ Code Capsules (Prentice Hall) and co-author with Bruce Eckel of Thinking in C++, Volume 2 (Prentice Hall). He has taught C++ and Java extensively throughout the U.S. and is available for training and consulting from May through August:
http://www.freshsources.com/
Josh Bloch is an architect in Sun Microsystem's Core Java Platform Group. He has designed major enhancements to the Java APIs and language, specifically for the Java Collections API and the java.math package. Most recently, he led the expert groups that defined Java's assert and preferences facilities. In his 2001 book, Effective Java Programming Language Guide (Addison Wesley), Josh distilled his wisdom into 57 concrete guidelines for designing and implementing Java programs:
http://java.sun.com/docs/books/ef fective/

Alistair Cockburn is the founder of Humans and Technology and Cockburn and Associates. Alistair is internationally known for his work in object- oriented software development. Alistair does technical facilitation, process and organization design, project setup, requirements gathering, and OO design:
http://alistair.cockburn.us/

Bruce Eckel is the author of Thinking in Java (Prentice Hall), the Hands-On Java Seminar CD ROM, Thinking in C++ (Prentice Hall), and C++ Inside and Out (McGraw Hill), among others. He's given hundreds of presentations throughout the world, published more than 150 articles in numerous magazines, was a founding member of the ANSI/ISO C++ committee, and speaks regularly at conferences. He provides public and private seminars and design consulting in C++ and Java:
http://www.mindview.net/

Jack Ganssle helps developers build better embedded systems faster. He started, developed, and sold three electronics companies; including one of the world's leading producers of embedded development tools. Jack is Embedded Systems Programming's technical editor, as well the magazine's monthly "Breakpoints" columnist. He has published more than 300 articles on different aspects of embedded development, as well as two books (The Art of Designing Embedded Systems and The Art of Programming Embedded Systems both published by Newnes) on the subject. Online, he writes the weekly "Embedded Pulse" column on embedded.com and is the editor of The Embedded Muse, a free bi-weekly email newsletter:
http://www.ganssle.com/index.htm

Matt Gerrans began his professional life as an electronic engineer but quickly saw the light and switched to software development. He now has more than 12 years professional software development under his belt, including work in C++, Java, Python, and yes, even JavaScript. He is the C# columnist for Artima.com:
http://www.cyclethere.com/

Kevlin Henney is an independent consultant and trainer based in the UK. Prior to becoming the founding director of Curbralan Limited, he was a principal technologist for QA Training. He has developed and delivered training course material and consultancy on many aspects of OO development, which he has practiced across a number of domains for more than a decade:
http://www.curbralan.com

Andy Hunt and Dave Thomas are the "Pragmatic Programmers," recognized internationally as experts who develop high-quality software -- accurate and highly flexible systems. They helped write the now-famous Agile Manifesto, and regularly speak on new ways to produce software. Their best- selling book, The Pragmatic Programmer (Addison Wesley), describes their software development best practices. They have more than 40 years combined experience in the industry. They know practical software development:
http://www.pragmaticprogrammer.com/

Angelika Langer works as an independent freelance trainer, mentor, and consultant with a course curriculum of her own. Her current work is backed by more than a decade of experience as a software engineer working for German and US companies and several years as a trainer and consultant. She enjoys speaking at conferences all over the world. Her consulting and mentoring assignments focus on code reviews, audits, project evaluations, special purpose workshops, and more. Together with Klaus Kreft, she wrote the authoritative book Standard C++ IOStreams and Locales (Addison Wesley) http://www.langer.camelot.de/ios treams.htm. Angelika also served as a columnist for C++ Report http://www.langer.camelot.de/Articles/Articles.htm#C++ Report and C/C++ Users Journal for many years, and currently writes a column entitled "Effective Java" for the German JavaSPEKTRUM magazine:
http://www.langer.camelot.de/

Pete McBreen is the author of Software Craftsmanship and Questioning Extreme Programming (both by Addison Wesley). He is an independent consultant who actually enjoys writing and delivering software. Despite spending a lot of time writing, teaching, and mentoring, he goes out of his way to ensure that he does hands-on coding on a live project every year. Pete specializes in finding creative solutions to problems that software developers face:
http://www.mcbreen.ab.ca/

Dawn McGee is a Business Consultant and Attorney. Formerly, she served as the Lead Analyst for Underdog Ventures, LLC, in New York City and Global Partners, LLC, in Napa, California, focusing on investing in companies that have a high social impact. Ms. McGee provides clients with legal and business advice on start up issues, business plan reviews, business formation, venture capital financing, technology development agreements, licensing agreements, intellectual property protection, private placements, joint venture agreements, real estate issues and estate planning and business succession. She speaks frequently on the issues of angel investing, venture financing and women's entrepreneurship. She can be reached at:
dawnmcgee@excite.com

Scott Meyers is one of the world's foremost experts on C++ software development. He wrote the best-selling Effective C++ series (Effective C++, More Effective C++, and Effective STL (all Addison Wesley)), wrote and designed the innovative Effective C++ CD, is consulting editor for Addison Wesley's Effective Software Development series, and is a member of the advisory board for Software Development magazine. He also sits on technical advisory boards for several start-up companies. A programmer since 1972, he holds an M.S. in computer science from Stanford University and a Ph.D. from Brown University. Scott offers consulting and training services to clients worldwide:
http://www.aristeia.com/

Chris Sells is a consultant, author, speaker, and general technology wonk. He specializes in component-based and distributed systems in a Windows environment, including .Net, Web Services, COM, C++, ATL and Win32:
http://www.sellsbrothers.com/

Randy Stafford is a professional software developer and chief architect at IQNavigator, Inc. He wishes he had more time for writing about software development, but has recently contributed chapters to Martin Fowler's Patterns of Enterprise Application Architecture (Addison Wesley) and Floyd Marinescu's EJB Design Patterns (John Wiley & Sons). He's been developing enterprise applications in Smalltalk or Java for 15 years in government and commercial sectors, for companies large and small. His homepage on Ward Cunningham's Wiki Wiki Web, where he has been a longtime community member, is:
http://c2.com/cgi/wiki?RandyStafford

Dave Thomas and Andy Hunt are the "Pragmatic Programmers," recognized internationally as experts who develop high-quality software -- accurate and highly flexible systems. They helped write the now-famous Agile Manifesto, and regularly speak on new ways to produce software. Their best- selling book, The Pragmatic Programmer (Addison Wesley), describes their software development best practices. They have more than 40 years combined experience in the industry. They know practical software development:
http://www.pragmaticprogrammer.com/
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐