Programming: Part 1
Posted: Sat Jan 05, 2019 4:45 am
#1038 Programming: Part 1
Expand Messages
Lynn H. Maxson
Jul 25, 2004
We have some confusion about the necessity for and level of
programming experience to participate in this project. We
ought to put them to rest, to increase the comfort zones of all
participants, and to lower the reticence to participate.
We can only make one type of error in programming: logic. In
logic we only have two ways to make an error: commission (in
what and how we say it) and omission (what we fail to say).
You will see that this applies to areas in which we engage in
or otherwise use logic.
In programming we have two logic areas. One relates to the
definition of data;the other, to its processing. We cannot
engage in "black-box" programming as John Baker suggests
without logically defining the data, the inputs and outputs
separated and joined by the processing. We may have only a
general, somewhat informal definition of the logic, but we
have an absolutely detailed definition of the data.
So to pursue this "black-box" approach we may put off to
some later date the definition of the logic, but we cannot
formally specify the data without programming it in detail, in
the writing of that specification or data definition. If you
want to "bring up" your programming skills as well as
participate in the documentation of the design stage, I suggest
that you "master" defining data.
You cannot define data without also choosing without
choosing a specific language. If it is not a programming
language, only a specification-only language, then at some
point you have to respecify it in a programming language. As I
assert that we should choose PL/I and its fourth-generation
derivative, PL/E (SL/I), instead of C and its derivatives, I
would like to offer just in the area of data definitions a few
of the thousands of reasons for such a choice.
Remember we have to do this for any API, which consists of
three parts: (1) a return code, (2) an API name, and (3) a
parameter list. To offer what I would hope comes down as a
"convincer" I would suggest we begin with "DosOpen".
From the "OS/2 Control Program Guide and Reference" we
have the following for DosOpen:
Opens a new file, an existing file, or a replacement for an
existing file. An open file can have extended attributes.
#define INCL_DOSFILEMGR
#include <os2.h>
PSZ pszFileName; /* Address of the ASCIIZ path name of
the file or device to be opened */
PHFILE pHf; /* Address of the handle for the file */
PULONG pulAction; /* Address of the variable that receives
the variable that receives the value
that specifies the action */
ULONG cbFile; /* New logical size of the file (end of
data, EOD), in bytes */
ULONG ulAttributes: /* File attribute information */
ULONG fsOpenFlags; /* The action to be taken depending on
whether the file exists or does not
*/
ULONG fsOpenMode; /* The mode of the open function,.
Possible values are show in the
following list: */
PEAOP2 peaop2; /* Extended attributes */
APIRET ulrc; /* Return code. */
ulrc = DosOpen(pszFileName, pHf, pulAction,
cbFile, ulAttribute, fsOpenFlags,
fsOpenMode, peaop2);
While I have no desire to unfairly compare C and its
derivatives to PL/I or PL/E, I do have a desire to let the facts
speak for themselves. I remember how the adrenaline flowed
when I first read K(ernighan) and R(itchie)'s "The C
Programming Language". I couldn't believe the distortions and
false claims they made. While the ethernet had a Cisco come
along to compensate for its weaknesses, C and its derivatives
have had no such savior.
However, for comparison purposes you need to understand in
some detail what lies within and behind the C code of
DosOpen. With that understanding then, along with the
weaknesses it exposes, you will better appreciate that
languages differ and those differences matter.
So in the second part of this message we will explain in detail
the definitions in C of DosOpen.
Expand Messages
Lynn H. Maxson
Jul 25, 2004
We have some confusion about the necessity for and level of
programming experience to participate in this project. We
ought to put them to rest, to increase the comfort zones of all
participants, and to lower the reticence to participate.
We can only make one type of error in programming: logic. In
logic we only have two ways to make an error: commission (in
what and how we say it) and omission (what we fail to say).
You will see that this applies to areas in which we engage in
or otherwise use logic.
In programming we have two logic areas. One relates to the
definition of data;the other, to its processing. We cannot
engage in "black-box" programming as John Baker suggests
without logically defining the data, the inputs and outputs
separated and joined by the processing. We may have only a
general, somewhat informal definition of the logic, but we
have an absolutely detailed definition of the data.
So to pursue this "black-box" approach we may put off to
some later date the definition of the logic, but we cannot
formally specify the data without programming it in detail, in
the writing of that specification or data definition. If you
want to "bring up" your programming skills as well as
participate in the documentation of the design stage, I suggest
that you "master" defining data.
You cannot define data without also choosing without
choosing a specific language. If it is not a programming
language, only a specification-only language, then at some
point you have to respecify it in a programming language. As I
assert that we should choose PL/I and its fourth-generation
derivative, PL/E (SL/I), instead of C and its derivatives, I
would like to offer just in the area of data definitions a few
of the thousands of reasons for such a choice.
Remember we have to do this for any API, which consists of
three parts: (1) a return code, (2) an API name, and (3) a
parameter list. To offer what I would hope comes down as a
"convincer" I would suggest we begin with "DosOpen".
From the "OS/2 Control Program Guide and Reference" we
have the following for DosOpen:
Opens a new file, an existing file, or a replacement for an
existing file. An open file can have extended attributes.
#define INCL_DOSFILEMGR
#include <os2.h>
PSZ pszFileName; /* Address of the ASCIIZ path name of
the file or device to be opened */
PHFILE pHf; /* Address of the handle for the file */
PULONG pulAction; /* Address of the variable that receives
the variable that receives the value
that specifies the action */
ULONG cbFile; /* New logical size of the file (end of
data, EOD), in bytes */
ULONG ulAttributes: /* File attribute information */
ULONG fsOpenFlags; /* The action to be taken depending on
whether the file exists or does not
*/
ULONG fsOpenMode; /* The mode of the open function,.
Possible values are show in the
following list: */
PEAOP2 peaop2; /* Extended attributes */
APIRET ulrc; /* Return code. */
ulrc = DosOpen(pszFileName, pHf, pulAction,
cbFile, ulAttribute, fsOpenFlags,
fsOpenMode, peaop2);
While I have no desire to unfairly compare C and its
derivatives to PL/I or PL/E, I do have a desire to let the facts
speak for themselves. I remember how the adrenaline flowed
when I first read K(ernighan) and R(itchie)'s "The C
Programming Language". I couldn't believe the distortions and
false claims they made. While the ethernet had a Cisco come
along to compensate for its weaknesses, C and its derivatives
have had no such savior.
However, for comparison purposes you need to understand in
some detail what lies within and behind the C code of
DosOpen. With that understanding then, along with the
weaknesses it exposes, you will better appreciate that
languages differ and those differences matter.
So in the second part of this message we will explain in detail
the definitions in C of DosOpen.