However, this technical interface is a problem, and the design is not well influential. The function extension after the future - Fking is relatively simple in plug-in idea, and the extension function is limited. Should consider the main program itself should also be a plugin structure. That is, the plug-in is divided into two categories: host plugins and expansion plugins. These two categories can also be together. This is likely to have good scalability. The idea of Eclipse extension and extension points, and the idea of SharpDevelop's plug-in tree is better solved with the scalability. - Jan
The above is the evaluation of the two netizens on the author "C # plug-in architecture actual combat". First expressed his thanks to two enthusiastic readers.
Indeed, in the process of software development, the process of design is often much more difficult than writing code. Therefore, in addition to software testing, the most time consumption is the system modeling. A good software system should have high stability (reliability), easy operability, and scalability support, especially scalability. I think that good scalability support is a necessary condition for a software team to develop passive as active. For an application, we hope that when users add demand, we can solve the problem with the least amount of time, the least humanity. When others are busy in the fast-growing demand (users can't always tell you the need for the first demand analysis ", and you, your team only needs to work You can get "greed" ("greed" (-_-) to meet the efficiency, so that the team has more time to create, not to do unnecessary modifications.
Unfortunately, this is not taken into account in the article "C # plug-in architectural". Of course, for a young person who is not a team of teamwork, there is no team of teamwork, this mistake is the failure - Teacher is said) is forgive (ourselves). However, I decided to reconstruct this plugin system.
Taking into account the complexity of the system, this time I am ready to use UML (big last month to start learning, painting is not good, laughing).
Start analysis
For the advice of netizens JAN, I am probably, but people's thinking is too big, I dare not guarantee that my understanding is full of Jan's meaning. However, I will still build an application framework model according to my understanding of scalability.
Direct the topic. I am now assumed that I belong to a software team (I will call her AbstractSoft), and I am a system analyst (^ o ^). Everything has its specification, we hope that our team has the same framework for all applications of the same platform, the same deployment form. This can form a unique team characteristics and win in the competition. Because we don't need to design different frameworks for each set - this can save a lot of time!
This way I need to separate the program to a different framework with the user interface. I mean:
In this way, there is an abstract interface and some general details in the core library of Application Frame Level. These contents have been deployed on the user's machine when installing team products. It does not automatically destroy until the user submits the request to remove it locally. GUI Level provides a unified interface component (such as: attribute editor, database operation interface, etc.) after generalization of team products. Specialized Application Implementation by implementing some of the interfaces in Application Frame Level, implements the user interface by using the classes in the GUI Level.
The following is a simple static diagram (the members of the interface and class will be elaborated in detail below):
2. iconnectableObject
Public interface iconnectable {// Application is the main frame object to which the plugin belongs. If it is null, it said plug itself is the main frame ConnectionResult Connect (object application); ExtendibleVersionInfo VersionInfo {get;} void OnDestory (); void OnLoad (); void Run ();} public enum ConnectionResult {Connection_Success, Connection_Failed} public class ExtendibleVersionInfo {private ExtendibleVersionInfo () {} public ExtendibleVersionInfo (string name, string version, string copyright) {// Omitted} public ExtendibleVersionInfo (string name, int version1, int version2, int version3, string copyright) {// Omitted} public int PrimaryVersion {get {return _Version1;}} public int SecondaryVersion {get {return _Version2;}} public int BuildVersion {get {return _Version3;}} public string Name {get {return _Name;}} public string VersionString {get {// Omitted }}} Public string copyright {get {return _copyright;}} private string _name; private int _version1 = 1; Private int _version2 = 0; private int _version3 = 0; private string _copyright; public static extendibleversionInfo Empty = new extendibleVersionInfo ();} All connected objects must implement this interface. This is the nasal ancestors in all Application Frame Level.
3. IEXTendible
Public interface iextendible {iconnectable getlatestvesis (); iconnectable querySpecifiedVersion; extendibleversionInfo [] enumerateversions ();
4. Use the latest version of the application and plugin using the class factory
Our main program and plugin are designed as an Internal Class. The program only outputs a factory class, and the user interface obtains the instance of objects used to complete the actual task by calling the GetLateStVersion () method of the IExtendible interface, and display them. Alternatively, you can also enumerate all versions, allowing users to pick the required version.
5. Scalability
Have to admit, this way is still not very scalable. The program needs to be upgraded while need to modify the factory class (although the interface is constant). In order to achieve better scalability, the simple factory model can be converted to factory method mode. 6. Statement
What needs to be explained is that this article only describes my little idea. There is an unreasonable ingredient, please ask everyone to improve the advice (send me directly, or write a reply). Here you download source code: