Coding - IPO - The PjProblemStrings Sequences
TECTechnics Classroom   TECTechnics Overview

Coding - IPO - The PjProblemStrings Sequences

A Simple C++ Swap Code: swap()

01: #include <iostream>
02:
03: using namespace std;
04: void swap(int &x, int &y);
05:
06: int main()
07: {
08:     int x = 5, int y = 10;
09:
10:     cout << "Main. Before swap, x: " << x << " y:" << y << end 1;
11:
12:    swap(x,y);
13:    cout << "Main. After swap, x: " << x << " y:" << y << end 1;
14:
15:     return 0;
16: }
17:
18: void swap (int &rx, int &ry)
19: {
20:     int temp;
21:
22:     cout << "Swap. Before swap, rx: " << rx << " ry:" << ry << end 1;
23:
24:     temp = rx;
25:     rx = ry;
26:     ry = temp;
27:
28:     cout << "Swap. After swap, rx: " << rx << " ry:" << ry << end 1;
29:
30: }

Output
Main. Before swap, x: 5 y: 10
Swap. Before swap, rx: 5 ry: 10
Swap. After swap, rx: 10 ry: 5
Main. After swap, x:10, y:5

IPO (Initial Public Offering) is a familiar acronym in the investment space. It usually comes into play when a private company is going public and its stocks have to be distributed as shares amongst investors. In many other contexts, IPO is the acronym for the powerful triadic concepts of Input-Processing-Output. Coding is all about IPO.
(a) What other activities can be summarized by the IPO acronym?
(b) What constitute Input, Processing and Output in coding?
(c) Describe the given C++ swap code with respect to its objective and its IPO.
(d) Indicate the PjProblem Strings associated with its IPO. Thus establish the PJProblemStrings Sequences of the code.

The strings: all PjProblems at play.

(a) All biochemical and chemical processes are IPO scenarios. For example, cellular respiration, photosynthesis, acid-base reaction, oxidation-reduction reactions; the investment space that popularized the acronym is an IPO scenario: capital is input, investment strategies process the capital, and capital gain or loss is output; in general, all selection systems are IPO scenarios.

(b) In coding, data is input; function action is processing and data is output.

(c) The objective of the C++ swap code is to swap the contents in two different containers (x and y) and print the result of the swap. The values in the containers before the swap: 5 in container x and 10 in container y are the input data. The swap function does the processing. The values in the containers after the swap: 10 in container x and 5 in container y are the output data. This example reveals that the output of an IPO scenario need not be transformed with respect to physical charateristics. What must occur is change after the processing. In this example, the locations of the input data were changed after the processing.

(di) PjProblem Strings Associated With Input
S7P1A17 (containership-location): this string is associated with the containers (x, y) that house the input data. In coding language, these containers are called variables because their contents vary and they are usually assigned addresses.
S7P2A21 (identity-physical): this string identifies the values of the input data (5 and 10 in this case).

(dii) PjProblem Strings Associated With Processing
S7P3A31 (force-pull): this string pulls the input data from their containers.
S7P3A32 (force-push): this string pushes the input data into their containers.
S7P4A41 (motion-linear): this string is associated with the motion needed to implement the pull and push of input data.

(diii) PjProblem Strings Associated With output
S7P1A17 (containership-location): this string is associated with the containers (x, y) that house the output data.
S7P2A21 (identity-physical): this string identifies the values of the output data.

PjProblemstrings Sequence
S7P1A17S7P2A21S7P4A41S7P3A31S7P4A41S7P3A32S7P2A21S7P1A17.
The PjProblem Strings in the sequence are fundamental to any type of coding. The containers and their contents must be established (data); the pull and push forces (functions) that process the data must be established; and the change that occur; the grouping/interactions that occur and the dynamic equilibrium (a bug free functional code) are established implicitly.

Blessed are they that have not seen, and yet have believed. John 20:29