hanselman這篇文章很有意思,儘管不是每個問題都很值得作為面試問題出現,但是很多都值得去仔細想想。
一個優秀的面試問題,尤其是針對Senior Engineer的面試問題,不應該僅僅是問某個api的用法,某個很容易從協助中找到的內容。有發散性,可以基於問題進行擴充的問題才是一個比較好的問題。
下面是一個非常長的問題列表,主要是關於物件導向設計,設計模式,以及一些實際工程中會用到概念,都是比較基本的,但是也非常能考察一個進階工程師的水平,因為會牽涉到非常多方面。
另外要說明的是下面很多概念性問題可以直接從wiki維基百科上找到答案。另外我會標記出個人覺得比較值得問的問題。
原文在這裡 http://www.hanselman.com/blog/NewInterviewQuestionsForSeniorSoftwareEngineers.aspx
# What is something substantive that you’ve done to improve as a developer in your career?
有沒有做過什麼比較實質性的事情來提升你的程式員職業水平?
好問題。我的回答:這個很難說,我的做法是堅持學習,堅持寫技術類部落格。另外有些經驗在這裡提到過http://sunxiunan.com/?p=1799
# Would you call yourself a craftsman (craftsperson) and what does that word mean to you?
不敢叫自己大師啊,那得多牛逼?!
# Implement a <basic data structure> using <some language> on <paper|whiteboard|notepad>.
用某種語言在紙面上實現一個基本的資料結構。(用近似真實格式的虛擬碼來表達?)
好問題。我的回答,找一本基礎的資料結構書籍吧,比如這一本《資料結構與演算法分析:C語言描述(原書第2版)》
# What is SOLID?
參考http://en.wikipedia.org/wiki/Solid_%28object-oriented_design%29
這個solid不是說“結實的”,而是物件導向五大原則的簡稱:單一責任原則,開閉原則,萊西科夫替換原則,介面分離原則,依賴倒置原則。
好問題。這幾個原則的確應該背下來,太基礎了。
# Why is the Single Responsibility Principle important?
為什麼單一責任原則重要?
好問題。我的回答,因為職責明確,設計就不容易混亂,即使有後續變化也是可控的。
# What is Inversion of Control? How does that relate to dependency injection?
參考http://en.wikipedia.org/wiki/Inversion_of_control
實際中的例子,通知開會,一種可以打電話通知到每個人(這屬於中心控制型的,必須有個controller/manager之類的);也可張貼一個告示,大家自己來看,這屬於事件響應型的。
# How does a 3 tier application differ from a 2 tier one?
三層應用與兩層應用的區別是什嗎?
我只知道MVC三層應用。
# Why are interfaces important?
為什麼介面重要?
好問題。介面的重要在於消費者(用戶端)不需要瞭解生產者(服務端)的細節,介面相當於合約,當合約不變的時候,誰生產如何生產都不是消費者關心的問題。
# What is the Repository pattern? The Factory Pattern? Why are patterns important?
關於設計模式的問題,
第一個參考http://msdn.microsoft.com/en-us/library/ff649690.aspx
原廠模式基本上是眾人皆知的模式了。
為何模式重要?我不覺得模式重要,模式的重要性在於讓你能“喔!原來是這個”。但是對於一個沒有幾年編程經驗的開發人員而言,模式只能讓你更混亂。
設計模式很多情況下是通過加入一個抽象層來解決耦合之類的問題,但是層次越多越複雜,就好比單位中領導的層級越多越官僚一樣。
# What are some examples of anti-patterns?
反模式?少用模式,多寫點清晰的代碼吧。
# Who are the Gang of Four? Why should you care?
四人組,名字叫不上來,但是他們是設計模式的總結者。
# How do the MVP, MVC, and MVVM patterns relate? When are they appropriate?
這也是微軟特色,大家只要知道MVC就行了,其實大家現在用的都是MVC,但是由於水平高低,效果就是千差萬別。
啥MVP,MVVM我不知啊(也不是不知,只知道MVVM是wpf的一個概念,可我也不用wpf啊)
# Explain the concept of Separation of Concerns and it’s pros and cons.
參考http://en.wikipedia.org/wiki/Separation_of_concerns
我也不是瞭解的很細。
# Name three primary attributes of object-oriented design. Describe what they mean and why they’re important.
封裝/繼承/多態?
參考這裡吧http://en.wikipedia.org/wiki/Object-oriented_programming
學C++這幾個概念是基礎啊
# Describe a pattern that is NOT the Factory Pattern? How is it used and when?
不是原廠模式,我知道個單件模式。還有模板模式/facade模式/strategy模式,具體也要翻翻書,很少有意識的套用。
# You have just been put in charge of a legacy code project
with maintainability problems. What kind of things would you look to
improve to get the project on a stable footing?
第一步,先把代碼用最大警告層級編譯一遍,然後fix所有值得fix的warning。
好問題。
# Show me a portfolio of all the applications you worked on, and tell me how you contributed to design them.
如果光是看文檔,很難說到實質上。
好問題。
# What are some alternate ways to store data other than a
relational database? Why would you do that, and what are the trade-offs?
好問題,很多啦,記憶體/檔案/雲端儲存/nosql等等。tradeoff就看你的應用需求了。blabla。。。
# Explain the concept of convention over configuration, and
talk about an example of convention over configuration you have seen in
the wild.
好問題。
我能想到的就是買車開車,很少有人買到車以後,拿著說明書調試這個那個,一般都是直接上路,因為汽車廠會給你一個比較不錯的預設配置,也就是所謂的“方便”。
這個方便也保證了你開其它車,基本上都差不多,不用重新設定或者學習什麼。
所謂方便”convention“就是把相對不錯/比較普遍適用的配置都內建好了,用就是了。
# Explain the differences between stateless and stateful systems, and impacts of state on parallelism.
解釋有狀態與無狀態系統,以及有狀態系統在並行上的影響。
好問題。這個說不好。有狀態系統因為保持狀態,並行執行階段的訪問/修改需要有鎖同步機制。
# Discuss the differences between Mocks and Stubs/Fakes and where you
might use them (answers aren’t that important here, just the discussion
that would ensue).
跟TDD相關的問題。不會哦。
# Discuss the concept of YAGNI and explain something you did recently that adhered to this practice.
解釋“YAGNI”。
最簡單的例子是當我們定義介面,會特意預留出一兩個參數,說是為了將來使用,其實,沒有將來。屁嘞!你根本不需要它!
不是說不考慮可擴充性,但是要基於可預測的基礎上。
# Explain what is meant by a sandbox, why you would use one, and identify examples of sandboxes in the wild.
比如把虛擬機器比如vmware virtualbox作為沙箱,用起來可以隔離風險。大不了重啟,或者刪除之。
# Concurrency
* What’s the difference between Locking and Lockless (Optimistic and Pessimistic) concurrency models?
* What kinds of problems can you hit with locking model? And a lockless model?
* What trade offs do you have for resource contention?
* How might a task-based model differ from a threaded model?
* What’s the difference between asynchrony and concurrency?
這些問題不錯。並發相關的問題,設計多使用者高效能系統必知。
# Are you still writing code? Do you love it?
我喜歡編程。
# You’ve just been assigned to a project in a new technology how would you get started?
如果是我,先瞭解這個技術的風險。小心求證,盡量縮小使用範圍,否則是很致命的。
# How does the addition of Service Orientation change systems? When is it appropriate to use?
不懂。
# What do you do to stay abreast of the latest technologies and tools?
我跟的很緊哦!
# What is the difference between "set" logic, and "procedural" logic. When would you use each one and why?
不懂要問什麼。
# What Source Control systems have you worked with?
ClearCase.很難用。最近不少問題都是跟CC相關的。
# What is Continuous Integration? Have you used it and why is it important?
持續整合。這個概念跟TDD也掛鈎。
# Describe a software development life cycle that you’ve managed.
涉及的還是傳統模型,不是scrum型的。
# How do you react to people criticizing your code/documents?
批評沒問題,但是要有道理有根據。
# Whose blogs or podcasts do you follow? Do you blog or podcast?
這就很多了,看我以前寫的文章吧。
# Tell me about some of your hobby projects that you’ve written in your off time.
主要是Lua和Py的,appengine上的比較多。
# What is the last programming book you read?
最近看得是《C++ FAQs》中文版。翻譯的一般,內容也比較陳舊。更堅定了我使用C風格的C++的決心。
# Describe, in as much detail as you think is relevant, as
deeply as you can, what happens when I type "cnn.com" into a browser and
press "Go".
儘可能詳細深入的描述,當你在瀏覽器敲網址然後go後面的技術細節。
好問題。很發散,絕對能看出面試者的技術厚度。
# Describe the structure and contents of a design document, or a set of design documents, for a multi-tiered web application.
# What’s so great about <cool web technology of the day>?
# How can you stop your DBA from making off with a list of your users’ passwords?
# What do you do when you get stuck with a problem you can’t solve?
參考這裡電腦編程新人入行指導
http://sunxiunan.com/?p=961
# If your database was under a lot of strain, what are the first few things you might consider to speed it up?
先profiling哦!
# What is SQL injection?
# What’s the difference between unit test and integration test?
單元測試應該是程式員做。整合測試就牽扯到tester了。
# Tell me about 3 times you failed.
# What is Refactoring ? Have you used it and it is important? Name three common refactorings.
我一直在重構自己的代碼。重構原則參考這裡
C++項目代碼規範(偶自用)http://sunxiunan.com/?p=1787
# You have two computers, and you want to get data from one to the other. How could you do it?
具名管道,socket,共用資料夾,路子還是很多的。
# Left to your own devices, what would you create?
# Given Time, Cost, Client satisfaction and Best Practices,
how will you prioritize them for a project you are working on? Explain
why.
這個很值得問。
# What’s the difference between a web server, web farm and web garden? How would your web application need to change for each?
# What value do daily builds, automated testing, and peer reviews add to a project? What disadvantages are there?
都是為了提升代碼品質,但是會延長工期。
# What elements of OO design are most prone to abuse? How would you mitigate that?
# When do you know your code is ready for production?
看bug fix的統計曲線。