西西軟件園多重安全檢測下載網(wǎng)站、值得信賴的軟件下載站!
軟件
軟件
文章
搜索

首頁編程開發(fā)其它知識 → 中級.Net程序員應(yīng)該知道的問題-Scott Hanselman清單上列出的

中級.Net程序員應(yīng)該知道的問題-Scott Hanselman清單上列出的

相關(guān)軟件相關(guān)文章發(fā)表評論 來源:本站整理時間:2010/11/19 9:46:36字體大。A-A+

作者:佚名點擊:21次評論:0次標簽: Scott 面向?qū)ο?/a> 程序員

  • 類型:數(shù)據(jù)庫類大小:1.1M語言:中文 評分:3.6
  • 標簽:
立即下載
1. 面向接口,面向?qū)ο螅嫦蚍较虻木幊痰牟煌?(Describe the difference between Interface-oriented, Object-oriented and Aspect-oriented programming.)

Interface-oriented (面向接口): 其實項目中非常頻繁的使用Interface,但從來不知道這就叫 Interface-oriented programming. 使用Interface的好處就是降低代碼的耦合程度,比方說,一個Url需要用戶登陸才能訪問,如果 thisUrl : IAuthentication, 那么你在實現(xiàn) thisUrl class的時候,就不需要操心Authentication的問題。使用Interface的另外一個好處是,單元測試thisUrl 類的時候,可以mock IAuthentication.

Object-oriented (面向?qū)ο?: 自己從來沒有嚴謹?shù)亩x過,但知道對象有狀態(tài),有方法,相似對象的抽象叫做類,對象是類的具體。面向?qū)ο蟮木幊逃蟹庋b,多臺,繼承等概念。

Aspect-oriented (面向方向): 一種避免重復(fù)性代碼的編程方法,當代碼中很多地方都重復(fù)用到同一個功能的時候 e.g. logging,可以使用aspect統(tǒng)一處理logging這部分的邏輯。The Ted Neward Challenge (AOP without the buzzwords) 這篇文章對我理解這個概念非常有幫助。


2. 接口跟類的區(qū)別 Describe what an Interface is and how it’s different from a Class.

接口(Interface): 不能實列化,自己沒有狀態(tài),方法也沒有具體的實現(xiàn),被繼承時,繼承類需要實現(xiàn)接口的所有方法。接口就像租房時網(wǎng)上下載的一個租房合同模板。

類 (Class): 可以被實例化,有狀態(tài),被繼承時,繼承類也不需要重新實現(xiàn)被繼承類中的方法。但是如果被繼承類的方法中有abstract修飾的,繼承類則需要實現(xiàn)這個方法。類像是已經(jīng)被填上內(nèi)容的租房合同的模板。

3. 什么是反射?What is Reflection?

代碼在運行過程中動態(tài)獲取程序集的信息,對象的信息,或者直接調(diào)用對象的方法或?qū)傩?e.g. var i = 100; i.GetType(); 輸出System.Int32.


4. XML web service 跟 .Net Remoting 的不同 (What is the difference between XML Web Services using ASMX and .NET Remoting using SOAP?)

XML Web service: 是開放標準,使用Http/SOAP協(xié)議交互。

.Net Remoting: 是微軟自己的技術(shù),只能在.Net里面使用。

因為自己沒有接觸過ASMX, .Net Remoting, 所以只能了解個皮毛,在網(wǎng)上看到一個答案,比較的詳細:

Remoting assumes the other end is .NET. This is because .NET remoting using SOAP uses the SoapFormatter to serialize data. SoapFormatter embeds the type information required to deserialize the object into the message itself. This requires that the client and the server must have access to this assembly. Remoting believes in the .NET Type System. Remoting believes in sharing types and assemblies. Remoting can support DCOM style Client Activated Objects which are stateful. The use of CAOs though have to be carefully thought about because CAOs cannot be load balanced. ASMX model does not assume that the other end is .NET. ASMX uses XmlSerializer to serialize data. Xmlserailizer believes that the XML Type System, that is the XSD is superior and works on serializing data conforming to a schema. In other words XML Web Services believe in sharing schema and contracts over types and assemblies. This makes the Web Services interoperable. ASMX services are usually stateless.


5. XmlSchema和CLS的類型體系是否異種同形? (Are the type system represented by XmlSchema and the CLS isomorphic?)

查了baidu才知道, isomorphic的意思, 異種同形. XmlSchema跟CLS的類型體系是不完全一樣的, 比如說數(shù)字類型, XmlSchema 就有negativeInteger等.Net沒有的類型.


6. 早期綁定跟晚期綁定的不同?(what is the difference between early-binding and late-binding?)

不知道是不是這么翻譯的,early-binding: 是指編譯的時候綁定,late-binding是指運行的時候綁定.e.g. person.DoSomething() early binding.
late binding:

1 Type animal = typeof(Animal);2 object o = Activator.CreateInstance(animal);3 var text = animal.InvokeMember("DoSomething", BindingFlags.Default | BindingFlags.InvokeMethod, null, o, null);


7. Is using Assembly.Load a static reference or dynamic reference?

動態(tài)


8. 什么時候合適使用Assembly.LoadFrom 或 Assembly.LoadFile?(When would using Assembly.LoadFrom or Assembly.LoadFile be appropriate?)

自己不太明白,什么時候用比較合適,有哪位知道嗎?


9. 一個程序集合格的名字是怎么樣的?是文件名嗎?如不是,區(qū)別是什么?(What is an Asssembly Qualified Name? Is it a filename? How is it different?)

一個程序集的名字有四個部分組成,文件名(file name),不包含后綴,Public key Token, Culture, Version. 跟文件名不同,


10. Assembly.Load("foo.dll") 對嗎?(Is this valid? Assembly.Load("foo.dll");)

不對,Assembly.Load("foo, Version=1.0.2004.0, Culture=neutral, PublicKeyToken=8744b20f8da049e3")


11. strongly-named 程序集跟非strongly-named 程序集有何不同?(How is a strongly-named assembly different from one that isn’t strongly-named?)

strongly-named 程序集可以保成程序集的獨特性,并且可以防止使用被別人篡改過的程序集


12. Can DateTimes be null?

DateTime 不能為Null.


13. 解釋JIT, NGEN,以及它們的優(yōu)劣?(What is the JIT? What is NGEN? What are limitations and benefits of each?)

JIT: Just In Time 編譯,優(yōu)勢: 任何JIT都可以編譯; 劣勢: 啟動時間比較長.

NGEN: 直接編譯成機器代碼,優(yōu)勢: 啟動時間比較長; 劣勢: 只能運行在本系統(tǒng).

不確定是否這樣解釋?請高手指正.


14. How does the generational garbage collector in the .NET CLR manage object lifetime? What is non-deterministic finalization?

CLR把對象分成三代, .Net GC通過一個對象被創(chuàng)建的時間來決定這個對象的壽命. 創(chuàng)建時間比較短的對象越早被收集, 創(chuàng)建時間比較長的對象越晚被收集.

non-deterministic finalization 是指你根本沒有辦法確定或控制一個對象被GC收集.


15. Finalize() 和 Dispose() 的區(qū)別 (What is the difference between Finalize() and Dispose()?)

GC在收集一個對象的時候, 調(diào)用Finalize(), 程序員沒有辦法調(diào)用. 但是程序員應(yīng)該負責在使用未托管資源(unmanaged object or resources)時使用Dispose(), 確保該資源被GC及時收集.


16. How is the using() pattern useful? What is IDisposable? How does it support deterministic finalization?

using()可以確保Dispose()在using() block 結(jié)束的時候被調(diào)用. IDisposable 只有一個方法, Dispose(), 當一個類繼承IDisposable時, 這個類的對象使用using()時, Dispose()被調(diào)用.


17. What does this useful command line do? tasklist /m "mscor*"

列出所有使用符合引號內(nèi)pattern的dll的進程.


18. What is the difference between in-proc and out-of-proc?

In-proc 發(fā)生在一個進程之內(nèi), Out-of-proc 發(fā)生在不同進程之間。


19. What technology enables out-of-proc communication in .NET?

.Net remoting

20. When you’re running a component within ASP.NET, what process is it running within on Windows XP? Windows 2000? Windows 2003?

Windows XP and 2000 : aspnet_wp.exe

Windows 2003 : w3wp.exe

  回答這20道題目的時候,明顯感覺到難度,花了大半天的時間,其中很多是在借助了google 之后閱讀了很多的文章才知道一些?磥,成為一位合格的中級.Net程序員要補的課還真是不少呢。
  很好奇,不知道博客園里的.Net程序員們有多少對這些問題都能夠了如指掌,對答如流的?