書籍紹介: CLR via C#, Third Edition

CLR via C#, Third Edition

CLR via C#, Third Edition


第3版の季節がやって参りました.
そもそもそんな本は知らんがな,という人ももしかしたらいらっしゃるかもしれませんが,『プログラミングMicrosoft .NET Framework』の原書と言えば多くの .NET 開発者には通じるのではないかと思います*1
さて,今回の更新の目玉のひとつが,.NET Framework 4 / C# 4.0 対応というところらしいですが,まあぶっちゃけ第2版を持っている人はいつもの定期更新てところでしょうか.私も,細かい更新とかはとりあえず手元に届いてから調べるつもりです.
なお,著者のブログで更新内容については告知されています.また記事のコメントでのやりとりでは,「eBook 版の予定もある」と書かれています*2.用心深い方や,邦訳版でとりあえず間に合っている人で,発売日に買うかどうか迷っている方は,その辺りが参考になるでしょう.

  • Part I – CLR Basics
    • Chapter 1-The CLR’s Execution Model
      • Added about discussion about C#’s /optimize and /debug switches and how they relate to each other.
    • Chapter 2-Building, Packaging, Deploying, and Administering Applications and Types
      • Improved discussion about Win32 manifest information and version resource information.
    • Chapter 3-Shared Assemblies and Strongly Named Assemblies
      • Added discussion of TypeForwardedToAttribute and TypeForwardedFromAttribute.
  • Part II – Designing Types
    • Chapter 4-Type Fundamentals
      • No new topics.
    • Chapter 5-Primitive, Reference, and Value Types
      • Enhanced discussion of checked and unchecked code and added discussion of new BigInteger type. Also added discussion of C# 4.0’s dynamic primitive type.
    • Chapter 6-Type and Member Basics
      • No new topics.
    • Chapter 7-Constants and Fields
      • No new topics.
    • Chapter 8-Methods
      • Added discussion of extension methods and partial methods.
    • Chapter 9-Parameters
      • Added discussion of optional/named parameters and implicitly-typed local variables.
    • Chapter 10-Properties
      • Added discussion of automatically-implemented properties, properties and the Visual Studio debugger, object and collection initializers, anonymous types, the System.Tuple type and the ExpandoObject type.
    • Chapter 11-Events
      • Added discussion of events and thread-safety as well as showing a cool extension method to simplify the raising of an event.
    • Chapter 12-Generics
      • Added discussion of delegate and interface generic type argument variance.
    • Chapter 13-Interfaces
      • No new topics.
  • Part III – Essential Types
    • Chapter 14-Chars, Strings, and Working with Text
      • No new topics.
    • Chapter 15-Enums
      • Added coverage of new Enum and Type methods to access enumerated type instances.
    • Chapter 16-Arrays
      • Added new section on initializing array elements.
    • Chapter 17-Delegates
      • Added discussion of using generic delegates to avoid defining new delegate types. Also added discussion of lambda expressions.
    • Chapter 18-Attributes
      • No new topics.
    • Chapter 19-Nullable Value Types
      • Added discussion on performance.
  • Part IV – CLR Facilities
    • Chapter 20-Exception Handling and State Management
      • This chapter has been completely rewritten. It is now about exception handling and state management. It includes discussions of code contracts and constrained execution regions (CERs). It also includes a new section on trade-offs between writing productive code and reliable code.
    • Chapter 21-Automatic Memory Management
      • Added discussion of C#’s fixed state and how it works to pin objects in the heap. Rewrote the code for weak delegates so you can use them with any class that exposes an event (the class doesn’t have to support weak delegates itself). Added discussion on the new ConditionalWeakTable class, GC Collection modes, Full GC notifications, garbage collection modes and latency modes. I also include a new sample showing how your application can receive notifications whenever Generation 0 or 2 collections occur.
    • Chapter 22-CLR Hosting and AppDomains
      • Added discussion of side-by-side support allowing multiple CLRs to be loaded in a single process. Added section on the performance of using MarshalByRefObject-derived types. Substantially rewrote the section on cross-AppDomain communication. Added section on AppDomain Monitoring and first chance exception notifications. Updated the section on the AppDomainManager class.
    • Chapter 23-Assembly Loading and Reflection
      • Added section on how to deploy a single file with dependent assemblies embedded inside it. Added section comparing reflection invoke vs bind/invoke vs bind/create delegate/invoke vs C#’s dynamic type.
    • Chapter 24-Runtime Serialization
      • This is a whole new chapter that was not in the 2nd Edition.
  • Part V – Threading
    • Chapter 25-Threading Basics
      • Whole new chapter motivating why Windows supports threads, thread overhead, CPU trends, NUMA Architectures, the relationship between CLR threads and Windows threads, the Thread class, reasons to use threads, thread scheduling and priorities, foreground thread vs background threads.
    • Chapter 26-Performing Compute-Bound Asynchronous Operations
      • Whole new chapter explaining the CLR’s thread pool. This chapter covers all the new .NET 4.0 constructs including cooperative cancelation, Tasks, the aralle class, parallel language integrated query, timers, how the thread pool manages its threads, cache lines and false sharing.
    • Chapter 27-Performing I/O-Bound Asynchronous Operations
      • Whole new chapter explaining how Windows performs synchronous and asynchronous I/O operations. Then, I go into the CLR’s Asynchronous Programming Model, my AsyncEnumerator class, the APM and exceptions, Applications and their threading models, implementing a service asynchronously, the APM and Compute-bound operations, APM considerations, I/O request priorities, converting the APM to a Task, the event-based Asynchronous Pattern, programming model soup.
    • Chapter 28-Primitive Thread Synchronization Constructs
      • Whole new chapter discusses class libraries and thread safety, primitive user-mode, kernel-mode constructs, and data alignment.
    • Chapter 29-Hybrid Thread Synchronization Constructs
      • Whole new chapter discussion various hybrid constructs such as ManualResetEventSlim, SemaphoreSlim, CountdownEvent, Barrier, ReaderWriterLock(Slim), OneManyResourceLock, Monitor, 3 ways to solve the double-check locking technique, .NET 4.0’s Lazy and LazyInitializer classes, the condition variable pattern, .NET 4.0’s concurrent collection classes, the ReaderWriterGate and SyncGate classes.

The plan is that this book WILL have an eBook available for it. I do not know more of the details just now.

(第2版に引き続き,第3版の翻訳も行われると良いなぁと願う人々が踏むべき過去の) 参考リンク

*1:著者である Jeffrey Richter 氏の名は,『Advanced Windows 第5版 上』『Advanced Windows 第5版 下』の原書の著者として,Win32 時代からの開発者にはお馴染みですね.

*2:Jeffrey Richter 氏と言えば,『なんで Advanced Windows の(原書の)電子ブック版は無くなったの? - NyaRuRuの日記』なんて話も過去にはあっただけに,『CLR via C#, Third Edition』に eBook 版の予定があるというのは嬉しいニュースですね.

書籍紹介: .NETのクラスライブリ設計 開発チーム直伝の設計原則、コーディング標準、パターン (Framework Design Guidelines 2nd Edition)

.NETのクラスライブラリ設計 開発チーム直伝の設計原則、コーディング標準、パターン (Microsoft.net Development Series)

.NETのクラスライブラリ設計 開発チーム直伝の設計原則、コーディング標準、パターン (Microsoft.net Development Series)


Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (2nd Edition)』の邦訳と言えば分かる人はまあ説明は不要ですかね.
本書は,.NET Framework のデザインと実装を経て Microsoft が培ったコーティング標準と設計パターン集です..NET に限らず,いわゆるフレームワークの作成経験のある人は,読めば必ず何かの再発見があるでしょう.もちろん .NETフレームワークを作っている人なら読むべき一冊です.
また,本書の特徴として超豪華メンバーによる注釈が挙げられます.各トピックには,様々なバックグラウンドをもつ専門家*1によって注釈が付けられており,本書の内容をとてもバランスのとれたものにしています.ルール集にありがちな「その理屈はおかしい」系の読後感が本書にないのは,やはりこの注釈の存在が大きいのでしょう.
本書の内容が日本語で読めるようになるのは,本当にすばらしいことです.@yfakariya さんと @matarillo さんに拍手!

*1:経歴を見るだけでくらくら来る Annotator が多数参加.Anders Hejilsberg や Paul Vick,Herb Sutter といった大御所ももちろん参加しています.

書籍紹介: C# .NET アプリケーション開発 徹底攻略

毎日コミュニケーション山口様に献本していただきました.紹介がすっかり遅くなってしまい,すみません.

C# .NETアプリケーション開発 徹底攻略 C# 3.0/.NET Framework 3.5対応

C# .NETアプリケーション開発 徹底攻略 C# 3.0/.NET Framework 3.5対応




本書を一言で表せば,C# を用いたシステム開発者による,開発者視点でのノウハウ集です.現役の SIer の方が,.NET Framework を構成するいくつかの要素技術をどのように評価しており,また現場の知恵としてどのような点に気をつけているかが書かれています.
「はじめに」に書かれているとおり,本書は.NET Framework の『リファレンス系』書籍でも『Tips系』書籍でもありません.

筆者は、SIer (システムインテグレーター) として業務アプリケーションの開発の仕事を持っています。しかし、現実的に多くの開発者の方は、リファレンスレベルの知識についてはよく理解していますが、業務アプリケーションレベルの開発ができていないと感じることがあります。

それは、かなりの部分で経験や蓄積された知識が必要とされるものです。これらの要素をなるべく体系的に、簡単にまとめたいと思ったのが本書の始まりです。本書の内容は、業務アプリケーションの開発に携わった多くの開発者の方が、迷った・ハマった・間違った経験を踏まえ、最も効率的に開発方法が理解できるように考えました。

本書の内容を理解した方は、開発現場においても即戦力となるはずです。これは、現場で責任を持つものとして断言できます。筆者の思想は完全に現場寄りですので、難しいことは好みません。理論・理屈よりはコストに対する結果を出すことが大事だと考えています。本書によって、少しでも効率的で「シンプル」な開発が実現できることを願っています。

1.2 対象とする読者

本書は、以下のような人を対象としています。

  • C#開発経験があり、言語仕様について一通り理解できている人
  • C#でマルチスレッドプログラミング開発を行う人
  • C++Java等のオブジェクト指向言語経験者で、C#開発を始める人
  • .NET Frameworkでシステム開発を行う設計者、開発チームリーダー

Chapter 01では開発ツールであるVisual Studio 2008の機能と、開発で必要となるデバッガの使用方法についてを様々な状況を踏まえ紹介します。

Chapter 02では.NET Frameworkを使用したアプリケーションの基本的知識を解説。言語仕様の本質的理解とマルチスレッドアプリケーションの設計に関わる知識、例外管理、.NET Frameworkの枠を超えたWin32API連携の方法について紹介します。

Chapter 03では.NET Frameworkに関する性能問題について発生頻度の高いポイントに重点を置き対策方法を紹介します。またメモリープロファイリング、パフォーマンスプロファイリングの手順を確認します。

Chapter 04ではClickOnceを使用したアプリケーションデプロイ方法、セキュリティを考慮したアプリケーション、著作物の保護等アプリケーションのリリース管理方法について確認します。

Chapter 05では既存のアプリケーション資産を有効活用する方法として、.NET FrameworkとCOMが混在したアプリケーションの配布・管理の方法、また.NET Frameworkで作成したアプリケーションをCOMとしてブラウザに埋め込み、利用する方法を解説します。

Chapter 06では.NET Frameworkによる新しいクロスプラットフォームであるSilverlightを紹介します。C#の新しい規格であるC# 3.0の主要機能についても解説を行います。

約 250 ページとコンパクトな本ですが,多くの部分に著者の地道な調査の跡を見ることができました.本書の行間には,実際に開発現場で直面する様々なトラブルや議論が,数時間から数日,あるいは数年かけて書籍や Web を彷徨いながら,徐々に方法論として固まってきたというストーリーを感じます..NET が登場して何年もたった 2009 年だからこそ現れたように思える本でした.
惜しむらくは各ノウハウの情報源に関しても詳細なリファレンスが付いていればというところでしょうか.とはいえ Web のあちこちに情報が偏在するような昨今ですので,リファレンスを付けたとしてもひたすら URL のリストが続くだけとなっていたかもしれません.本書が扱っているのは,そういう,本来まとめにくいテーマです.まずはこうして現場のベストプラクティスが,書籍の形で確かに形式化されたことを喜びましょう.

P.S. 本書の表紙には ALMA 提供の写真が使われています.ALMA の建設に携わっている方に以前お話を伺ったことがあったので,妙なご縁を感じてしまいました.

書籍紹介: Windows デバッグの極意

アスキー・メディアワークスの嘉平さんより献本頂きました.

Windowsデバッグの極意 ツールを使いこなして、バグハント!

Windowsデバッグの極意 ツールを使いこなして、バグハント!


内容の方ですが,まさに Windows アプリケーションに携わる人なら必携の一冊.
私自身,長いこと Safari Books Online の本棚に原書の『Advanced Windows Debugging』を積み続けていたので,今回の邦訳はとてもありがたいです.Safari のアカウントをお持ちの方はそちらでちら読みして買うかどうか決めるのも良いでしょう.
個人的にはとりあえず買って手元に置いておくことをお勧め.定額給付金で余裕でおつり来ますしね.

宣伝コーナー再び

すみません,月末ごろまで Windows 7 β 記事は書けそうにないです.時間が全然無い訳じゃないのですが,一旦そっちのゾーンに入ってからこっちのゾーンに戻る時間まで考えると多分無いよねーという状況.なわけで色々終わるまで封印します.ダウンロードだけはしたんですけどね.もうしばらく死線を彷徨う日々が続きます.
というわけで困ったときに宣伝コーナー.今月は洋書二冊.

Windows Internals 5th edition

Windows® Internals, Fifth Edition (PRO-Developer)

Windows® Internals, Fifth Edition (PRO-Developer)


なんかもう年単位で出版を待っている本ですが,今回こそは発売日を信じて良いのなら来月ついに出版のようです.Windows 7 を知る上でもきっと役に立つはずの一冊,この機会に是非是非.

Sysinternals Inside Out

Windows® Sysinternals Administrator's Reference (Inside Out)

Windows® Sysinternals Administrator's Reference (Inside Out)


ついでに発見したのがこの一冊.何の本かさっぱり分からないのですが,タイトルと著者からとりあえず予約してみました.
発売までまだ数ヶ月ありますが Amazon さん曰く「予約商品の価格保証」対象商品だそうで,円高に感謝しつつ今のうちに予約しておくのもありかなと.

宣伝コーナー

Windowsダンプの極意 エラーが発生したら、まずダンプ解析!

アスキー改めアスキー・メディアワークスの嘉平さんから頂いてしまいました.ダンプ解析の本はちょうど読みたかったところなのでとてもありがたいです.ダンプと言えばいくつか書きたいネタがあるので,いずれ本書を引きつつ改めて紹介させていただきたいところ.

Windowsダンプの極意 エラーが発生したら、まずダンプ解析!

Windowsダンプの極意 エラーが発生したら、まずダンプ解析!

The Root of .NET Framework

荒井さんの .NET 解析本.微力ながら協力させていただきました.CLI の規格票の副読本におすすめです.

The Root of .NET Framework

The Root of .NET Framework

cloudphobia

15 年来の友人制作の横スクロールシューティングゲームがついに完成.今月中旬からダウンロード販売が始まります.
http://www.dwahan.net/Marsbound/cloudphobia/:image:large
http://youtube.com/watch?v=DRyPqyrZbR0
2 面までの体験版も公開中.体験版でもネットワークランキングに参加したり,上位プレイヤーのリプレイを観賞したりが可能です.
つづきは Marsbound へ.

なんで Advanced Windows の(原書の)電子ブック版は無くなったの?

Advanced Windows 第5版 上』『Advanced Windows 第5版 下』で思い出したけど,昔これらの本の原書には電子ブック版が存在した.今は無い.なんで無くなったかというと,

みんなが Web にアップロードしたり,ひどいケースでは勝手に販売したりしたから

だとか.Jeffrey と Microsoft Press の間で話し合って結局やめることにしたらしい.

Many readers have asked me if an electronic version of my book is available. Unfortunately, the answer is no and there are no plans to make one available. Some older versions of my book were available in electronic form but Microsoft Press and I discovered that many people took the file and posted it on the web. Some people even sold the files which they clearly had no right to do. So, we decided to stop offerring my books in electronic form. It is sad that a few bad apples spoil the bunch.

まあ正直,電子ブック版を出す時期が早すぎたという気もする.

Windows via C/C++ (Advanced Windows の原書) をオンラインで読む方法

上のエントリのコメント欄で O'Reilly の Safari が挙げられているけど,先ほど私が見た限り Safari に Windows via C/C++ は存在しない*1
じゃあやっぱりオンラインでは参照できないのかというと,実は books24x7 で電子化されている.books24x7 も Safari 同様,大量の蔵書をオンラインで閲覧したり,オフラインで参照するための一時コピーを取得したりできるサービスだ.といいつつ私が使っているのは books24x7 の仕組みを使って Microsoft Press に特化した『E-Reference Libraries for Microsoft Press』の方なので,books24x7 本体の方に Windows via C/C++ が含まれているかはよく知らない.
ちなみに個人で購読する場合の E-Reference Libraries for Microsoft Press のお値段はこんな感じだ.

Library type Per seat Equivalent to
Desktop US$49.99 per year US$4.17 per month
IT Professional US$149.99 per year US$12.49 per month
Developer US$149.99 per year US$12.49 per month
Complete US$249.99 per year US$20.83 per month

もちろん,勤務先の会社や大学の図書館が加入しているというケースも考えられる.心当たりのある方は調べてみると良いだろう.
他にも,学会やらアワードやらを経由して,Safari や books24x7 を使えることがある.
たとえば Microsoft MVP には books24x7 購読料の割引と,E-Reference Libraries for Microsoft Press の購読権が提供されている*2
ACM 会員向けにも books24x7 や Safari の蔵書から関連図書が提供されているようだ.現在提供中の本のリストには,Windows via C/C++ も含まれている*3

*1:Microsoft Press の本でも提供されているものはある.Windows internals 4th edition とか

*2:[http://masteringsharepoint.com/blogs/bobmixon/archive/2008/07/14/microsoft-press-books-24x7-e-reference-library-subscription-discount.aspx:title=]

*3:ということは books24x7 本体でも Windows via C/C++ を読めそうではある