Processes are actions specified in programs. A program prescribes all the activities a program may need to perform to achieve its task, or to fail gracefully. Since a program is the end-product of the design process, it is the only place where there is a complete and reliable description of the program's behaviour. Program code should be written with the intention of presenting its behaviour in a manner that can be understood by a competent user of that program. In an ideal world, systems would be built with the intention to allow the end-user to modify them.
How come there is no language out there which allows that? - after all we've been writing software for a century. Well my only answer to that is that eventually someone somewhere will conceive of the universal programming environment, and after that, people will wonder and marvel that we actually achieved anything at all with our limited software resources.
This blog explores what i imagine software may look like in the programming for the normal person era.
New things are the result of a process.
An active process' past always includes its beginning, initiation, instantiation.
An active process' inevitable future is its end. Processes are transient. They start, they may do things, they terminate --- like this -
Start
Do things, maybe no things.
End
A basic Basic programmer may think of this as -
Result = Process
and that is not a bad way to think of it. Run the process, receive the result.
Result = Process(Data)
allows Arguments to be passed to the process, modifying its behaviour intentionally. In Basic, like this -
Result = Process(Argument.1, Argument.2, ...)
If all program components were of this form, then programs would consist of statements getting stuff from other processes, and doing things with that stuff. (In between logical structures). (Lisp comes close)
The way you get a computer to do something is to tell it.
Turning on a pc is the first thing you tell it. This ultimately starts a process.
In most languages this could be expressed as
Computer("start")
When the computer starts, it goes through a sequence of steps which wake up the different parts of the system. The keyboard is started, the screen is started, the disks are started and so on.
In some programming environments this would be represented -
Computer("start")
Disks("start")
Keyboard("start")
Screen("start")
OtherPeripherals("start")
ProgramRunningEnvironment("start")
etc.
In some programming environments it would be represented -
Start("Computer")
Start("Disks")
Start("Keyboard")
Start("Screen")
Start("OtherPeripherals")
Start("ProgramRunningEnvironment")
etc.
The first type of process invocation - "Computer("start")" - can be viewed as sending the start action to the computer. This is object-oriented thinking.
The second type of process invocation - "Start("Computer")" - can be viewed as "Start computer". This is procedural thinking.
------------------------------------------------------------------------------------------------------------------------------------------
Ideal process
- always runs under a controlling process
- has process invocations of the form -
{Result = }Process(Data)
- has process structures of the form -
Process Name {Argument list}
Ensure valid Result
Call Mainline
Return {Result}
Mainline
{Statements}
Return
This ensures that there is only one return point.
- isolates external data to a small set of processes via the Data Management System.
- isolates user interaction to a small set of processes via the User Management System.
- isolates inter-process communication to a small set of processes
Send To Port
Get From Port
(The term "port" represents any conversational device - any device which responds to send and receive communication.)
- no special variables - all variables are local or passed byref
- variables share scope within a process
(so the only variables which share scope with another process are those passed as arguments)
- expects and gets and returns variables in correct format
- i.e. data types are specified only where data is requested from another process, either explicitly by specification of an attribute name, or implicitly from the variable's data type in a called process.
I hate the argument about data typing being a necessary requirement of any real language. The absence of data type specification reduces redundant code. Any process performing any action on any variable is dealing with data known intimately to that process. The programmer who wrote it knew what was required of any variable used. So the only actions performed on any variable are those which are appropriate to it. So the data type is little more than documentary. -- I should move this somewhere else - it is provocative to some of the best programmers.
- On the other hand, all variables do have a data type.
- Any variables can have different data types in different contexts. When a variable is accessed in a process at run-time, it is accessed in that process' context. This context provides the appropriate action for its data type.
Boolean Truth
- zero is false
- any other value is true
Null Values
An entry window is a frame containing narratives and prompts and other frames assisting user entry of a list of variables.
There are catastrophic "errors", where processing has halted. Error recovery systems notwithstanding, a process can do nothing when control never returns.
There are processing "errors", where an exceptional condition has been encountered causing the result of the process to be indeterminate.
This needs a bit of explanation - (and if you know of try ... except blocks try to disregard the similarities)
There are many conditions where continuation of normal processing needs to be interrupted. E.g. When a user decides to cancel an interaction
Any process does nothing and returns nothing when a processing "error" has occurred. ** PART OF ESCAPE EXPLANATION **
A process is only really being a process when it is active - when it is being run by a processor within a runtime environment. A snapshot of the environment at any point in time would show -
The thread in which this process is active. There are many active threads sharing the processor. ** **
The list of active processes which have been called by processes preceding this process. The current process was called by a process, which was called by another process.
----------------------------------------------------------------------------------
Local Globals and Shared Globals
LGs are COMMON variables defined and used by only one process.
SGs are COMMON variables defined in shared source, usually inserted or
included source, and used in many processes.
Data flow -
Result = Process(Data)
Output Data = Process(Input Data)
The result of invocation of a process is determined by any provided
Input Data.
In software, the Output Data is always returned correct for the given
input. There is no chance of failure. If any process fails or encounters
a subordinate process's failure. This is accomplished by sharing
an ok-to-continue Shared Variable which is checked on entry to
each process. If this variable is set, then the process does not
continue - the process returns nothing and does nothing.
If an error happens any process needs only to set this Shared Variable,
This allows any process which encounters an expected exception where continuation is futile to
This allows any process which encounters an expected exception where continuation is futile to
Any one process always returns the correct result unless an
exception occurs during that process.
Properties of Processes.
A process is the implementation of its requirements.
A process is one contiguous piece of source code.
A process may invoke other processes.
A process has access to data -
Interprocess data.
Data explicitly passed between processes.
Passing two apples and getting stewed apples with cream in return
Intraprocess data.
Data shared in transient memory with other processes.
The sugar and spices and other immediately available ingredients.
Database data
Data shared externally with other processes.
Transient data
Database data can always be fully defined in a process as an
attribute of an instance of an entity.
The cream and golden syrup that had to be bought from the store.
A process has access to succinct -
security system
exception system
Data Management System
collection management system
selection from data of lists of attribute values
management of lists
user interaction system
allowing dialogue with the user
task management system
event management system
memory management system (memory in the sense of remembering and
recalling information)
reservation management system - locking
source management system
No process can fail - paradoxically, any process can fail. For any
process achievement of its task can be rendered indeterminate by an
unexpected exception, for example, the failure of an invoked process.
A process always returns the correct result for any given input unless
it fails.
A failed process returns null.
A process has self-knowledge via its identity -
unique stamp
name
environment
application
level or thread of execution
user identity
execution status
account identity
network identity
start time
version
source code
A process can be of the same name but of different function in separate
namespaces or accounts. Even for different users within a namespace or
account.
A process provides the context for all its called processes. This is
because the programmer wrote the code for each call with full knowledge
of the required behaviour of the called process, the parameters
expected by the called process, and the intent of the calling process.
(At least that is the theory)
A process can call any other process - including itself
A process has always been called by another process.