Design and application of COM components (I.) Origins and compound documents

Source: Internet
Author: User
Tags file system ole

First, the preface

In 1995 A.D. One Night, a dark night, my teacher said to me: "Xiao Yang Ah, later write programs and building blocks the same." You quickly learn some OLE technology ... "and I thought to myself," What's the joke? How to write a program by building blocks? In another 100 years ... "but as a good student, I began to" Chi "(note 1) Books about OLE (note 2) in the bookstore. Kung Fu not negative, finally bought my first COM book "OLE2 Advanced Programming Technology", this 800-page large cloth head cost me 1/5 month salary ah ... Then began day and night plowing ...

Kung Fu not negative, I persisted in reading all the works, the feeling is: This book, say What na?

Kung Fu not negative, I read over again big cloth head, feeling is: cough ~ ~ ~ ~ ~ ~ ~ ~, did not understand!

Kung Fu not negative, I again, I again, I read again ... Feeling is: Oh ~ ~, read a little bit, hahaha.

...... ......

Kung Fu not negative, I finally, I finally understand.

800 pages of the book for me now, in fact, on the 10 pages useful. At this time to realize what is called "book read Thinner" the truth. Later, there are more books to buy, the Internet is more convenient and cheaper ...

In order to let Vckbase friends, no longer experience my past pain, no longer repeat my "headless fly" like the hardships of exploration, in order to vckbase the booming, for the Chinese software cause of take-off (bad, blown too high) ... I intend to save some time to earn points on the BBS, write a series of papers, called "COM Component design and application" bar. Today is the first part--origin.

Second, the storage of documents

Legend has it that 350 years ago, Newton was hit in the head by an Apple and discovered the gravitation. But by the 21st century, the invention and development of any technology no longer depended on the brilliance of the sage. The progress of technology is driven by the demand of society, the interests of business, the pressure of competition and the infiltration of industry. Microsoft's component technology on the Windows platform is no exception, its invention, has its inevitable factors. What is this factor that? The answer is--file storage.

Open the Notepad program, enter an article, save. -such documents are called "unstructured documents";

Open the spreadsheet program, enter a class of student names and test scores, save. -such documents are called "standard structured documents";

In the program we write, we need to write the specific data in a certain structure and order to save in the file. --Such files are called "Custom structured Files"; (for example, *.bmp files)

The above three kinds of documents, we all see more. So does file storage depend on the way it is used to satisfy all the application requirements? Well ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ More than 50 years after the invention of computer, has been enough. Hey, let's look at the driving effects of business interests and what changes have been made to the way files are stored. Friends over 30 years old, I estimate that I used to use the following famous software: WordStar (English editing software under the domination of Dos), WPS (Jiu Bojun written Chinese editing software, it is said that the market share of the year as high as 90%, a variety of computer training courses required), LOTUS-123 (spreadsheet software produced by Lotus Company) ...

After successfully launching Windows 3.1, Microsoft began to covet the field of desktop office automation software. Microsoft's OFFICE Development department, each team independently developed the WORD and EXCEL software, and in a "custom structure" way to store files. In the fierce market competition, in order to defeat competitors, Microsoft naturally produced a thought------if I can embed EXCEL in Word program, then the user buys my word software, there is no need to buy LOTUS-123 again?! "Vicious" (Chinese Microsoft's comrades have seen the word, don't get excited, I was quoting) the plan came after they started the implementation work, which is the origin of COM's predecessor OLE (note 3). But immediately encountered a serious technical problem: need to put WORD produced DOC files and EXCEL generated XLS file together.

Scheme Advantages Disadvantages
Create a subdirectory that stores DOC and XLS in the same subdirectory. Data isolation is good, WORD does not need to understand the storage structure of EXCEL, easy to expand. The structure is too loose to cause data damage or loss.

Not easy to carry.

Modify the file storage structure and extend the structure of the containment XLS on the doc structure. Compact structure, easy to carry and unified management. The developer of WORD needs to be familiar with the storage format of EXCEL, the lack of extensibility, can not add a new type to expand the structure?

All of the above two programs, there are serious deficiencies, how to solve it? If you can have a new plan, you can combine the advantages of the first two programs, to eliminate the shortcomings, how good ah ... Microsoft started out as a disk operating system, so naturally they put forward a very perfect design, that is, the management of the disk file into the file------compound file, commonly known as "File file system." Even Microsoft did not think, so a simple idea, incredibly finally evolved the COM component program design method. It can be said that composite files are the cornerstone of COM. The following figure is an analogy between how disk files are organized and how they are organized:

Figure one, the left indicates how the file is organized under a disk, and the right side represents how the data is organized within a composite file.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.