architecture

2018-05-04T20:09:54.000559Z

Why do or dont you use literate programming techniques?

alexmiller 2018-05-04T20:13:37.000059Z

if I can’t even keep my docstrings up to date, what hope do I have in keeping additional prose correct? really good literate programs also take exceptional care about the “story” and order inherent in the code. I have no desire to add that additional constraint on either initial dev or refactoring. that is, my perception is that there is substantial cost to using literate programming with unproven roi.

alexmiller 2018-05-04T20:13:51.000132Z

so that’s my don’t :)

seancorfield 2018-05-04T20:17:24.000311Z

I mostly agree with Alex. I've tried it several times and I've not found it to help with maintenance at all. On one project, I found it helped with the initial design/build: the requirements were very sparse, so I write it all out in prose and used Marginalia to generate HTML which I shared with the business team. We went back and forth over the text several times, and I slowly started converting the prose to code, but then found the prose/comments inside the code just made the code hard to read in my editor (the generated HTML was fine).

seancorfield 2018-05-04T20:17:45.000533Z

Good, easy-to-read code should not need/have comments littered through it, in my opinion.

👍 1
seancorfield 2018-05-04T20:18:24.000414Z

But literate programming really focuses on the text, with the code almost as a secondary concern, and that seems backwards to me.

2018-05-04T20:19:16.000225Z

@alexmiller Thanks for sharing.

seancorfield 2018-05-04T20:19:44.000512Z

That project has ended up with a fair bit of prose still, in "section" comments between groups of functions and in some (overly) large docstrings. And at this point, the code is drifting away from the prose and docstrings -- which makes it misleading and an obstacle to future maintenance. So simply removing the text would help at this point.

alexmiller 2018-05-04T20:20:36.000533Z

I’d be more interested in tools that help explain the code that exists than write static text that tries to explain it

spfeiffer 2018-05-05T08:41:04.000060Z

I thought you Cognitect guys do that in your hammocks ☺️

seancorfield 2018-05-04T20:20:53.000254Z

☝️:skin-tone-2: Yes, this!

alexmiller 2018-05-04T20:23:40.000067Z

I love the idea of literate programming and someone sitting down with a pipe in their library to consume the great works of code…. that just doesn’t match the reality I live in :)

john 2018-05-04T20:24:03.000175Z

lol

john 2018-05-04T20:25:04.000350Z

is there a literate programming framework in Clojure that allows you to instrument fns separately, perhaps from another ns, which live in a registry, similar to spec?

john 2018-05-04T20:25:20.000410Z

So I wouldn't have to couple my doc with my code?

seancorfield 2018-05-04T20:26:41.000273Z

@john That sounds like an even bigger recipe for code and docs getting out of sync!

john 2018-05-04T20:27:02.000570Z

with the idea that they'd be "consumed" through some viewer

john 2018-05-04T20:29:48.000343Z

@seancorfield good point. But perhaps chasing that goal is too hard. Perhaps the leverage of having a manageable doc-base would be more beneficial than having them up-to-the-minute current with the code... Not sure.

john 2018-05-04T20:30:37.000400Z

And that assumes the docs could be consumed by various tools

john 2018-05-04T20:30:51.000347Z

or views

seancorfield 2018-05-04T20:30:56.000499Z

I've never worked anywhere that seems able to keep their documentation up-to-date with their code, making the documentation anything from useless to only mildly helpful.

john 2018-05-04T20:31:14.000169Z

aye

seancorfield 2018-05-04T20:31:14.000374Z

Only very high level documentation ever seems to remain accurate.

2018-05-04T20:33:44.000370Z

Part of the problem is that its hard to define the goal.

2018-05-04T20:35:12.000256Z

The reward for doing the thing were trying to do is somewhat more clear. Its not clear what there is to gain from helping people understand it. Or what would help them understand it.

john 2018-05-04T20:40:42.000487Z

you don't know what they don't know they don't know 😂

2018-05-04T21:07:19.000047Z

My intuition is to agree with @seancorfield @alexmiller and @john on that its hard to justify the effort. To @alexmiller’s point, and one which i have given a little thought, i think there might be an opportunity to design in such a way that your system explains itself both at the functionality level but that also tells a narrative. For example, the code is very open ended, you can pass any number of options… but a narrative would tell me which options people usually pass and show me what the normal output_ looked like. I think in order to do this, the system would need side effects to be isolated. I suspect there is nothing novel here 🙂