This series of blog posts will use the Microsoft Ria technical solution Silverlight and the scalability management framework managed extensibility framework (MEF), with the plug-in architecture design as the wire, I share my skills and experience in implementing plug-in system architecture design in the RIA system built based on Microsoft Silverlight technology. In view of my limited ability, if you have any problems, please correct me and learn and make progress together. Thank you!
With the industrialization of software, software reuse has evolved from a general class library to a domain-oriented application framework. The Application Framework emphasizes software design reusability and system class scalability to shorten the development cycle of large-scale application software systems and improve the development quality. The future of application software development lies in the provision of an open architecture to facilitate the selection, assembly and integration of middleware. Application Framework reuse has become one of the most effective reuse methods in software development and production. In the face of this development trend, what we want is a brand new, open, and highly scalable architecture system, here I name it a plug-in Architecture (maybe different from the plug-in Architecture in other populations ).
I. Plug-in architecture design overview
Plug-in architecture design has been very popular in recent years, and eclipse has played an important role. When it comes to plug-in architecture design, you can't help but think of ELE. Me eclipse. In fact, plug-in design is not a new thing, as early as decades ago. X-server is designed based on plug-ins. In addition to its core functions, all its extension functions and device drivers are added as plug-ins.
Plug-in-based design has many advantages. The extension function is removed from the framework, which reduces the complexity of the framework and makes it easier to implement the Framework. The extended functions are coupled with the framework in a very loose way. The two functions can be changed and released independently while the interfaces remain unchanged. Open plug-in interfaces to allow third parties to expand applicationsProgramFunctions of Alibaba Cloud. In addition, the open source and closed source can coexist in a set of software. Whether your plug-in is open source or closed source is up to you. Plug-in-based design is not mysterious. On the contrary, it is simpler and easier to understand than a group of mud designs. Various plug-in-based architectures have their own characteristics, but their models are similar in terms of the overall architecture.
The plug-in architecture design consists of the plug-in framework, plug-in contract (service), and plug-in components.
1. Plug-in framework: Organization and Management System plug-ins are downloaded, loaded, combined, instantiated, and destroyed, and a complete set of Operation interfaces for communicating with background services are provided.
2. Plug-in contract (Service): The plug-in contract exists in the form of service interfaces. All the plug-ins of the system implement unified interface specifications in the system framework, for effective organization and management of plug-in objects.
3. Plug-in components: the plug-in components are both specific plug-in programs and implement an independent program of the plug-in contract service.
For the development of plug-in application frameworks, the key is to identify common points and extension points in the frameworks. Based on this principle, the methods and steps for developing plug-in application frameworks are divided into the following three points:
1. Analyze and extract common points in the framework
2. Analyze and extract the extension points in the framework
3. dynamically load the required assembly (application plug-in) according to the system configuration information at the extension points of the application framework, dynamically create instance objects and call their services.
Ii. Plug-in Architecture Technology Selection
As RIA (Silverlight, flex, and so on) technology is booming, many enterprises have begun to use Ria technology solutions for enterprise management system construction, the biggest advantage of using RIA Technology for system construction is that it completely isolates the background processing service program from the foreground UI display, and the background implementation is not restricted by any technical active platform, improve the flexibility of the overall construction of the system and the ability to integrate other external systems. Specifically, the use of the Microsoft Ria technical solution Silverlight technology to implement the plug-in system architecture depends on the following advantages:
1. SilverlightReleased dynamic Connection Library (. Dll) Or package(. Xap)Easier plug-in architecture.
2. Silverlight supports timely message communication of socket.
3. The combination of Silverlight development and blend interface design makes it easier and faster to implement the UI style.
4. The distributed Communication Service Based on httpservice, WebService, and WCF can improve the capability of multi-system heterogeneous integration.
5. Apply a unified system style to implement multiple system UI styles more easily and conveniently.
6. Friendly full screen mode and unique OOB (out-of-browser) mode support.
7. Rich animation effects to provide a perfect user experience.
8. cross-platform and cross-browser support.
9. More ......
Iii. Advantages of plug-in Architecture Design
It can be said that any form of architecture design practice is nothing more than looking for a relatively convenient, flexible, stable, highly scalable and simpler new technology implementation from the responsible and tedious R & D process. method, this improves the overall development progress and quality of the project, reduces the workload of developers, and indirectly improves the efficiency of the entire project team.
The advantages of plug-in architecture design are mainly reflected in the following aspects:
1) Reduce the mutual dependence between modules of the system
During plug-in development, any system function module, general user interface, and minimal Icons can be developed by plug-ins, which improves the reusability of General function modules; each function is independently developed and independent from each other, so that each independent function can be run independently or managed through the plug-in framework, thus improving the flexibility of the entire system; modifying function modules does not affect the normal operation of other plug-in modules, which reduces the difficulty of system maintenance and improves the scalability of the system.
2) independent system module development, deployment, and maintenance
Each function module can be independently developed as a plug-in according to the Service Interface defined by the plug-in contract service interface and related metadata. After compilation, the module can run independently, it can also be managed and run through the plug-in framework. In theory, plug-in components should not run independently. According to the plug-in architecture principle, they must be managed by plug-in Manager to run. In actual development, various business needs may vary. The specific constraints on plug-in development must be determined based on actual project requirements.
3) dynamically assemble and separate systems as needed
Each function module can be developed as a plug-in, and the deployment information of the plug-in package is maintained through a unified configuration file. The plug-in framework can dynamically download the corresponding xap plug-in package or from the server based on activity conditions. DLL dynamic library file to the client for plug-in Initialization creation, plug-in to framework combination, and so on, the plug-in framework can flexibly manage the communication mechanisms between various plug-in instances and plug-ins, you can also uninstall the plug-in.
Iii. Plug-in architecture component (MEF)
Before MEF, many dependency injection frameworks have been proposed to solve application scalability problems, such as osgi implementation using spring. On Microsoft's platform,. NET Framework itself contains the component model and system. addin. There are also several open-source solutions, including the soda architecture of sharpdevelop and the "control reversal" container (such as castle Windsor, structure map, spring. net, and unity ).
Although various solutions, including Ms, have blossomed on the. NET platform, MEF is the first solution released with CLR.
Official statement: managed extensibility framework (MEF) is an extension management framework on the. NET platform. It is a collection of features, including dependency injection (DI) and duck typing. MEF provides developers with a tool that allows us to easily scale applications and Code With minimal impact, developers Define some extension points based on functional requirements during the development process, and then the extension personnel can use these extension points to interact with the application; at the same time, MEF allows no direct dependency between applications and extensions, which also allows the sharing of extensions among multiple extensions with the same requirements.
This seriesArticleThe design of the plug-in framework discussed here uses the MEF framework in. Net 4.0 as the core component. For details about MEF, see my blog series "MEF programming guide.
Recommended materials:
MEF programming guide: http://www.cnblogs.com/beniao/archive/2010/08/11/1797537.html
Silverlight animation development Tutorial: http://www.cnblogs.com/beniao/archive/2010/04/04/1703992.html
One step to learn Silverlight Tutorial: http://www.cnblogs.com/Terrylee/archive/2008/03/09/Silverlight2-step-by-step-Tutorials.html
Silverlight msdn webcast: http://www.msdnwebcast.net/webcast/2098.aspx
Copyright description
This article is an original article. You are welcome to repost it and indicate the source of the Article. Its copyright belongs to the author and the blog Park.
Author: beniao
Article Source: http://beniao.cnblogs.com/or http://www.cnblogs.com/