On Thursday, August 31, 2017 at 10:19:56 AM UTC+2, Mat wrote:
As reflected on elsewhere,
tiddler philosophy is pretty close to "encapsulation philosophy" in programming (...as far as I can tell. I'm not a coder.)
Encapsulation in terms of "one function should only be doing one thing well" is a good thing.
... but ...
In terms of "documentation" we want to break this paradigm. Documentation shouldn't be separated from the source code. Programmers are "lazy". They change the code, but don't fix the docs ;) ... That's one of the biggest problems we have to face.
I actually found TW, as I was searching for a "literate programming"
editor. Literate programming is a concept, that allows you to mix "documentation" with "code"... So you only have to maintain
one "source of truth" ...
TW's transclusion concept is exactly one part of the equation. It allows us to mix TW-text with code of any language.
eg:
! Heading
Some literate description about the problem. ... A very detailed description.
{{code-tiddler}}
Some more text ...
The problem we are facing now, is that we need a mechanism to extract the code from the docs __AND__ convert the docs into a human readable format, that contains the code and the docs!
Tiddlers could "mirror" a general code function, e.g with the title of the tiddler serving as the function name, a predefined parameters field, using field names+values as variable declarations, etc. One function = one tiddler. (...embracing another, perhaps more aesthetic, philosophy of "everything is a tiddler")
This paragraph imo is way to "solution" oriented. It's very specific and not as generic as it should be. ... It reflects a certain point of view - yours. Which is perfectly fine. ... But it also limits its possible usecases. Cases which I and you may not think about in the moment. ...
A user friendly UI for building complex multi-function code could consist of drag'n dropping tiddlers into a flow sequence perhaps comparable to
Scratch programming or Google
Blockly. (BTW, the next version of the former will be based on the latter.)
That's possible. ... Someone with enough time and resources just needs to do it.
Also widgets could have this physical manifestation for a GUI.
Very early alpha versions of TW had their own widget-GUI in tiddler edit mode. ... But widgets and their parameters changed so fast, that it was impossible to keep the GUI up to date. It was hard to maintain and it also was ugly (sry to say that :) ... So it needed to be removed.
The widget parameters are pretty stable now. ... So there could be a new approach to create a GUI to create "wiki-text-programs".
Perhaps two tiers for editing: a GUI mode and a text based mode.
Hihi, ... one more system to maintain ;)
The idea is worth considering;
it should definitely increase re-usability for code. The tiddler-as-function-shell format would also encourage TW philosophy... or, if this was the only option for creating functions /macros, then it would simply force users into understanding tiddler philosophy.
ouch ... do you really think we should "force" users? ... We need some rules - yes. But IMO the system needs to be generic enough to let the users do what they want. The system needs to go out of the users way.
- If the user wants big tiddlers -- fine.
- If the user wants small tiddlers -- fine too!
Currently, I find myself making huge monolithic tiddlers with complex macros because separate macro-tiddlers force re-rendering which makes in-TW dev hard. Separate tids currently also makes you loose overview.
That's not really your problem. It's an "editor problem". ... At the moment we have to start with big tiddlers defining many macros in one tiddler, because macros are "hidden" when you save them.
There is a workaround that I stole from Eric (thx :)
\define macro()
do something
\end
<pre><$view field="text"/></pre>
If you put the above line into macro source tiddlers you can read them in view mode, without side effects.
......... which brings us back to Literate Programming.
To be able to mix code and a literate description of code, we need to improve our UI ... a little bit. _But_ we have all the pieces already built in to TW.
have fun!
mario