icelava.net

why be normal?
Welcome to icelava.net Sign in | Help
in Search

Review: CLR via C# , 2E

Last post 07-30-2008, 3:02 by icelava. 0 replies.
Sort Posts: Previous Next
  •  07-30-2008, 3:02 4234

    Review: CLR via C# , 2E

    Possess a driving license? That probably means you know the mechanics that makes cars work. Thereby the skill necessary to ferry ourselves to and from places in daily life.

    Wait, what has this gotta do with reviewing a technical computing book?

    Well, you knew incorrect air pressure worsens tyre grip, accelerates wear & tear, and reduces fuel efficient, right? You knew improper engine tuning may lead to unsynchronized valve and spark plug timings, resulting in severe loss of power, right? You knew air bubbles in brake fluid can result in inconsistent application of brakes and uneven deceleration, right? Ah, so many important factors of physics revolving around the science and engineering of motoring. Yet so subtle and unknown by the vast majority of motorists. And ignored. Never realising what performance-leaking sins they commit against their cars.

    This very book will expose the fact that you are effectively guilty of the same level of ignorance with the .NET CLR as you go about your daily programming work.

    There are tons of titles covering the use of technologies and frameworks that build on top of Microsoft's .NET Framework. By and large they are fine, fulfilling the needs of developers as they work on the real purposes of their jobs - delivering beneficial (or entertaining) value to users and industries. But so few step into that deeper realm to discuss the very thing that makes this all possible. The very heart of the .NET framework, at its core, the mighty execution engine known as the CLR. Jeffery Richter takes a different approach by removing the shroud of magic surrounding the CLR and the C# compiler, exhibiting the internals and explaining all the little crucial activitites it does behind the scenes so that programmers can carelessly forget and not bother.

    He organises the book into five parts and twenty four chapters of excrutiating detail:

    • Part 1 CLR Basics
      • Chapter 1 The CLR's Execution Model
      • Chatper 2 Building, Packaging, Deploying, and Administering Applications and Types
      • Chatper 3 Shared Assemblies and Strongly Named Assemblies
    • Part 2 Working with Types
      • Chapter 4 Type Fundamentals
      • Chapter 5 Primitive, Reference, and Value Types
    • Part 3 Designing Types
      • Chaper 6 Type and Member Basics
      • Chapter 7 Constants and Fields
      • Chapter 8 Methods: Constructors, Operators, Conversions, and Parameters
      • Chapter 9 Properties
      • Chapter 10 Events
    • Part 4 Essential Types
      • Chapter 11 Chars, Strings, and Text
      • Chapter 12 Enumerated Types and Bit Flags
      • Chapter 13 Arrays
      • Chapter 14 Interfaces
      • Chapter 15 Delegates
      • Chapter 16 Generics
      • Chapter 17 Custom Attributes
      • Chapter 18 Nullable Value Types
    • Part 5 CLR Facilities
      • Chapter 19 Exceptions
      • Chapter 20 Automatic Memory Management (Garbage Collection)
      • Chapter 21 CLR Hosting and AppDomains
      • Chapter 22 Assembly Loading and Reflection
      • Chapter 23 Performing Asynchronous Operations
      • Chapter 24 Thread Synchronization

    Take a good look at this list topics, and honestly ask yourself if you know everything about how the CLR facilitates all these? Most approach the CLR as a black box - I knew myself to be one - and in result only knew what was sufficient to work with it, which in turn developed quite a number of misconceptions about it. Jeffery Richter goes through chapter by chapter and puts me through a constant pace of surprises, shocks, and pure enlightenment. He goes as low a level as the CLR can operate, and communicates in terms of memory locations, CPU registers, and gives the repeated impression that many of the CLR automated activities we take for granted has a performance cost. The material he writes about are astounding and sometimes downright shocking. It goes an extremely long way to remove whatever misconceptions you may have about the CLR or compiler, influencing you to rethink about many of the habits and practices you have now.

    Challenge some examples. Just a small number of matters. Did you know C# constants are really only good for referencing within its own assembly? Any referencing and use of constants in other assemblies are hardcoded at the MSIL level. Do you know the exact garbage collection sequence the CLR takes to identify generations of orphaned objects and housekeep the memory? What does it take to resurrect an object from the Freachable queue? Why are finalizers generally not recommended? How would you compare strings with the added dimensions of encoding and globalization cultures? How do you construct strings and convert types to and from strings? What are the implications of unboxing a Value-type object from a Reference-type variable and assigning values? Did you know an assembly need not necessarily be just a single .DLL file? How does the metadata for your types turn out in the assemblies as the compiler emits the IL equivalent of your code?

    Each chapter brings to light information you never knew you needed to know. As much as possible, Jeffery Richter provides code samples and programs to demonstrate his points and prove the effect. He not only provides the information, but lists many alternative ways to achieving a said effect, along with pros and cons for each method. He is here to explain, not to sell the CLR, and does not hold back on what he honestly thinks are design flaws by Microsoft. At almost every junction, you will feel vulnerable by the knowledge he passes to you. If you ever felt snotty and arrogant over your knowledge of the .NET Framework, this book is the antidode to humble yourself. If you ever positioned yourself to learn more about .NET, you will surely rejoice with gladness.

    For all the great depth to be had throughout the book, a topic that I found notably absent is how the CLR actually performs interoperability with unmanaged layers in the OS. There is only a brieft touch on it in the first chapter. The WIN32 and COM platforms are still cornerstones of Windows development; it would have been ideal for developers like myself who began development after the advent of the .NET Framework.

    Even then, this is one book you'd repeatedly refer for years to come to double check you don't commit another subtle mistake. By the time you are half way or perhaps even a third way through this rich material, you would have understood the term "managed code" is a literal description and not a marketing buzzword at all.

    Overall rating: 10/10
    Yes In-depth tour under the hood; shocking revelations; you were wrong, and will rethink;
    No No true chapter and detailing of P/Invoke and COM interop mechanics; seriously, why is this not in the SDK?

    Amazon review

    Filed under: ,
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems