Collation
I recently started to learn about. Net and met a good open-source IDE SharpDevelop. This development tool is developed using C #. One thing that attracts me is that it adopts plug-in technology similar to Eclipse to implement the entire system. This plug-in system is my most interesting place, so I started to study a piece of code. After this article, I will write down my research experiences one after another. Internet access in Internet cafes is inconvenient, so it may take a long time.
I. Basic Concepts
First, let's have a more emotional understanding of SharpDevelop. You can download it from here to its executable program and code package http://www.icsharpcode.com/, the installation of nonsense will not say, first run a look. Does it feel like? However, the current version is 1.0.0.1550 and needs to be improved in many aspects. The three authors of SharpDevelop wrote a book about the code and system structure. You can refer to this book. However, I still have a lot of questions about the code and system structure.
Then, let me explain what plug-ins are and why plug-in systems are used. In our previous systems, after developers compile and release the system, the system cannot be changed or expanded. To expand a function, you must modify the code and re-compile and release it. This makes us very inconvenient. There are many solutions, such as configuration. In the solution, plug-ins are a better solution. Everyone must know PhotoShop and WinAmp. They all have the concept of "plug-ins", allowing other developers to compile extended functions (such as various filters in PhotoShop) based on the Interface predefined by the system ). The so-called plug-in is the extended function module of the system. This module appears in the form of an independent file, which is relatively independent from the system. During the system design period, you do not know the specific functions of the plug-in. Instead, you only need to leave a predetermined interface for the plug-in the system. When the system starts, find the plug-in based on the plug-in configuration, mount the plug-in to the system based on the predefined interface.
What are the advantages of this method? First, the scalability of the system is greatly enhanced. If we need to expand the system after the system is released, we don't have to re-compile it. We only need to modify the plug-in. Secondly, it is advantageous for team development. Because each function module is represented in the system in the form of plug-ins, the daily structure of the system is very simple, the BUILD of the entire system will not fail due to a module error. The failure is only a plug-in.