-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Nanw
committed
Jan 25, 2023
1 parent
863733b
commit 0d17ae4
Showing
3 changed files
with
22 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,30 @@ | ||
|
||
# Context Programming | ||
|
||
## Concept | ||
## Background | ||
A _functional program_ is a program that consists of multiple functional steps, with certain execution order, to complete a task. To be distinguished from daemon-like programs. A run-and-exit script or a workflow are typical examples of functional program. | ||
|
||
## Definition of Context Programming | ||
## What is Context Programming | ||
Like a typical computer that consists of _input, output, control unit, compute unit, and memory_, a _functional program_ could be structured as _profile, context, steps, and orchestrator_. As _Context Programming_ pattern. | ||
|
||
## Traits Of A Functional Program | ||
- Consists of multiple operations | ||
- Development and maintenance are vital parts of the program lifecycle. So the followings are essential factors: | ||
- Straightforward: simple to understand, change, and add. Avoid overwhelming abstraction or wrapping. | ||
- Ideally executable per operation, so it's development-friendly, redo an operation anytime, or resume the workflow at any point. | ||
- As a functional unit in the manner of a black box, it can be integrated with other systems. | ||
|
||
## Concepts Explained | ||
- **Profile**: A dynamic input of the entire module. The one-piece concept of _profile_ simplifies the interface and helps integration. | ||
- **Context**: Shared states, generated and used by _Steps_, normally persisted. The _context_ depicts a unified path for data interchange between steps and supports individual step execution. | ||
- **Profile**: The input of the entire module. The one-piece concept of _profile_ simplifies the interface and helps integration. Profile is ideally read-only. | ||
- **Context**: Runtime generated states, shared between _Steps_, normally persisted. The _context_ depicts a unified path for data interchange between steps and supports individual step execution. | ||
- **Steps**: fine-grained operations that read from the _profile_ and read from/write to the _context_. Ideally, each _step_ is executable individually. | ||
- **Orchestrator**: streamline the execution of multiple _steps_ according to workflow or condition, generally as the unified entry for the entire module. | ||
|
||
|
||
 | ||
|
||
## The Core of Context Programming | ||
- **Unit-operability**: Every unit (step) is executable, because all required input are from profile and context, which is available anytime if persisted. The unit-operability enables single unit execution, so minimize the testing and debugging effort, by shifting bug discovery from integration verification, to unit verification. The more complex the integration is, the more value this point holds. Identify an issue during integration is more costly than identifying it earlier at the unit verification phase. | ||
|
||
- **Shallow learning curve**: By separating the whole task into isolated steps, each part will be more straightforward and simple to understand, change, and add. Steps are normally organized in an intuitive way. | ||
|
||
- **Low maintenance cost**: In many cases, development and maintenance are vital parts of the program lifecycle.An easy-to-understand program is likely easy to maintain. The pattern by its nature leads people away from overwhelming abstraction or wrapping. | ||
|
||
- **Integration matters**: As a functional unit in the manner of a black box, it's easy to be integrated with other systems. | ||
|
||
|
||
## Example | ||
*WIP* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<mxfile host="app.diagrams.net" modified="2023-01-25T08:41:20.263Z" agent="5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36" etag="CYFd8Et6cSFWDxwJDM-y" version="20.8.10" type="google"><diagram name="Page-1" id="DFiRHnIutWmvcPEL-c9e">zVjbcpswEP0aPybDxTjuY0Iu7Uw7ce3OtHnqKLAGtUJLZRHjfn0XEGCMYztuJs6T2aPdRZzdPQgPXD/J7xRL4y8Yghg4VpgP3OuB49iWdUE/BbKqkOFoWAGR4qFxaoEZ/wt1pEEzHsKi46gRheZpFwxQSgh0B2NK4bLrNkfRvWvKIugBs4CJPvqdhzqu0LFntfhH4FFc35meuFpJWO1sgEXMQlyuQe7NwPUVoq6uktwHUZBX81LF3T6z2mxMgdSHBKShO/2Gjz9df/XHubybfp2mwZnJ8sREZh54poGorXasVzUNCjMZQpHJGrhXy5hrmKUsKFaXVHjCYp0Ismy6NDlBacif3azdUEC9A5iAVityMQFDQ5rpGntk7GVbA8c1WLzGf10XZsoeNZlbZujCkPMCokY9oqbAwh5PEFL3GBOVjjFCycRNi151mWx9PiOmhr9foPXKjALLNHbZhZzrH0X4ueMZ82Ft6To3qUtjVRuSSKiiRva4Bh7WV9vA0upETkBx4hGUAecodf2YTkVC8eS7i01EYaYC2MGyyaWZikDv8BvubJ4z69yyxm6VS4Fgmj9197atPUy6CXLadeuC8/mC9rLZP81dj2+pWuJ6PXW7VDRfJ+mttk28lzTJ4S2wt7Te9tIeW0bTEqQMHUFpVLlOUbWmiXr9Wju9Ug+ckSAerh7pIioujPBWKN2kWWg8VevKZMgESmoSK5NcU5yF84LeuIBShZFiyclV3NtQ8YtTq/i4V4Z7FTFZjMNJlfwoIffczoieW453jJa/ony7B874M11z8Iz/Vw+4+0fxXgUxLLSi3aA8dCQVsETwciQhhyCrYt/XOWrbMWr4lgM43E/+ROGcE18H0f5JphkJtl92DwvPUIrVeyPdGfdZt+23ZN3bz7pPJzrI9WGsTzOpSUNKlpmG038uNG+Wd0P5hx7l38pXc8OzNale0gmXUWExTZLcF4zSuUMX6RL+Bh8FFgoui0MAHci5EBsQEzySZAqYFxkKfjl9114aOOFhWL7GtlWnW7/10779CtXa/LjbIkrbauW+vFZkth/Y1Vmu/ZvCvfkH</diagram></mxfile> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.