Programming .NET Components
One day, I stumbled upon the mono and Portable.NET projects, which are trying to bring all the .NET stuff to the penguin platform. This was the main reason that convinced me to learn more on .NET: open specs, a component-enabling technology, the cross-platform mirage, a completely new (well, sort of) set of concepts to be grasped, and something which I could use both on Linux and on Windows.
Armed with these expectations, I decided to look for a good introductory text on the .NET framework focused on components development. Among the plethora of publications on the subject, I decided to stick with a publisher having a long and respectable tradition in Open Source related books. Among the herd of funny beasts that populate O'Reilly's catalog, I picked out a "land hermit crab," aka Programming .NET Components, by Juval Loewy.
Overview The book begins with a chapter giving a rationale behind component-oriented programming versus object-oriented programming, that is, interfaces versus inheritance. The second chapter shows how those concepts are reflected in the .NET Framework, briefly introducing the Common Language Runtime (CLR), the Intermediate Language (IL) and .NET Assemblies. The following three chapters deal with interface-based programming, objects lifecycle management and versioning, gradually introducing the underlying concepts and showing how they become concrete in the .NET framework (more specifically, by using the C# language). No formal introduction to C# language constructs is given, but if you are familiar with C++ or Java you will be able to follow the code snippets fairly easily.Events and asynchronous code execution are the subjects of Chapters 6 and 7, respectively. While the former is just a quick introduction to the C# approach to delegates and events (yet useful if you are new to the matter), the chapter on asynchronous calls is much more substantial. The mechanics behind async calls are explained, together with pros and cons of using callbacks, BeginInvoke() and EndInvoke() calls, one-way methods, and so on.
Chapter 8 is devoted to Multithreading and Concurrency. Commonplace concepts like threads application and usage are explained, as always dressed with a bit of C# syntax. While such concepts are easily found in any multithreaded programming tutorial on the Internet, explaining them from the basics never hurts -- and prepares the reader to the most insidious traps of multithreaded programming. Synchronization appropriately takes a fair part of Chapter 8: automatic and manual synchronization provided by the .NET runtime environment are explained, together with the concepts of contexts and synchronization domains. This part is quite interesting, since it delves into .NET specific concepts which are quite new to programmers who had a happy Microsoft-less childhood (though they might not be so new to people who speak COM fluently). Other .NET threading related services (such as timers) are presented at the end of the chapter.
Chapter 9, devoted to object serialization and persistence, describes how live objects can be transformed (formatted) into a stream of bytes to be sent over a network channel, or stored on a persistent storage medium. This chapter lays the grounds for the exacting chapter on remoting, which follows immediately. Chapter 10 is the longest and most content-rich chapter of the book: first, the entire story of native processes, .NET app domains and assemblies is told. After reading it here, it won't look so confusing as before. Then, objects marshaling, remote callbacks, synchronization and activation modes are described, including client and server activated, single-call and singleton modes. Afterwards, the author gets to a global overview of the .NET remoting architecture, its basic building blocks (like proxies, transport channels and call dispatchers) and working mechanisms (like type registration and environment configuration). A reprise on objects sponsorship and leasing closes the chapter and completes the discussion on objects' lifecycle left pending in Chapter 4. Chapter 10 offers a lot of interesting cues, but unfortunately cannot dig deeply enough in the subject (after all, this is not a book on remoting). Many people (including Juval himself) recommend Ingo Rammer's Advanced .NET Remoting (APress) to learn more on the topic, but I have yet to get my hands on it.
Chapter 11 reprises the description of contexts in .NET, this time focusing on calls interception. The whole interception architecture is described with a fair level of detail and, as always, in a clear and understandable way. Context-agile and context-bound objects are described, as well as .NET and custom component services. While reading this chapter, you start understanding that contexts, app domains, call interception and remoting are tightly interwoven and that their full understanding is the real key to the exploitation of the .NET platform potential. Unfortunately, this is where the book leaves you alone -- but I strongly suspect that a full coverage of these topics would have required an entire book on its own.
The last chapter of the book deals with the .NET Security architecture, introducing the concepts of permissions, code groups and policies. Security administration is explained, both from a system configuration and a programmatic point of view.
What's to like What I liked most is the straightforward approach of the author in introducing the rationale behind components, components-based programming and their support in the .NET Framework: each concept is walked through step-by-step, instead of being presented in a complete working example with little or no explanation. Hence, you won't get working code on page 3 of the book -- instead, you will gradually learn how to write some.
Indeed, I found the description of awkward concepts like asynchronous calls, multithreading and remoting very clear, even for someone with no previous experience with .NET and C#.
I also consider a plus the broad experience the author has in the field, which shines through the many programming hints given, and in lots of references to concepts in COM which have an homologous in .NET.
I finally found the book to have the right balance between printed code and text (that is: do not fill hundreds of pages with code, I'll look at it online).
What's to consider Programming .NET Components is just an introductory book: it points you in the right direction toward components programming with .NET, but does not bring you very far. If you are really serious about learning .NET advanced topics, you will need a more specific tome to complement (or substitute for) this one.More specifically, the 70 pages which cover remoting are just an introduction to the matter. The same applies to some of the most important concepts revolving around .NET (app domains, contexts, and the like).
Finally, despite the subtitle ("Design and Build Maintainable Systems using Components-Oriented Programming"), be warned that this is not at all a book on software design (components oriented programming is covered in just 15 pages).
The summary Reading the book goes without a glitch, thanks to a smooth writing style and a very structured approach to explaining concepts. Still, when I turned the last page of the book I felt that my understanding of components within the .NET platform was far from complete..NET Components Programming is quite fair to its title: it will teach you how to program components by using .NET constructs, but (apart from some quick notes here and there) it will not provide extensive coverage of components oriented design and development. If you are already familiar with .NET concepts and are looking for something shedding light on components programming, this book will not help you significantly. On the contrary, if you know something about components and want to start developing them into the .NET Framework, this will surely be an interesting read.
Table of Contents
Preface
Chapter 1. Introducing Component-oriented programming
Chapter 2. .NET Component-oriented Programming Essentials
Chapter 3. Interface-based Programming
Chapter 4. Lifecycle Management
Chapter 5. Version Control
Chapter 6. Events
Chapter 7. Asynchronous Calls
Chapter 8. Multithreading and Concurrency Management
Chapter 9. Serialization and Persistence
Chapter 10. Remoting
Chapter 11. Context and Interception
Chapter 12. Security
Appendix A. Interface-based Web-services
Appendix B. Custom Security Principal
Appendix C. Reflection and Attributes
You can purchase Programming .NET Components from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.
This article from earlier today explained it all
The lack of starndardized libraries. KParts, Bonbobo, XParts, DCOP, XUL, OpenOffice are all competing technologies. No one component model for linux. Wan't the KHTML part to display a webpage in your gnumeric spreadshit? No, you can't do it yet.
I just hope the proposed Xembed standard gets implemented soon, or Linux will be screwed on the desktop for a while
Why anyone would say DCOM is more graspable than J2EE is IUnknown
Finally, someone that at least indirectly acknowledges that Microsoft oriented programming is at least worth reading about. I am like many people who read slashdot in that I think Microsoft doesn't play nice in the industry, but they are, like it or not, the de facto standard out there.
Nuttles
Christian and proud of it
I have always admired Microsoft's COM architecture and the relative simplicity that allows you to reuse already installed components
"Simplicity" is probably the one word you can't use to describe that nightmare called COM. COM makes programmers jump through hoops to achieve what plain vanilla C++ (mostly) already provides. Anyone who has ever tried to do a large project using COM (no, that little DirectX Tetris game doesn't count) can attest to the pain and suffering the architecture inflicts on those unlucky enough to have to use it.
umm, his comment was And I have always been fascinated by the distributed nature of DCOM, which seemed to me much more graspable than complex monsters like CORBA and J2EE.
.NET remoting is an attempt at a compromise between those two (caveat: I haven't done a lot with it), we'll see how it works out.
DCOM, can, indeed be a mess when things go wrong. Show me a dcom programmer who doesn't know how to use dcomcnfg fluently and you're probably looking at someone padding their resume. But so can EJB's (want to see our organizations Oracle TAR's on EJB context lookups? There are many... and you have no clear idea to track down the problems).
I think
DO NOT DISTURB THE SE
No technology is trying to become Cold Fusion. .Net is trying to become Java, and so is Java, but no one in their right mind wants to aspire to be an evolutionary dead end like CF. Macromedia (who now one CF) are slowly migrating all CF to J2EE and will kill of CF.
this is getting old and so are you
blog
Heheheh As a computer programmer myself, I tend to like to see everything that exist in the world. I don't care if it's made by the evil monopolistic giant or not.
.NET goes (while we're on the subject), I think it's ... mmm ... nice ... Too big, too bulky, I prefer J2EE to .NET 10 folds. I choke and puke every time I see some small nibblets of C#, that aberration of a language. But it's intersting to know how it works and how to code anyways.
Like the reviews author says, I find COM concepts very easy to grasp and quite interesting. Compared to CORBA, it is indeed very easy to use.
As a hacker (someone who likes to know how it works), I find that very interesting. As someone who code for Mac and Palm, I find I can apply many concepts of COM to my code and make it object-portable.
As far as
By the way, LMAO yes hell is all frozen I think. What the heck, M$ coding book ? EEEK!
Mike
Before making any knee-jerk comments regarding the post, take a moment to ponder over these pearls of wisdom from none other than the great Morpheus, which are very relevant in this context. Take heed and realize that the poster is but part of the system. Forgive him.
"Microsoft Windows is a system, Neo. That system is our enemy. But when you're inside, you look around and what do you see? Businessmen, Teachers, Lawyers, Carpenters...the very minds of the people we're trying to save. But until we do, these people are still a part of that system, and that makes them our enemy. You have to understand, most of these people are not ready to be unplugged from Windows. And many of them are so innerred, so hopelessly dependent on the system that they will that they will fight to protect it. Are you listening to me, Neo? Or were you laughing at the stupid MSN fairy again?"
An Indian-American Hindu committed to non-violent thought/speech/action alarmed by the global explosion of radical Islam
> I haven't see a single computer that runs Linux or any other alternative
> at any of my friends house.
I havent seen a single black man at any of my friends house. So they simply do not
exist.
DO NOT PANIC
Microsoft doesn't play nice in the industry, but they are, like it or not, the de facto standard out there.
Microsoft may be the defacto standard for client side apps. But on the server side it holds no such title, and enterprise development is supposed to be what DCOM is all about. Things like J2EE and CORBA have way more of a hold on enterprise development than anything that Microsoft has ever put out. There's a big difference between a single-user desktop operating system and a multi-user scalable enterprise platform. From what I've seen, Microsoft has only been sucessful with the former.
And upon reading your comment, I realized I was reading a statement by an unqualified critic.
.Net is largely the latest kludge slapped on top of COM/DCOM to try and hide it's hideous complexity. The programming community should wake up and see the obvious fact that Java provides everything that .Net provides, but in a platform neutral and sane manner. It even works great on Windows. (And for those of you that would bring up Mono - we'll discuss that again the day that Microsoft sues for patent infringement under the DMCA.)
.Net is not a kludge slapped on top of of COM. It is a platform created from the ground up to replace COM, among many other things. Many of the .Net APIs do call upon various services implemented in COM. But that is only because Micrsoft has not had the time to port that code to managed .Net code. I will agree that Java and .Net provide many similar services, they have more things in common than differences. However there are some things Java does better, and there are some things that .Net does better.
In fact,
No,
And your statement about Mono? How on earth does the DMCA relate to patent law? It is called the Digital Millenium Copyright Act.
Understanding the ins and outs of J2EE is not the hard part of enterprise development. Understanding things like async messaging, transactions, and multithreaded logic are what makes enterprise development difficult. Switching to .NET because you don't 'get' J2EE will not magically make you understand these complex ideas.
.NET examples, then fine. But it's not learning the particular technology that's the hard part...it's learning the theory that drives it.
If this book does a better job of explaining those concepts using
I don't really understand your comment.
Look: my company designs transactional web processing applications.
In 1996 we built a portable transaction monitor that is used today in several very large web applications that run on Linux. The entire TP monitor is only several thousand lines of C, the applications are extremely simple, and it all works beautifully.
In 1998 we were asked to make something very similar, but using MTS and COM+. The animal works, but it is incredibly complex, slow, unstable, and frankly impossible to control totally. When we approach the limits of the system in any sense, it collapses, and we cannot do anything to discover why.
It's not about Windows vs. Linux, this is a stupid misdirection on your part. COM is not simple, it is a mass of layers which can be simplified with the appropriate packaging (as can any technology), but which remains complex, slow, and unreliable at the core.
Now explain once again why I personally am part of the reason for what exactly? Or HIBT?
Ceci n'est pas une signature
first there's an article touting the benefits of COM+--i disagree, but it's your opinion--then, when i go to read it, there's a windows server 2003 ad at the top of the screen
!(^((ri)|(mp))aa$)
You know, every once in a while someone makes a really stupid comparison between the people who were responsible for the murder of millions of human beings, and something incredibly trivial like using the "wrong" type of software. And it really pisses me off.
Yes, I have a sense of humor. No, this isn't funny.