Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Bringing computers into the home won't change either one, but may revitalize the corner saloon.


devel / comp.arch.embedded / Re: Ftn I/Os documentation best practices

SubjectAuthor
* Ftn I/Os documentation best practicesDon Y
`* Re: Ftn I/Os documentation best practicesDavid Brown
 `* Re: Ftn I/Os documentation best practicesGrant Edwards
  +- Re: Ftn I/Os documentation best practicesDavid Brown
  +* Re: Ftn I/Os documentation best practicesDon Y
  |`- Re: Ftn I/Os documentation best practicesDavid Brown
  `* Re: Ftn I/Os documentation best practicesStephen Pelc
   `* Re: Ftn I/Os documentation best practicesDon Y
    `* Re: Ftn I/Os documentation best practicesStephen Pelc
     `* Re: Ftn I/Os documentation best practicesDon Y
      `* Re: Ftn I/Os documentation best practicesStephen Pelc
       `- Re: Ftn I/Os documentation best practicesDon Y

1
Ftn I/Os documentation best practices

<t9acer$d1t$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=927&group=comp.arch.embedded#927

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: blockedo...@foo.invalid (Don Y)
Newsgroups: comp.arch.embedded
Subject: Ftn I/Os documentation best practices
Date: Sun, 26 Jun 2022 12:35:46 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <t9acer$d1t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 26 Jun 2022 19:35:55 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="a7f1f021571e5db0a15cb008f2e72ced";
logging-data="13373"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+qcoVmdjHPbZMbDxvVp+oj"
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.1.1
Cancel-Lock: sha1:ETQJwLLdf9DoN/YgxsiYqYs/Rxw=
Content-Language: en-US
X-Mozilla-News-Host: news://news.eternal-september.org:119
 by: Don Y - Sun, 26 Jun 2022 19:35 UTC

I add a boilerplate to each function definition that
declares constraints on inputs, expectations of outputs,
performance issues, etc. I use this to add invariants
to the code to detect/enforce these conditions.

But, there is nothing that ensures that I've done
this -- other than discipline.

I'm looking at ways to create an IDL that will allow
for more specific criteria to be included in the
declaration that could also drive the IDL compiler
to add suitable invariants as applicable.

[This makes RPC much more effective but can also
benefit traditional ftn invocations]

Any pointers to similar schemes? I've been looking
through CORBA et al. for hints but they seem to
focus on bigger machines (where there is more tolerance
over data types and more overhead expected).

Re: Ftn I/Os documentation best practices

<t9bmlm$bic9$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=932&group=comp.arch.embedded#932

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Mon, 27 Jun 2022 09:36:21 +0200
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <t9bmlm$bic9$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Mon, 27 Jun 2022 07:36:22 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="9cf278c6eadbb4b2c4fa09c15837dc6b";
logging-data="379273"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/AvQAXnwUvXLOyhoSc3WSHfdw+2WksLUc="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:xuq+N9EOGgQMxcBR1Nal9WC0RMk=
Content-Language: en-GB
In-Reply-To: <t9acer$d1t$1@dont-email.me>
 by: David Brown - Mon, 27 Jun 2022 07:36 UTC

On 26/06/2022 21:35, Don Y wrote:
> I add a boilerplate to each function definition that
> declares constraints on inputs, expectations of outputs,
> performance issues, etc.  I use this to add invariants
> to the code to detect/enforce these conditions.
>
> But, there is nothing that ensures that I've done
> this -- other than discipline.
>
> I'm looking at ways to create an IDL that will allow
> for more specific criteria to be included in the
> declaration that could also drive the IDL compiler
> to add suitable invariants as applicable.
>
> [This makes RPC much more effective but can also
> benefit traditional ftn invocations]
>
> Any pointers to similar schemes?  I've been looking
> through CORBA et al. for hints but they seem to
> focus on bigger machines (where there is more tolerance
> over data types and more overhead expected).

What programming language are you using? If your answer is "C", it's wrong.

If you are just putting these things in comments, then they will get out
of sync with the code. The best you can do is writing something like a
Python script that will read the C code and check for the pattern of
comments.

If you want something really useful, you need a programming language
that will let you write the contracts in the language itself - then they
can be checked and enforced. Ada, D, and Scala are examples. C++ has a
Boost.Contracts library, and language support for contracts is due in
C++23 (last I heard - but it might be delayed again).

Re: Ftn I/Os documentation best practices

<t9chnf$kve$1@reader2.panix.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=935&group=comp.arch.embedded#935

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!panix!.POSTED.::1!not-for-mail
From: inva...@invalid.invalid (Grant Edwards)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Mon, 27 Jun 2022 15:18:07 -0000 (UTC)
Organization: PANIX Public Access Internet and UNIX, NYC
Message-ID: <t9chnf$kve$1@reader2.panix.com>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
Injection-Date: Mon, 27 Jun 2022 15:18:07 -0000 (UTC)
Injection-Info: reader2.panix.com; posting-host="::1";
logging-data="21486"; mail-complaints-to="abuse@panix.com"
User-Agent: slrn/1.0.3 (Linux)
 by: Grant Edwards - Mon, 27 Jun 2022 15:18 UTC

On 2022-06-27, David Brown <david.brown@hesbynett.no> wrote:
> On 26/06/2022 21:35, Don Y wrote:
>> I add a boilerplate to each function definition that
>> declares constraints on inputs, expectations of outputs,
>> performance issues, etc.

> What programming language are you using? If your answer is "C",
> it's wrong.
>
> If you are just putting these things in comments, then they will get out
> of sync with the code.

I'd have to agree. I've worked with many projects and third-party
libraries over the decades which had a big template of comments for
every function which described the input/ouput parameters, return
value, global variables used, and so on.

Often these templates generated documents by using something like
Doxygen.

And on _every_single_one_ of those projects and libraries, the
comments were wrong often enough that nobody who knew which way was up
paid any attention to them. If you wanted to know what the parameters
were for, what the function returned, and so on, you read the C code.

A lot of the time, even the numbers and names of the parmeters
described in the template didn't match the code.

The auto-generated PDF documents and HTML web site looked nice, though.

--
Grant

Re: Ftn I/Os documentation best practices

<t9cqpd$l3fm$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=936&group=comp.arch.embedded#936

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Mon, 27 Jun 2022 19:52:44 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <t9cqpd$l3fm$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
<t9chnf$kve$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Jun 2022 17:52:45 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="f523d88eef42cbcd103d0c9f8d25ad26";
logging-data="691702"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19WDqBYwtarQXC3imfDxev5CWULk/KWBIg="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:Jc8hn6b96agNoDkXpkPYegC6+l4=
In-Reply-To: <t9chnf$kve$1@reader2.panix.com>
Content-Language: en-GB
 by: David Brown - Mon, 27 Jun 2022 17:52 UTC

On 27/06/2022 17:18, Grant Edwards wrote:
> On 2022-06-27, David Brown <david.brown@hesbynett.no> wrote:
>> On 26/06/2022 21:35, Don Y wrote:
>>> I add a boilerplate to each function definition that
>>> declares constraints on inputs, expectations of outputs,
>>> performance issues, etc.
>
>> What programming language are you using? If your answer is "C",
>> it's wrong.
>>
>> If you are just putting these things in comments, then they will get out
>> of sync with the code.
>
> I'd have to agree. I've worked with many projects and third-party
> libraries over the decades which had a big template of comments for
> every function which described the input/ouput parameters, return
> value, global variables used, and so on.
>
> Often these templates generated documents by using something like
> Doxygen.
>
> And on _every_single_one_ of those projects and libraries, the
> comments were wrong often enough that nobody who knew which way was up
> paid any attention to them. If you wanted to know what the parameters
> were for, what the function returned, and so on, you read the C code.
>
> A lot of the time, even the numbers and names of the parmeters
> described in the template didn't match the code.
>
> The auto-generated PDF documents and HTML web site looked nice, though.
>

Accuracy of such in-code documentation varies, but there is generally no
way to check it automatically. That's one of the reasons it is better
to use constructs in the programming language, where possible, rather
than documentation and comments. For preconditions, postconditions and
invariants, you need a language that has support for contracts. For
other languages, usually the best you can do is careful choice of names
and types, along with assert statements.

Still, Doxygen-like comments in code are usually better synchronised
with the code than external documentation!

Re: Ftn I/Os documentation best practices

<t9d7pa$oetg$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=937&group=comp.arch.embedded#937

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: blockedo...@foo.invalid (Don Y)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Mon, 27 Jun 2022 14:34:32 -0700
Organization: A noiseless patient Spider
Lines: 109
Message-ID: <t9d7pa$oetg$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
<t9chnf$kve$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Mon, 27 Jun 2022 21:34:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="118df638525767887239bc30af252808";
logging-data="801712"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4VVuPTEIr5YU5k35iSWyu"
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.1.1
Cancel-Lock: sha1:cDJ0xKKT8R2mn3x0+nlzWNvzsiA=
Content-Language: en-US
In-Reply-To: <t9chnf$kve$1@reader2.panix.com>
 by: Don Y - Mon, 27 Jun 2022 21:34 UTC

On 6/27/2022 8:18 AM, Grant Edwards wrote:
> On 2022-06-27, David Brown <david.brown@hesbynett.no> wrote:
>> On 26/06/2022 21:35, Don Y wrote:
>>> I add a boilerplate to each function definition that
>>> declares constraints on inputs, expectations of outputs,
>>> performance issues, etc.
>
>> What programming language are you using? If your answer is "C",
>> it's wrong.
>>
>> If you are just putting these things in comments, then they will get out
>> of sync with the code.
>
> I'd have to agree. I've worked with many projects and third-party
> libraries over the decades which had a big template of comments for
> every function which described the input/ouput parameters, return
> value, global variables used, and so on.

You perhaps missed the balance of my post:

"I use this to add invariants to the code to detect/enforce
these conditions."
...
"I'm looking at ways to create an IDL that will allow for
more specific criteria to be included in the declaration
that could also drive the IDL compiler to add suitable
invariants as applicable."

I.e., a "specification language" FROM WHICH the IDL compiler can
(I am currently using an enhanced form of OCL) create the code -- in
whatever language binding is selected AT COMPILE TIME.

So, if I say:
month > 0
AND
month < 13
as constraints *in* the function's "prototype", then
the IDL compiler generates an invariant that throws a
"range error" OR panics (depending on IDL compiler switch)
AT RUN TIME if the function is invoked with the "month"
parameter not compliant with those constraints.

The OCL *documents* the calling constraints of the
function (and its return values) in a language neutral
manner. I.e., you could create an ASM binding for the
IDL compiler's output and the programmer would be
none the wiser.

The advantage of driving the code generator this way is
the "documentation" creates the code -- if you don't
*document* (declare) a constraint, then it isn't enforced.

It ensures the code and documentation agree and that
every bit of documentation has a corresponding bit of
code (but not necessarily the other way around)

> Often these templates generated documents by using something like
> Doxygen.
>
> And on _every_single_one_ of those projects and libraries, the
> comments were wrong often enough that nobody who knew which way was up
> paid any attention to them. If you wanted to know what the parameters
> were for, what the function returned, and so on, you read the C code.

You *always* read the code. The OCL declarations *are* effectively
code; the stub generated *will* reference "month" and not "moth"
or "monday" (or whatever). But, they are formally expressed in a
syntax defined by the "specification language" (~OCL in my case).

Invoking the exemplar with a month of "13" could possibly work
within the body of the function, as implemented -- perhaps treating
this as year++ with month=1 -- but the invariant won't let the
value *into* the function. Because the intent was *not* to invoke
the function with a bogus month value.

19A0 is not 2000!

The whole point is to encourage the developer to codify (in OCL)
the constraints on the code so that the IDL compiler can create
the actual instruction sequence (in the language bound to that set
of command line switches) to enforce those constraints.

*But*, you are still reliant on discipline; if the developer
doesn't declare those constraints, then the compiler can't create
any code to do this and simply is resigned to creating the code
to marshal arguments and pack the message for transport.

One can casually inspect the IDL files to see if there is an
abundance -- or a dearth -- of constraints without having to
parse countless source files. The IDL files *generate* the
"header" files so you can't skip that step.

Additionally, it can generate the sever side stubs (in whichever
language binding is appropriate *there*) to unpack and parse
the message, convert the arguments to whatever format is "native"
for the server (knowing that their values are "legitimized" by
the client-side stub) and hand them off to the server-side
function.

[similarly handling the return message]

> A lot of the time, even the numbers and names of the parmeters
> described in the template didn't match the code.
>
> The auto-generated PDF documents and HTML web site looked nice, though.

There's no point in generating "prose" from such a specification.
What are you going to do, pretty-print the generated stubs? Or,
the OCL-expressed constraints?

Re: Ftn I/Os documentation best practices

<t9ee7a$11moq$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=940&group=comp.arch.embedded#940

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail
From: step...@vfxforth.com (Stephen Pelc)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Tue, 28 Jun 2022 08:30:35 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 53
Message-ID: <t9ee7a$11moq$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me> <t9chnf$kve$1@reader2.panix.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 Jun 2022 08:30:35 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="355528ca6a55aeee0af5f65a31c8f794";
logging-data="1104666"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19bfbJpdl/gSIeBEZc0KAMq"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:18xUlRa9VKVJYXsOact7wCx4y8Q=
X-Usenapp: v1.21.1/l - Full License
 by: Stephen Pelc - Tue, 28 Jun 2022 08:30 UTC

On 27 Jun 2022 at 17:18:07 CEST, "Grant Edwards" <invalid@invalid.invalid>
wrote:

>> If you are just putting these things in comments, then they will get out
>> of sync with the code.
>
> I'd have to agree. I've worked with many projects and third-party
> libraries over the decades which had a big template of comments for
> every function which described the input/ouput parameters, return
> value, global variables used, and so on.
>
> Often these templates generated documents by using something like
> Doxygen.

For the last 20 years or so, virtually all our manuals have been created
by our own "literate programming" system called DocGen. DocGen is
optimised for Forth, but it would not be a big job to write a version for C.

DocGen diverges from Doxygen and friends in a several ways. In
particular it does not need template blocks. If your C code is so bad
that another programmer cannot read the declaration, you need far
more help than DocGen or Doxgen can give you. The main entry
for a function follows the declaration

float someFunc( int how, double x, double y )
// *G The purpose of *\c{someFunc} is ...
// ** ...
{ ...
}

The lines starting // *x are formal comments to be processed by
DocGen. The *X parts are formatting commands, and the *\<name>{}
parts are text macros.

The ideas behind DocGen are that the code and the documentation
are never separated, and that the DocGen portion is not much larger
than the descriptive comments you should have in your code anyway.
Keeping the code in sync with the documentation is a matter of
company culture and management.

Whenever we receive third party code to include in our products,
we *always* DocGen it before release and we *always* find some
bugs. Overall, I estimate that writing the documentation alongside
the code costs about 10% extra, paid for by the reduction in bug level.

Stephen
--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: Ftn I/Os documentation best practices

<t9eppk$12tii$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=943&group=comp.arch.embedded#943

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Tue, 28 Jun 2022 13:48:03 +0200
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <t9eppk$12tii$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
<t9chnf$kve$1@reader2.panix.com> <t9d7pa$oetg$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 Jun 2022 11:48:04 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="0f0ed35a544af7ba0b1c7f4ccd562388";
logging-data="1144402"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+g4FvipbD+HMG8e2hztx1VKc426tMvIMo="
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101
Thunderbird/91.9.1
Cancel-Lock: sha1:mrWLsn6Z1d4Dco1KbFoMUViuXDc=
In-Reply-To: <t9d7pa$oetg$1@dont-email.me>
Content-Language: en-GB
 by: David Brown - Tue, 28 Jun 2022 11:48 UTC

On 27/06/2022 23:34, Don Y wrote:
> On 6/27/2022 8:18 AM, Grant Edwards wrote:

>>
>> The auto-generated PDF documents and HTML web site looked nice, though.
>
> There's no point in generating "prose" from such a specification.
> What are you going to do, pretty-print the generated stubs?  Or,
> the OCL-expressed constraints?

That is /exactly/ what you do with tools like Doxygen - it extracts
/interface/ information (function prototypes, type declarations, etc.),
strips it of implementation-specific details, merges the comments (which
should hopefully be in sync with the code), and generates clear,
readable, searchable, cross-referenced documentation.

You use tools like that precisely so that people using your library or
code do /not/ read the C code. You don't even have to read the header
files.

And if you are formalising your prototypes with some kind of interface
description language to include preconditions, postconditions and
invariants, then you want them included in the generated documentation.
Ideally, that's what people will read, rather than the IDL source code
or the generated C headers.

The key point of separation of interfaces and implementations is that
people using the code should /only/ use the documented interfaces, and
not rely on anything involved in the implementation. So make the
information about those interfaces clear and precise - such as good
quality generated documentation - and make it accurate - such as by
using an IDL.

Re: Ftn I/Os documentation best practices

<t9etde$138s6$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=944&group=comp.arch.embedded#944

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: blockedo...@foo.invalid (Don Y)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Tue, 28 Jun 2022 05:49:41 -0700
Organization: A noiseless patient Spider
Lines: 93
Message-ID: <t9etde$138s6$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
<t9chnf$kve$1@reader2.panix.com> <t9ee7a$11moq$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 28 Jun 2022 12:49:50 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7c29ff7c409fdfc854a7e9b00e679e46";
logging-data="1155974"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19NmzsxP3eJ4169Crq+ad3w"
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.1.1
Cancel-Lock: sha1:IB69VRwOYYSkCJZbwQtgeeasYM0=
Content-Language: en-US
In-Reply-To: <t9ee7a$11moq$1@dont-email.me>
 by: Don Y - Tue, 28 Jun 2022 12:49 UTC

On 6/28/2022 1:30 AM, Stephen Pelc wrote:
> On 27 Jun 2022 at 17:18:07 CEST, "Grant Edwards" <invalid@invalid.invalid>
> wrote:
>
>>> If you are just putting these things in comments, then they will get out
>>> of sync with the code.
>>
>> I'd have to agree. I've worked with many projects and third-party
>> libraries over the decades which had a big template of comments for
>> every function which described the input/ouput parameters, return
>> value, global variables used, and so on.
>>
>> Often these templates generated documents by using something like
>> Doxygen.
>
> For the last 20 years or so, virtually all our manuals have been created
> by our own "literate programming" system called DocGen. DocGen is
> optimised for Forth, but it would not be a big job to write a version for C.
>
> DocGen diverges from Doxygen and friends in a several ways. In
> particular it does not need template blocks. If your C code is so bad
> that another programmer cannot read the declaration, you need far
> more help than DocGen or Doxgen can give you. The main entry
> for a function follows the declaration
>
> float someFunc( int how, double x, double y )
> // *G The purpose of *\c{someFunc} is ...
> // ** ...
> {
> ...
> }
>
> The lines starting // *x are formal comments to be processed by
> DocGen. The *X parts are formatting commands, and the *\<name>{}
> parts are text macros.
>
> The ideas behind DocGen are that the code and the documentation
> are never separated, and that the DocGen portion is not much larger
> than the descriptive comments you should have in your code anyway.
> Keeping the code in sync with the documentation is a matter of
> company culture and management.
>
> Whenever we receive third party code to include in our products,
> we *always* DocGen it before release and we *always* find some
> bugs. Overall, I estimate that writing the documentation alongside
> the code costs about 10% extra, paid for by the reduction in bug level.

I do this by using a specific "paragraph tag" in FrameMaker documents
(e.g., "Code") and then have a simple utility that extracts all thusly
tagged paragraphs to create the "source file" -- which is then
compiled <however>.

[FM files are relatively easy to parse and the format has been
consistent for many releases; I wouldn't think of this sort of
approach with MSWord acting as "container"!]

It adds an extra step to the process (because the source doesn't exist
until extracted from the document).

But, it is ill-suited to producing "manuals" as the presentation
must be linear with the code; you can't tangle/weave to arrange
the code in a different order than the documentation.

OTOH, it is excellent for mixing multimedia with "code"; I can put
an illustration between "if" and "then". Or, a sound snipet to
indicate what a particular (audio) waveform -- expressed as an
array of floats -- *sounds* like adjacent to those constants.
This is particularly helpful with domain-specific constructs,
mechanisms and phenomena with which a generic programmer might
not have prior experience.

I document the "rationale" and "strategy" behind the code, elsewhere.
That can take the "30,000 ft view" of the code and usually needs
infrequent maintenance. E.g., why was Q12.4 format chosen? Show
me the error analysis behind that choice relative to other formats.

Keeping modules short and supporting other non-text annotations
makes it relatively easy for folks to understand the specifics of
an implementation.

But, all of these techniques (yours included) rely on discipline.
There's nothing that mechanically verifies the code and comments
agree. Even semi-automatic mechanisms rely on the developer
having *created* them (e.g., #including an audio file that
was generated by extracting those floats and converting them
to audio). Too often, the "solution" is simply to remove
comments rather than ensuring they are maintained.

Sadly, my experience has been that folks aren't keen on keeping
docs and code in sync and the more documentation, the less it
tends to track the code. Especially for projects that "evolved"
instead of being "designed". (each refactor requiring a substantial
reframing of the commentary)

Re: Ftn I/Os documentation best practices

<t9f3k6$13v04$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=945&group=comp.arch.embedded#945

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: step...@vfxforth.com (Stephen Pelc)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Tue, 28 Jun 2022 14:35:50 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <t9f3k6$13v04$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me> <t9chnf$kve$1@reader2.panix.com> <t9ee7a$11moq$1@dont-email.me> <t9etde$138s6$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Tue, 28 Jun 2022 14:35:50 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="355528ca6a55aeee0af5f65a31c8f794";
logging-data="1178628"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186h9svc1r/IF9UkGjJ2Sst"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:P9HBhLi9kSCMo6dCyfOtiePe9Uk=
X-Usenapp: v1.21.1/l - Full License
 by: Stephen Pelc - Tue, 28 Jun 2022 14:35 UTC

On 28 Jun 2022 at 14:49:41 CEST, "Don Y" <blockedofcourse@foo.invalid> wrote:
>> The ideas behind DocGen are that the code and the documentation
>> are never separated, and that the DocGen portion is not much larger
>> than the descriptive comments you should have in your code anyway.
>> Keeping the code in sync with the documentation is a matter of
>> company culture and management.

> Sadly, my experience has been that folks aren't keen on keeping
> docs and code in sync and the more documentation, the less it
> tends to track the code. Especially for projects that "evolved"
> instead of being "designed". (each refactor requiring a substantial
> reframing of the commentary)

As others have said it needs discipline. Discipline comes from
management. As the boss, I have made it quite clear that use
of DocGen is a requirement to work at the company. In turn
it is my job to ensure that people know how to use the tool.

Stephen

--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: Ftn I/Os documentation best practices

<t9fhig$15h2v$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=947&group=comp.arch.embedded#947

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: blockedo...@foo.invalid (Don Y)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Tue, 28 Jun 2022 11:33:42 -0700
Organization: A noiseless patient Spider
Lines: 43
Message-ID: <t9fhig$15h2v$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9bmlm$bic9$1@dont-email.me>
<t9chnf$kve$1@reader2.panix.com> <t9ee7a$11moq$1@dont-email.me>
<t9etde$138s6$1@dont-email.me> <t9f3k6$13v04$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 28 Jun 2022 18:33:53 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="7c29ff7c409fdfc854a7e9b00e679e46";
logging-data="1229919"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Z5d+EHPODRZIHdAGqBB2Z"
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.1.1
Cancel-Lock: sha1:6df/S7hY48KZ/YiEW9GqqKuRLqs=
In-Reply-To: <t9f3k6$13v04$1@dont-email.me>
Content-Language: en-US
 by: Don Y - Tue, 28 Jun 2022 18:33 UTC

On 6/28/2022 7:35 AM, Stephen Pelc wrote:
> On 28 Jun 2022 at 14:49:41 CEST, "Don Y" <blockedofcourse@foo.invalid> wrote:
>>> The ideas behind DocGen are that the code and the documentation
>>> are never separated, and that the DocGen portion is not much larger
>>> than the descriptive comments you should have in your code anyway.
>>> Keeping the code in sync with the documentation is a matter of
>>> company culture and management.
>
>> Sadly, my experience has been that folks aren't keen on keeping
>> docs and code in sync and the more documentation, the less it
>> tends to track the code. Especially for projects that "evolved"
>> instead of being "designed". (each refactor requiring a substantial
>> reframing of the commentary)
>
> As others have said it needs discipline. Discipline comes from
> management. As the boss, I have made it quite clear that use
> of DocGen is a requirement to work at the company. In turn
> it is my job to ensure that people know how to use the tool.

You can "legislate" the use of a tool or adherence to a standard.
But, these are subjective issues -- not like "derate all caps by
40%" (which can be independently, mathematically verified). You
rely on individual "employees" for their judgement as to the
effectiveness of their documentation. Likewise, the efficacy
of their test/validation efforts.

EVERY employer and client I've ever worked with has had formal
standards regarding code "style", documentation, testing, etc.
"The Boss" in these cases have ranged from accountants, to
mechanical engineers, to electrical engineers ("no longer
practicing"), to economists. I.e., they can mandate but aren't
qualified to evaluate the quality of the work performed.

You can have peers review each others' work. But, I've not seen
that improve the work of folks who just don't have the drive
to "do better". (And I can't remember anyone EVER being fired
for incompetence!)

The true test of this is handing the design to another party
(i.e., SELLING the design) and seeing how well the new owner
can come up to speed on the product. If you have staff available
"later" that can be consulted wrt their previous work on a
design, then folks need not completely rely on print documentation.

Re: Ftn I/Os documentation best practices

<t9hh19$1e8en$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=949&group=comp.arch.embedded#949

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!news.freedyn.de!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: step...@vfxforth.com (Stephen Pelc)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Wed, 29 Jun 2022 12:36:57 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <t9hh19$1e8en$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9etde$138s6$1@dont-email.me> <t9f3k6$13v04$1@dont-email.me> <t9fhig$15h2v$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=fixed
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 29 Jun 2022 12:36:57 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="cd8761cd592225d1c8e6fd6e77f0b222";
logging-data="1515991"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18GbB1xLj/u1F7IwNS2pgr0"
User-Agent: Usenapp for MacOS
Cancel-Lock: sha1:M7GvXFB04AzXFvepaUtz4gDjW9s=
X-Usenapp: v1.21.1/l - Full License
 by: Stephen Pelc - Wed, 29 Jun 2022 12:36 UTC

On 28 Jun 2022 at 20:33:42 CEST, "Don Y" <blockedofcourse@foo.invalid> wrote:

> On 6/28/2022 7:35 AM, Stephen Pelc wrote:
>> As others have said it needs discipline. Discipline comes from
>> management. As the boss, I have made it quite clear that use
>> of DocGen is a requirement to work at the company. In turn
>> it is my job to ensure that people know how to use the tool.
>
> You can "legislate" the use of a tool or adherence to a standard.
> But, these are subjective issues -- not like "derate all caps by
> 40%" (which can be independently, mathematically verified). You
> rely on individual "employees" for their judgement as to the
> effectiveness of their documentation. Likewise, the efficacy
> of their test/validation efforts.

Followed by lots more pointless whining.

Changing company culture is really hard, even for my own
company. I'm an electronics engineer by training, and I have
been writing software since 1967, and I still write production
code.

I may not have fired people directly for not being good enough,
but I have certainly strongly encouraged them to get another job.

Stephen

--
Stephen Pelc, stephen@vfxforth.com
MicroProcessor Engineering, Ltd. - More Real, Less Time
133 Hill Lane, Southampton SO15 5AF, England
tel: +44 (0)23 8063 1441, +44 (0)78 0390 3612, +34 649 662 974
http://www.mpeforth.com - free VFX Forth downloads

Re: Ftn I/Os documentation best practices

<t9hkng$1elm7$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=950&group=comp.arch.embedded#950

  copy link   Newsgroups: comp.arch.embedded
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail
From: blockedo...@foo.invalid (Don Y)
Newsgroups: comp.arch.embedded
Subject: Re: Ftn I/Os documentation best practices
Date: Wed, 29 Jun 2022 06:39:49 -0700
Organization: A noiseless patient Spider
Lines: 71
Message-ID: <t9hkng$1elm7$1@dont-email.me>
References: <t9acer$d1t$1@dont-email.me> <t9etde$138s6$1@dont-email.me>
<t9f3k6$13v04$1@dont-email.me> <t9fhig$15h2v$1@dont-email.me>
<t9hh19$1e8en$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Wed, 29 Jun 2022 13:40:00 -0000 (UTC)
Injection-Info: reader01.eternal-september.org; posting-host="98d6c61f13086271d335a81c40cae77f";
logging-data="1529543"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19u5E/wQ6B/FuI3tBA6pKKk"
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101
Thunderbird/52.1.1
Cancel-Lock: sha1:LVN7wS/EOacDaD5Whj7EoAqa6Is=
Content-Language: en-US
In-Reply-To: <t9hh19$1e8en$1@dont-email.me>
 by: Don Y - Wed, 29 Jun 2022 13:39 UTC

On 6/29/2022 5:36 AM, Stephen Pelc wrote:
> On 28 Jun 2022 at 20:33:42 CEST, "Don Y" <blockedofcourse@foo.invalid> wrote:
>
>> On 6/28/2022 7:35 AM, Stephen Pelc wrote:
>>> As others have said it needs discipline. Discipline comes from
>>> management. As the boss, I have made it quite clear that use
>>> of DocGen is a requirement to work at the company. In turn
>>> it is my job to ensure that people know how to use the tool.
>>
>> You can "legislate" the use of a tool or adherence to a standard.
>> But, these are subjective issues -- not like "derate all caps by
>> 40%" (which can be independently, mathematically verified). You
>> rely on individual "employees" for their judgement as to the
>> effectiveness of their documentation. Likewise, the efficacy
>> of their test/validation efforts.
>
> Followed by lots more pointless whining.

First-hand examples of how "discipline" doesn't work, in practice.

If you've been "lucky", then "good for you". You're likely the
Exception and not the Rule. You've led a blessed existence. So,
likely aren't competent to comment on life with "less angelic"
employees.

Please let us know your progress on addressing world hunger...

> Changing company culture is really hard, even for my own
> company. I'm an electronics engineer by training, and I have
> been writing software since 1967, and I still write production
> code.

Now, imagine your products hosted code written by other people.
Outside of your organization. What sort of reach do you have
into THEIR corporate culture? Do you act as PHYSICAL gatekeeper
and prohibit "unblessed" code from being installed on your
products? Do *you* take on the job of creating every application
and hardware module that any of your users might conceivably want
(because you trust your own efforts, exclusively)?

How eager will you be for your customers to have their experiences
with YOUR product tainted by those other "components"? Will they
be sophisticated enough to know that the quality issues arise not
from YOUR portion of the work but from the efforts of others?
Will they be able to determine *which* others (so they can excise them)?

[Imagine the resolver in your PC being unreliably written by X.
Will the user recognize that the resolver's faults are the
reason behind the poor performance of the browser? Or, flaws
in the filesystem implementation the reason for application
failures/data loss? Or...]

I want mechanisms that make it easy for people to "do the right
thing", despite their inclination to do otherwise. I'm not
keen on waiting for them to "see the light". Nor do I have
the ability to coerce them to do so.

But, if I make The Right Path easier to follow than the "wrong"
ones, they are more likely to follow it out of laziness/self-interest.

> I may not have fired people directly for not being good enough,

Why not? Especially if it's YOUR company? Imagine the hesitance
to doing so when The Boss is just an employee of some corporate
entity -- not *his* name above the door.

> but I have certainly strongly encouraged them to get another job.

So, you "reworked" any work they did for you up until the time
of their departure? Or, did you just let it slide -- *into* your
products?

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor