Introduce the book of several COM (Han Shaoi) (on)

zhaozj2021-02-08  442

Introduce a book of several com

Han Shaoong

The most effective way to get knowledge is to read, of course, read the book. It is no wonder that the ancients will be called "Reading".

introduction

In fact, writing some articles introducing computer books is my long-lasting wish. On the one hand, since my friends often make me recommend some practical use of practical books, on the other hand, I am not very smooth in my earlier, I don't know if I have mixed "bustling" in the bookstore. . As a result, the heart is coming, as long as I feel almost, I bought it! As a result, I bought a lot of books that I didn't have to buy, and wasting money and wasted time. The year is, and there is some opinion on the computer book market, and some feelings have been produced.

Most people are not sages, so they often have praise, but it is difficult to accept criticism. Many of my friends worry about my safety and advise me to say more. But the book is very inferior, and if there is a falsehood, it is inevitable that the truth is inevitable. So we met a "security policy": "Yang Shan" is dominated, after detailing a good book, it will make a few shortcomings, I will accept the author and the publishing house will still accept it. As for some irresponsible publications, I only say phenomenon, don't mention the name. (Please understand, floating in the world, safety first, safety first.)

At present, the IT industry is competitive, and the market-changing transformation is unpredictable. In order to survive, all people are overloaded by all aspects. When the programmer or manager is very difficult to explore the head from a large pile into a big creation, pick up a long-awaited professional book to enrich his own, they will certainly hope to convert the things in the book as soon as possible. Thoughts, so that this precious and brief buffer period learned more.

But unfortunately, some books are not written for this purpose, and the words are as difficult as the text of the text (maybe some authors feel that only this can only show his horizontal unspeakable, maybe some author will not understand what it is. The content, I have to "shame" with a large pile of clouds. Not only that, but also more terrible phenomena, when computer books begin to show a strong sales momentum, countless "experts", "master" is emerging overnight, all kinds of name "Atmosphere" books, The training makes people look at it, just as many taxis on the street. And don't say what they have, I think, "more" seems to be a much truth that has been verified. I saw the publicity of "Intermet Training" in a badge bar of Beijing University, and it is really a crying.

Nowadays, the shape-colored computer training class has become "a large landscape of IT culture." For this phenomenon, foreigners' comments seem to be more surprising: "In the United States, there is not so much training course, but a primary school students can operate computer." "In China, computer training class is everywhere, but computer The popularity of technology is still a problem. "" China's bicycle, men and women will ride, but have you seen a bicycle training class? If there is a bicycle training class, you are not tired of teach you the wheel diameter of your 'bicycle How long does it, how many spokes, etc., then believe that people who can ride bicycles will be less and less. "Writing book or translation, whether the unprecedented prosperity of computer books indicates that our level is very high? I think it is. Sometimes, in order to solve individual problems to find information, the result is often a waste of time, and I am still losing the feelings of "a big copy of the world". The ancestors of theme and form are very profitable, and I call it "popcorn phenomenon." The allusion is like this: the previous year, the street in front of my family has a popcorn because of the unique family, so the business is booming. But how long, after the rain, the spring bamboo shoots have emerged, and the word along the street is spectacular. Now everyone's business is not very good, but no one has no opinion, but my family is "rice flower fragrance". If the spleen of the Chinese "follow the wind" is the ancestor pass, if the old people put it, if the authors should have some pioneers, calm down, think about it, what is the lack of books? Don't be "human cloud is also cloud". Although it is good to be a teacher, it is not so good, because you have to have a deep understanding of the knowledge telling, and you can use deep-in-depth language to listen to others. The attitude is of course the first, but the sacredness of the book is trampled by many author and publishing house. Some publishing houses regardless of quality, a festival is fast, and the business opportunities have, but fell the brand. A very good English book was translated by them, they didn't look at the horse, they could not see. Since the copyright is sold to them, other publishing agencies have a heartbeat that is powerful. A good book or even a good book is ruined, and the interests of interest is of course readers. In addition to the attitude, there is also a level, the book is not a person can write it. The names of many books in the times are more scary and scary, always reminds me of the street selling Dachi Pills: "As long as I eat my medicine, I can't get into the knife, and I will not be invaded." But in fact, many authors themselves have weak skills, can't write architecture and spirit, so I have a thousand articles that will be teaching everyone to press menu, select command, and the dialog box, press 'OK' ... ". The real teacher is not easy to find However, "Two Knife" is everywhere (just like a singe star with TV channels now, the movie star is dazzling). Plus some publishing houses are not strict, this is caused by personal The phenomenon that can be booked.

Today, I introduce you to the book of COM, I hope to help the army in COM.

Want to learn COM must read books --- "COM technology insider"

Title: "COM technology insider"

English original name: "Inside COM"

Author :( US) Dale Rogerson

Microsoft Press 1997

Chinese translator: Yang Xiuzhang

Tsinghua University Press, March 1999, 1st

Pricing: 50.00 yuan (with CD)

Microsoft Press's "Inside ..." (translated into Chinese is "... technology insider") series books seem to have always maintained unique authority, rarely disappointment. From "Inside Ole" to "Inside Visual C ", it is very popular with readers. "Inside Visual C " said that the extensive extensive model, the language of the master, and the clear ideas make people not yet. However, it may be due to the reason, many people who want to learn Visual C face this thick masterpiece, I am always a little timid, worried that I don't understand myself. Shao Yong believes that as long as you have some basic knowledge of C (with Win32's concept more better), it is not difficult to learn this book, and of course, perseverance is a secret recipe against difficulties. "Inside COM" is also called a rare opportunity. The biggest feature of this book is that the language is relaxed, step-by-step, and it is not difficult to see that the author is really painful. In order to set the "threshold", the author has avoided a lot of difficulties and details of the facts such as type factories, registry in the first few chapters. I don't know if Dale Rogerson is not known as the "advantageous force". " The Enlightenment from the Command of Peng Command in the Korean War. In the arrangement of the sample program, each chapter has one to two procedures independent of other chapters, and the author as much as possible for these programs to be short and complete. On the one hand, it is relatively easy. On the other hand, the reader can put the focus of learning in the demand for COM components, without having to figure out those unnecessary details and complex practical problems in complex examples. In the programming language, the author uses the traditional C language, and does not involve any Win32 and MFC knowledge. In addition to some convenient interface pointers in Chapter 9, there is no template in other parts of the book. class. In short, the author will throw all the cums to make the reader to light up, as long as you have learned the standard C , there is an object-oriented programming basic concept (package, inheritance, polymorphism), you can read this Book.

The first five chapters of the book are very clear, all of which are basic concepts such as components, interfaces, reference counts, interface queries, and DLL, without having to be less courageous. Slightly a bit of a little inadequacy is the following command when establishing a program inside the book:

"CL Client1.cpp Create.cpp Guids.cpp UUID.LIB"

"Cl / Ld Cmpnt1.cpp Guids.cpp UUID.LIB Compnt1.def" and

"Nmake -f makefile".

The problem is, how many people can be very skilled in writing a Makefile file and use the nmake and cl commands? I am afraid I have little. So the reader has to spend a lot of time to ponder the compilation process of the program, take time, pay, do not play food!

Of course, as a scope of principles, these things should still be, but at least should tell the reader how to operate. I took the example of Chapter 5. The first is to establish a component DLL: Because of the VC , we don't have to use "CL / LD" to do it, just need to edit Cmpnt1.cpp, cmpnt1.def and ifce.h After guids.cpp, select an empty Win32 DLL project in the VC integrated environment, add these four files to the project, and CMPNT1.DLL is generated after compiling. Then to build a customer program: Many people often do this: first establish an empty Win32 project file, then add the edited standard C file to the project, but it is not connected.

Someone asked me more than once: How to establish a standard C project under VC ? (1), just write a standard C program, the more simple and better, such as:

Main () {return 1;}

Deposit this file into the directory you want, must be the same name as you want to build. (If you want the work name is apple, then you should save this file as apple.cpp).

(2) Compile Apple.cpp, at this time, VC will prompt you not to build a project, whether he needs him to build one for you, of course, "Yes". So VC created an engineering of an Apple in a directory with apple.cpp.

(3), the next is "crossing the river and bridge", remove apple.cpp from the project, join or edit the file you want.

The first six chapters of the book are very clear, all of which are all basic concepts such as components, interfaces, reference counts, interface queries, and DLL, HRESULT, GUID, registry, etc., which are generally available, and there is no need to be less courageous.

Chapter VII Test the Class Factory, use the class factory to create a component, may make people confuse: do not need a class, you can write the same powerful components, why do you want more? Shao Yong believes that if you only want to write components within a process, then this sentence is right, because you can write a full-time function to create all the components, then we can't see what is existing Necessity. However, if you want to create a component across the process, the situation is different: Can you write a "global function" that creates components in other processes and returns your handle? So Microsoft came up with a special component, with this special component to create other components, this special component is a class factory. During the creation of the processes, Class Factory Interface IclassFactory is the first across process.

Chapter VII is a crucial chapter tells the reuse of components: inclusion and aggregation. Discussion on "COM is not object-oriented" seems to have been in progress. COM was accused of being a very poor technology because COM does not support the "inheritance" in traditional sense. Here we have to see this problem: Components have "independently released features" and "binary features", since it can be released independently, it should not depend on a base class, otherwise if the base class has changed, then the component has to follow Doing change, you can discuss independently. Component reuse is another realistic problem because some of the new components can save a lot of time with ready-to-build components, and COM uses inclusion and aggregation to achieve multiplexing of components, which is maintained for components. Independent publishing characteristics "," inheritance "is achieved. Hey! Call the "cat" "Mi". Le Shao Yong believes that about less and better, the better, measuring a technical quality standard is to see it is really easy to use, can solve our problem.

About the sample program in this chapter describes a point:

Careful readers may have such a problem: there is such a sentence in ca :: init () function in cmpnt1.cpp:

HR = m_punknowninner-> queryinterface (IID_IY, (void **) & m_piy);

In this sentence, the external component CA will get a pointer to the internal component IY interface. But the problem is generated, is it necessary to call NondelegatingQueryInterface? It should be that there is a seemingly used, because we have to get a pointer to non-proxy unknown interface. What happens if the proxy unknown query is called? The agent unknown interface further forwards the request to the external component, and the external component is pushed back to the internal components to form a dead cycle. But running an example program, I found that the dead cycle did not appear, everything is normal! why? A closer look suddenly wake up: Pursue the origin of the M_PunkNownNiner pointer, found that it is a non-agent unknown interface to the internal components, that is to say that the call is actually NondelegatingQueryInterface, of course, will not be wrong (this is also object-oriented polymorphism) An embodying). Chapter 9 In addition to the intelligent pointer, there is basically no new concept (actually intelligent pointer is not new, Visual C supports intelligent pointers). As for CunkNown and CFactory, as long as you understand the first eight chapters, understand what they are not difficult.

As for the next three chapters ... ... It is said that this book is coming, from the views of the reader feedback, it is quite a lot of criticism. Shao Yong's view is as follows: First, the results are main, because COM's cross-trip call is indeed complicated, Shao Yong also spent the nine bull two tiger's strengths "Dial the cloud, see the day", can speak this look is not easy. But readers have opinions on books. It is mainly because they don't understand, they hope to speak a complex knowledge with the most popular language, and strict. Therefore, the statement and concept of these chapters need to be a lot, and it should be strengthened for DCOM (but this does have a certain difficulty).

The final book provides an example of a jigsaw puzzle. Interested readers can study, play, hard work for a long time, and it should be relaxed.

Writing in the end of the book: "After understanding all the content introduced by this book, the reader should be able to be a COM expert." But Shao Yong thought that this is always too early. If you make COM's knowledge than a "big tree model", then this book only solves the most basic problem, that is, the first tree of the big tree. The main part of the body. If you completely understand COM, you should also understand each of the branches of this big tree, each leaves and worms on the leaves.

This book is worth seeing - "COM / DCOM Programming Guide"

Title: "COM / DCOM Programming Guide"

English original name: "COM / DCOM PRIMER PLUS"

Author :( US) Corry, Mayfield, Cadman

Sams Publish 1999

Chinese translator: Liu Yun Kong Lei

Tsinghua University Press, January 2000, 1st

Pricing: 52.00 yuan (with CD)

The SAMS published by the book occupied the market with its unique perspective, and the readers were quite good. Look at their books may be a shortcut to a quick entry. When the COM book is very short, the "COM / DCOM Programming Guide" is called a book worth seeing. Shao Yong's evaluation of this book is: About the principle discussion in the rules, there is no obvious flaw, and the language is quite wide, the language is still full, but it is also very rare, but it is unfortunate enough, not deep enough, so It is not a "COM monograph". After reading this book, you will close our eyes, just if you have a big meal after you eat a big meal, there is no dish is the "big kitchen craft", which is inevitable. However, from a practical point of view, this book is also called the superiority, and it is not preferentially given a complete example. In Chapter 10, the configuration example of DCOMCNFG is also given. It is rare. If the reader looks at this book and other books, the "Guide" is a good "Two Leaders" (seeing the translator, I really spend a thought, falling) Also very decent). The consistent style of SAMS's book is the threshold, and there is basically no pain in learning. However, COM is a relatively advanced technology, and "zero pain" learning seems unlikely, and SAMS always strives to be practical, so it is unable to mention some practical examples, so the knowledge involved is much more. If you are not understanding C , event driver programming, and MFC, you should see some books of relevant knowledge before reading this book.

The discussion of the Interface Definition Language (IDL) can be regarded as a flash point. IDL is originally not designed to describe a method of describing COM classes and interfaces, but an open software foundation for the RPC IDL specified by the Distributed Computing Environment (DCE). Microsoft initially envisaged the IDL to describe a method of using the RPC interface that can be used between Windows NT machines, which later gradually adds a number of keywords dedicated to the COM component to describe the COM interface and COM objects.

Talking about IDL and ODL, there may be a lot of readers feel confused. However, there is no way, this is a historical legacy issue, and the discussion on page 170 is believed to give you a satisfactory answer.

转载请注明原文地址:https://www.9cbs.com/read-197.html

New Post(0)