WF Framework Programming-Foundation Section

Source: Internet
Author: User
Tags abstract thread

1 programming model

Speaking from the digestive system, the mouth, intestines, stomach ... Such digestive organs form the digestive system, and each organ is composed of more microscopic substances, such as cells. Cells can also be subdivided. Cells can be categorized, leukocytes, red blood cells, and so on. Here cells can be thought of as the basic component of the digestive system. This structure is very much like object-oriented thinking, because they all have to solve the same problem: the complexity of the real world. A class can be considered to be the most basic constituent element, a class can be composed of components (artifacts), and a component constitutes a service. Know the composition of the digestive system, we see how to achieve eating this function, eating function to complete the need for food through a variety of digestive organs, the use of digestive organs to complete the function. This process is process oriented and is a process. Looking at the implementation of our program, STAITC main is the entrance to the program, and the implementation of the functions in C # is implemented by invoking methods in the interrelated classes. C # itself provides a rich control structure (if else,while, and so on).

Analysis: From the simplest statements to the class to the component, to the subsystem. The optimized organization of code structure adopts object-oriented method, which can be reused better, and can control the change better after using design pattern. But the run-time logic is often process-oriented. such as the logic in main{}. Like the cells that make up the mouth and intestines, these organs make up the digestive system, but eating this function is done by using the functions of each organ, according to some kind of control process.

Conclusion: One of the goals of the program is function implementation, in which the implementation is based on process and the organization structure is object-oriented.

1.1 Process Control Model

Common Process Control models are: 1, C # Statement control flow, 2, xaml;3, database table, 4, DSL (Domain Description language), graphics (dedicated graphics tools). Database tables can store procedures in the scheduling logic, domain model language has been very popular these years. The description of the procedure can be implemented in any one way.

The problem of 1.2c# control process

Take a look at the interactive process: the process of requiring the response of external messages in the process of flow. Maybe some processing will wait a few days or even weeks. If you use the C # control flow implementation, how should be implemented. The general practice is to create a new line Cheng execution of a process, while the main thread continues to run (similar to the Windows service), if the process stalled, the thread will be blocked, if the blocking of more than one thread, the performance of the entire system will have a great impact, after all, the thread pool and other This design can be implemented, but scalability and scalability are problematic. WF handles this type of problem with the bookmark mechanism, where the thread stops, and bookmarks are persisted to the media, saving memory resources in the CLR. When the manager receives the message, it continues to run the process. Bookmarks can be implemented in combination with observe mode and delegate. In the second lecture, we can further understand that WF's threading model is a natural asynchronous invocation mechanism that can be very good at solving such situations. The workflow itself supports the process model better than the current high-level language, and the following reference section common workflow patterns.

1.3 Workflow Mode

The concept of workflow originates from the field of production organization and office automation, the aim of this paper is to decompose the work into well-defined tasks and roles, carry out these tasks according to certain rules and processes, and monitor them, so as to improve work efficiency, reduce production cost, improve production management level and enterprise competitiveness. Workflow provides an integrated mechanism for the implementation of material flow, capital flow, information flow and related processes and applications from a higher level, thus enabling enterprises to achieve business process integration, business process automation and business process management. By defining the workflow model of the interaction between different tasks, whether it is a specific operation action or an abstract information processing action and decision process, it can be described uniformly by the basic elements of the workflow-activity. The relationship between different activities, whether it is the specific processing sequence of parts in the workshop, the file forwards in office automation, or the abstract decision-making flow can be described by the basic elements of the workflow-the connection arc.

21 Kinds of workflow modes are studied based on Petri net theory.

Basic Mode (5)

Sequential mode – Perform activities in sequence

Explanation: One activity in a workflow process can only be performed when another activity is completed.

Example: When the order registration activity is completed, the customer notice can be carried out.

Parallel branching mode – run two activities at the same time

Explanation: The 1.1 control threads in the process are divided into two control threads that can be executed in parallel, allowing two activities to run concurrently.

Example:

Sync mode – Synchronizing two parallel execution threads

Radio mode – Select an execution from multiple paths

Simple Merge Mode – Merge two two Select a path

Advanced Branching and Synchronization mode (5)

Multi-selection mode-select several from multiple execution paths

Synchronous Merge mode-merges multiple paths, synchronizes if multiple paths are selected, and if only one path is selected, a simple merge

Multi-merge mode-merging multiple paths

Discriminator Mode – Merge multiple paths without synchronizing, and perform only one follow-up activity

n mode in M-Merging multiple paths, performing partial synchronization, only one follow-up activity

Structure Mode (2)

Arbitrary loop mode – execution workflows without any restrictions

Implied end-break mode-if there's nothing to do, it's over.

Multi-instance mode (4)

Slightly

State based mode (3)

Postpone selection mode-executes one of two optional threads that the thread will be executed is implied

Alternating parallel mode – Two activities can be executed in any order, but not in parallel

Milestone mode – When a milestone arrives, an activity is fired

Cancel Mode (2)

Cancel Activity – Cancel Current Activity

Cancel process – Cancel the procedure

Reference: Http://blog.csdn.net/tobeand/archive/2004/11/26/195106.aspx

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.