Slashdot Mirror


Essential .NET, Volume I

hmobius writes "In a world where developers are baying for customers' attentions, very few people can claim to command that of the developer. Their blogs may be the only clue to the higher level of thinking that they operate at, creating the answers to why and when code works in addition to the perennial how. Whether he likes it or not, Don Box is one such system-meister. He may dislike writing books, but when one comes out, people pay attention and read. His first foray into text, Essential COM, was the book to explain how COM worked, and his latest, Essential .NET, takes the .NET Framework's Common Language Runtime (CLR), and does exactly the same." Read on for the rest of hmobius' review. Essential .NET, Volume One author Don Box with Chris Sells pages 400 publisher Addison Wesley rating 8/10 reviewer Dan Maharry ISBN 0201734117 summary Great in-depth look at the CLR, but not for developers aiming to better their skills.

After chapter one's history of the evolution from COM to the CLR, the book takes a bottom-up approach to the CLR, starting with a deep and detailed six chapter look into the core elements of the platform. Chapter two begins with assemblies, the programmatic units in the CLR, and the implications of their construction. We learn how they are versioned, loaded and built, and why therefore they may be written in as many .NET languages as required. There's real depth to the material here -- you really do touch the bottom of the abyss, so to speak -- but it's countered with occasional levity that keeps this a readable book instead of a dense reference manual. The same is true of all the text. To wit, there's even some irony; "To allow old dogs to avoid learning new tricks, there is finalization," he declares in the next section on the Common Type System.

It's here that we discover how different types and interfaces are distinguished from themselves and from one another, and how their variations and relationships are kept separate by the CLR. It's refreshing to note that the proverbial big picture is never very far away from the commentary. After taking time to explore the avenues for types and interfaces, Box notes that types themselves aren't very interesting until you start working with instances of those types, and we're off again working through another thirty pages on how object instances preserve a sense of identity, how they are cast into other types and how they incorporate themselves into the concepts of reflection and metadata. Only then do we look at the actual lifecycle of an object, its creation, modification and disposal. The attention to detail is great, and there's little ambiguity in the text, but with that comes a slowness to this section that may leave readers frustrated.

One recurring theme of the book is the idea that while there is a very proper way and set of rules for doing things, there will always be circumstances in application development which call for exceptions to be made to those rules and made possible by .NET. This is true at a small scale and, as chapters six and seven prove, at a large one too, covering as they do how the CLR calls and runs methods first on a single machine and then over a wire. How does the runtime treat methods called explicitly, implicitly through a delegate, asynchronously, or as a combination of the three? How do remote calls and types bridge whatever gaps they must cross and activate the remote objects and methods they're targeting? The answers are here.

Essential .NET reflects Box's pride in .NET and also his slight dissatisfaction with it. You can sense that while he knows .NET version 1 is an improvement over COM, it's not as good as it could be and things are still be done in v2 and beyond. Chapter eight's look at AppDomains and in particular its discourse on threading within and through AppDomains is a good example of this. Meanwhile, we finally come full circle in our investigation of the CLR, seeing how the assemblies we built in Chapter 2 are resolved and executed within AppDomains. Exceptions to rules being included, we also see how objects references are marshaled across AppDomains for inter-application communication if this is required.

The last two chapters look at wider topics around the CLR in as much detail as they can for topics which have entire books dedicated to just them. Chapter nine covers code-access security and chapter ten topics which are not of the CLR but which be can be addressed from within a .NET application: explicit memory management, using p/invoke to import COM methods from DLLs and so on. Both are concisely written and to the point, but unsurprisingly leave you feeling like there's more to these topics than is covered here. Chapter nine is a great and clear introduction to code-level security, for example, but you'll get a lot more out of Michael Howard's book, Writing Secure Code if you want to know more.

Essential .NET isn't an easy read but everyone should try to read it at least once. Focusing on the CLR itself and how it deals with the components of an application means that it truly is aimed at the community of .NET developers as a whole (including those building and using alternate implementations of the CLR). The provided code examples are expressed in C#, but this is incidental, really, and won't stop VB.NET, J# or any other developers getting a great deal out of this book.

This is a dense, complex volume that requires a fair amount of effort to understand and use, and to some extent this may put people off. On the other hand, it is so packed with great nuggets of information that they may be inspired to keep reading. Of course, there is the question of whether this book will actually improve your .NET development skills, but in riposte, you can honestly say that no volume details the CLR and its potential so well, and that this alone is worth the book's cover price.

You can purchase Essential .NET, Volume One from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

12 of 286 comments (clear)

  1. Re:No interest by Tablizer · · Score: 5, Insightful

    nobody on Slashdot gives a RATS FUCKING ASS about fucking Winbloze shit!

    I don't like many aspects of the Microsoft Way either, but MS projects pay the bills better than OSS projects for some reason for me. If I was well-to-do, I might subsidize my slide over to OSS. But the tech economy is a wreck right now and I take what I can get. The demand for .NET is slowly growing, for good or bad. If you want your family to starve to serve the OSS cause, go ahead. But, I wanna eat, dude. the 90's are gone. It is grovel time.

  2. No more spoilers in the reviews! by Anonymous Coward · · Score: 5, Funny

    Some of us had no idea CLR was going to replace COM. We all wanted COM to die a horrible death and now you've ruined the surprise. On top of that, you give away the fact that .NET is the first of a series. I suspect we won't get a real ending, but a cliffhanger that guarantees we show up for the sequel.

  3. Don't Flame So Fast by RealisticWeb.com · · Score: 5, Insightful

    Before everyone starts scoffing at how much Micro$oft sucks, I just want to say that .NET is really the best product that MS has produced in a very long time. And when I say .NET I am referring to both the object library and the .NET server.
    I'm with the rest of /. when I say that I would rather be on a UNIX based platform, but like many of you due to my job I am forced to deal with a Windows Server environment if I like it or not, and as much as I have tried to hate it, I have actually been quite impressed with what you can do with Visual Studio and .NET
    When you write a .NET web application you use the same code (meaning VB.NET, C# etc, as opposed to ASP, or VB Script) that you would use when writing a desktop app, and the fist time the page is accessed, the web server compiles all the code into dll's on the fly. Converting my existing ASP apps into .NET has tripled the performance using the same hardware. This method is very very fast. Fast to develop and fast to benchmark. It would take me months to write a C/C++ cgi app to do the same thing that I can pump out in an afternoon with VB.NET. And more intuitive I might add.

    Go ahead and flame me now.

    --
    Sigs are out of style, so I'm not going to use one...oh wait..
    1. Re:Don't Flame So Fast by JeanBaptiste · · Score: 5, Informative
      When you write a .NET web application you use the same code (meaning VB.NET, C# etc, as opposed to ASP, or VB Script) that you would use when writing a desktop app,


      I also like .NET, it is the first good thing they have put in a while, it beats the hell out of COM...
      but your statement is not quite correct, unless I am not fully informed which is definately a possibility.... I have been finding more and more differences between programming for .aspx versus a standard desktop application... Still it beats the heck out of VS6...
  4. Re:Essential .NET? by tempny · · Score: 5, Insightful

    Jeez, as a technical community can't slashdotters resist making dumb jokes that have been made millions of times before and actually pay attention to the content of something that could be relevant to many of us? I want to see a first post that's not an easy and bad joke for once.

  5. Event Based Page Model by Anonymous Coward · · Score: 5, Informative

    The big difference between the ASP.NET paradigm and that of, say, Java Servlet Pages, or XSP, etc. lies in the event-based nature of ASP.NET pages.

    Each ASP.NET page is an instance of the "Page" class, or one of its sub-classes. The "Page Lifecycle" defines the various phases that apply each time a page is accessed. The "Page" is simply the top-level node in the "control tree", and each control in the tree does the following for all its children (recursively):
    1. initialization
    2. handle postback data
    3. state management
    4. handle events
    5. pre-render stuff
    6. render to HTML (or whatever)
    7. clean up

    Most of your code will pertain to numbers 4 and 5 above, if done correctly.

    It's not immediately intuitive, coming from a Web App developer's perspective, but does provide a good general structure and mechanism.

    In addition, each Page is split into its actual class (the so-called "code-behind page"), and its representation as markup (the .aspx page). The .aspx page is parsed on each request, but the code-behing is pre-compiled.

    ASP.NET provides a robust programming model for web applications, but it also provides a lot of built-in mechanisms for doing common stuff. Authentication, Authorization, Caching, DataBinding, XML, conditional rendering, templating, data access through ADO.NET, internationalization, Debugging and Tracing utilities, and more.

    That said, I find the event-based programming model quite difficult to master. If used improperly, you can end up running the same code many times; for instance of you populate a given control (say a dropdown) from a database, and do so in response to many different events. Better to flag things and then fetch just once from the DB prior to rendering.

    Thoughts?

    PS: At the moment, you can't mix multiple languages (C#, VB.NET) within a single Web App.

  6. Java is also in trouble by 73939133 · · Score: 5, Interesting

    The only Java implementations you can get are all based on code licensed from Sun. With the JCP, Sun stifles innovation and progress. And Sun holds numerous patents on Java technologies, making it unlikely that the platform will ever be truly open. With so much control over Java, it is particularly worrisome to see Sun's market evaporate--Sun is a company on the way down, and the question is: what will they do to/with Java before they hit bottom? An SCO-like scenario involving Sun, IBM, and open source implementations seems entirely plausible.

    Both Java and .NET are attempts by two big competitors to establish new proprietary platforms and to do an end-run around open source systems like Linux. If a large fraction of the software on Linux were done in Java, for example, Sun could basically give their own platform an advantage by tinkering with the Java-on-Linux implementation.

    The solution? Don't use either. Mono may be a way out because, in addition to a .NET compatible set of libraries (which you shouldn't use and which may be encumbered by patents), it is getting its own, native set of APIs.

    But if you want to avoid the issue altogether, just don't use either Java or C#--there are plenty of good alternatives around. In fact, most software these days should probably be written in languages like Python, with a few core C/C++ libraries for numerical and other high-performance subroutines.

  7. Isn't imitation the sincerest form of flattery? by dot+niet · · Score: 5, Insightful

    I'll take umbrage with the kneejerk "Java has been doing this for years" comments. Must every idea be so mind-bendingly unique to be deemed useful? Should we all start buying Ford Model-A cars instead of Durangos (or whatever) because Henry Ford "was doing that 100 years ago!"? Are the CLR-based language features a lot like Java? Yes. Should every derivative product be denounced as coming to the table too late? I think not. Once more, .NET ( the bits for developers anyway) brings some better things to the table as well (as evidenced by Sun getting into the leapfrog game with Java v.Next features - Metadata (Attributes), etc).

  8. Re:No kidding by dubstop · · Score: 5, Funny

    very few Slashdot submitters or editors show basic competance

    That would be competence.

  9. Good book. by miguel · · Score: 5, Informative

    This is one of the best .NET books, the first of a series of pretty good books, by those involved deeply with the framework.

    This book covers the technicalities in the .NET framework, and is of special interest if you are interested in the advanced features of the Common Language Runtime like method interception, transparent proxies, application domains and metadata.

    Compiler writers, framework developers and those who need to get the most out of the framework will be interested in this title.

    I can not recommend this book enough. Don has done a fantastic job. It helped the Mono developers understand the low-level technical features of the framework.

    Miguel.

  10. Re:It *is* cross platform! by miguel · · Score: 5, Informative

    Mono is an implementation of the ECMA 334 and 335 standards which are available for anyone to implement (no patent strings attached, check the Mono FAQ for details).

    On top of that Mono implements plenty of class libraries: both the non-standarized class libraries from Microsoft, as well as our own universe of class libraries that take advantage of Unix-specific features.

    Here is a link: Mono Map (abridged).

    Miguel.

  11. Re:Essential Mono by miguel · · Score: 5, Informative

    Various publishers are working on books about Mono that will cover exactly what you want.

    But everything you learn in Don's Essential .NET book applies directly to Mono. In fact, before Don joined Microsoft, he was kind enough to let us preview his book, and that helped us understand various internals of the .NET framework.

    Miguel.