emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Docstrings and literate programming (good practices?)


From: tomas
Subject: Re: Docstrings and literate programming (good practices?)
Date: Fri, 4 Nov 2022 09:06:40 +0100

On Fri, Nov 04, 2022 at 07:39:04AM +0100, Marcin Borkowski wrote:
> 
> On 2022-11-04, at 06:45, tomas@tuxteam.de wrote:

[...]

> > Ah. Javadoc and their descendants. I tend to call that "illiterate
> > programming"...
> 
> I spat my tea. :-)  Thanks, that's a nice one!

Sorry to hear that ;-P

> Though this _may_ work in some cases.  For example, imagine you divide
> your package into two files – one with user-facing commands and another
> one with internal functions.  If you order the former one carefully, the
> "extract docstrings" might actually work as a documentation.

Yes, of course it's just a tool; but that kind of tool all too often
seduces people to switch to auto-pilot.

How many Doxygen docs have I had which tell me that function so-and-
so takes an int as third argument? I can see that by inspecting the
source! As a bonus, I don't get that much optical fluff and don't
have to go to the browser to look at it.

> Still, a "normal" documentation seems a better (even if more
> time-consuming) options.

Yes, it takes work.

> Also, such docstring-based documentation is still better than none.

That depends on how much work goes into the docstring. This:

  /* add 2 to x */
  x += 2;

is the typical quality you get when you're writing the docs while
waist-deep in the code. If you want good docs, you have to take a
step back and try to put yourself into the mind of someone else
(i.e. "forget" for a moment all the implicit knowledge you have
about that code you've been intimate with for weeks, perhaps for
years). That's not easy :)

Cheers
-- 
t

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]