Architecture choice
Foreword
In the field of traditional programming, people use flowcharts to express the basic functions and implementation of the system, but the flowchart is actually just the graphical representation of the source program, and more is not available to the system analysis and developers. Information, so there is no extensive application in the actual system development process. With the size and complexity of the software system, analyze and describe the overall structure (data and control logic of data and control), which is an indispensable part of the development of large system development, obviously, the flow chart is unable to reach this Target, we must use new methods and concepts to grasp the overall structure of the system.
Systematic analysis actually includes two phases of work, first is the analysis of demand, that is, the interface between the system and the environment will be separated from the system and the surrounding environment, which is From the user's point of view, the entire system will be investigated as a whole. Secondly, the system is designed, according to the overall function and data of the system, refer to the actual physical system or similar system, the actual work-running software system, this step is actually the analysis and determination of the architecture.
From the perspective of system engineering, any complex system is relatively simple, and the currently analyzed system level is the original basic element (although in a further analysis, these elements may have a very complex internal structure). Component, there is a complex interaction between these basic elements. Therefore, the basic task of the analysis and design of the software system is to establish basic elements in the system (ingredients must be indispensable for the function of the system); determine the interaction between these elements (this is the system architecture).
We have simply introduced several of the most basic architectural paradigms, their features, advantages and disadvantages, and finally give some guiding opinions of how to choose architectural paradigms in actual development.
Parameter of the basic architecture:
1. Pipes and filters:
Each component has a collection of inputs and outputs, and reads out data from the stream as input, generating streams of output data. The entire system can see a data processing component formed by multiple filters.
Filter A
Filter B
Filter C
Filter A
Filter D
pipeline
pipeline
Features:
The L filter is independent of each other (cannot share state), where one filter operation and behavior cannot affect the operation and behavior of additional filters, and there is no side effect.
l The filter is not concerned about the source of the input stream and the output stream, and does not need to know the source and flow of the stream, the source, and the derived source of the filter do not have any effect on the data processing of the filter.
l The transfer of filtration and streaming may be concurrent, and the transmission of multiple streams can be present in the system.
Example:
One of the most famous instances is UNIX's shell programming, and multiple procedures for processing data (components) are coupled through the pipeline, producing sums of results; there is a traditional compiler, source code through lexical analysis, grammatical analysis, intermediate code Generate, the target code generation steps generates the target code of the output.
advantage:
l The functionality of the entire system is the sum of multiple filter functions, which simplifies the analysis and design of the system, and can process the entire system as a filter after the analysis of the demand, and then gradually refine into multiple interconnections. filter.
l Support for the reuse of components, the same filter can appear in different locations in the system multiple times.
l is easy to maintain and enhance, the filter can be replaced, which can increase the new filter to the system without changing the original filter, does not change the basic function of the original system.
l Essentially concurrency support, this architecture is not related to the passing of parallel streams due to substantially independent of the state of individual filters, so it is a basic system with a basic system. . Disadvantages:
l Since the filter is independent, the designer must independently consider the input, processing, and output of each filter, which cannot be embodied in the design for the digital and interrelationships of the filter logic.
l Due to the batch characteristics of this system, it is not suitable for applications for development and user interaction.
l The common characteristics between the plurality of processing flows of the system cannot be extracted, and the common characteristics between multiple filters cannot be extracted, so the complexity of the design is added.
2. Data Abstraction and Object-Oriented System
In this system, the operations on the data and data are encapsulated into an abstract data type or object. The system consists of a large number of objects, physically, the objects interact through functions or process calls; logically, the object is reused by integration, composite, etc.
Object d
Object B
Object a
Object e
Object C
Object call
Object call
Object call
Class A
Class B
Class C
Class g
Object a
Object e
Class f
complex
inherit
Physical structure logic structure
Features:
Object-oriented system analysis and design is too much, this is no longer detailed here.
advantage:
Due to packaging, flexibility and expansion, hidden the details of implementation, and improve the quality of the code;
Inheritance and polymorphism, improve software reusability.
Disadvantages:
The most important disadvantage is that because the interaction between the object is made by a clear object function call, when an object needs to implement a specific function, it must know which object provides this service, which reduces the system flexibility. The pipe and filter model do not need to explicitly indicate the source and go of data.
3. Event driver system
Object e
Object e
Object e
Bus distribution
Event creation
Creation of the registration of event recipients
Object e
This is a deformerous orientation of object-oriented and data abstract systems, and the system is also composed of a large number of objects, but the interaction between objects is not based on the function of the object or process call, the system provides an event creation and Published mechanisms, objects generate events, one or more objects to register this event to the system and thereby trigger the corresponding behavior or generate new events.
Example:
One of the most famous examples is the model of the GUI, the mouse, keyboard, or other input devices produce various events, windows, programs, or other objects that are triggered by these events, generating new events, data processing or other operations.
advantage:
Call calls for functions and processes do not need to indicate specific objects, so the system has very good flexibility and scalability, and new components only need to register to the system's event processing section, you can immediately join the system, the same, old Components can also be easily removed from the system. This structure should be adopted for a system that requires a particularly high dynamic requirement, especially if the system needs to be expanded at runtime.
Disadvantages:
Since the function call is performed by the event transmission, the object to issue an event cannot confirm whether there is an object to handle this event. Is it a desired object to handle this event, whether to obtain the desired result, the same order cannot be controlled The correctness of the logic and timing of the system must be guaranteed by the assertion of complex timing logic and the front and rear conditions.
4. Hierarchical system
Divide system functions and components into different functional hierarchies, in general, only the uppermost components and functions can be accessed by users outside the system, and only the adjacent hierarchies can be called. Below is a hierarchy of a basic business processing system:
User interface layer
Transaction logic layer
Core layer
Example:
Obviously, ISO's OSI (Open System Interconnection) Reference Model is an example of the most famous hierarchy, by dividing the function and components of the open system into 7 levels, defining a clear (many times is too complex) hierarchy The interface that achieves complex interoperability.
advantage:
The development and design of the system can gradually be taken, and the complex and abstract functions of the high-level complex and abstraction are gradually established from the simple function of the underlying.
l Flexibility and scalability, because the adjacent hierarchy interacts through a clear interface, the specific level can be replaced and enhanced, and even new hierarchies can be added.
Disadvantages:
l Not all systems can decompose become a clear level
l Definition, logically consistent hierarchy is very difficult (OSI's failure and TCP / IP successful description of this)
l Strict hierarchical calling structures reduce system performance.
5. Knowledge Base System
Using a central data structure represents the current state of the system, a set of independent components operate on a central database. If the component is responsible for selecting, processing the central data, this system is a traditional database model; if the center data structure is independently triggered, this system can see a blackboard model.
Center database (Knowledge Base)
Customer component A
Customer component B
Customer component C
Example:
A large amount of traditional database applications is actually a specific example of this system. In many research systems, the use of knowledge base-based blackboard models is actually this system.
advantage:
The data-centric architecture can naturally represent a large amount of data and transaction processing logic, suitable for expressing applications with data.
Disadvantages:
Only some of the simple data stock applications can be fully adopted, in a large number of actual commercial applications, completing the master handling and other logic applications must adopt other architecture expression
6. Interpreter system
user
If the application's logic is very complex, for example, the various drawing instructions of AutoCAD may use this system in a very complex manner, a better system is to provide a set of instructions (languages), system interpret this Language, generates corresponding behavior, users use this command (language) to complete complex operations.
Business logic describing using virtual machine language
Virtual machine interpreter
Basic instructions to complete the actual operation task
Actual problem
Example:
A large number of development tools, the secondary development tools reflect this idea: Microsoft uses a large number of Visual Basic for Application in its products, and the AUTOLISP language used in Autodesk products, actually provides users with a domain-oriented domain. The language, then the core explains the instructions and instruction sequences of this language. Thus the function of expanding the product is convenient for users to customize the system according to their own needs.
advantage:
Very good scalability, users can achieve secondary development of software systems
Disadvantages:
Software development is complex, especially the design of this set of instructions is very difficult.
Whether a mature language can be used as a basis for secondary development (for example, Java)
View of actual system development
During the actual development process, it is very difficult to determine what the architecture should be taken in a particular application. From the current trend: Simple pipeline, the filter system has been very rare, object-oriented thinking has been integrated in almost all architectures, while hierarchical ideas are also widely used, so a basic system The analysis method should be the decomposition of functions and complexity, that is, from transverse decomposition (sub-module, subsystem), longitudinal decomposition to obtain the basic component of the system (classification, hierarchical function and object). Then select the behavioral mode of the system according to the characteristics of the problem (specific architecture). The most common architecture currently:
l Strict hierarchy (system can clearly decompose into different functional levels, such as basic graphics libraries, providing different levels of drawing interface)
This architecture is suitable for the functionality of the system relatively simple, and can be layered in software in terms of complex extent, abstraction, and relationships between hardware platforms.
l Event driver system:
This system can be employed in the case of interoperability, especially the interoperability requirements in the heterogeneous environment, and this system can be employed. When there is a large number of concurrent, there is no logical connection between the entire system (for example The operating system or graphical user interface can use this architecture. The CORBA of Microsoft COM and ISO in modern software technology is actually examples of this architecture.
l System of Knowledge Base:
This system uses this system with a large amount of data as the core. Some artificial intelligence applications also need this architecture. Object-oriented knowledge base is a development direction of this architecture. Introducing object-oriented and hierarchical ideas into a knowledge base system, a very powerful architecture will be obtained.
l System based on the interpreter:
If the application system and user interaction is very complicated, this architecture is the most suitable scheme, and only provides a simple and clear grammar and basic data operation, providing a simple and clear grammar and basic data operation. The ability to deal with the most powerful, flexible, optimal expansion new application system; a very suitable example is a browser, start, browser just simply download and display the HTML page, with the user Development of interface interactions requires JavaScript, providing a language and basic interface element manipulation instruction to obtain expansion and powerful functions.
Most actual operating systems are the composite of the above architecture: a system structure is adopted in some parts of the system, and there is another system in other parts, we can use the system of composite basic architecture Composite architecture. In actual system analysis and design, the entire system may be analyzed and weighted as a functional body to obtain a suitable, uppermost architecture. If the element in the architecture is more complicated, it can continue to decompose, to obtain a certain Part of the local system. The analytical level should be clearly used in clear features and interface descriptions, which can focus our focus in the overall structure of the system in this stage of analysis and design, and avoid the introduction and the language. Implement the details of the specific needs of the specific needs.