I fully planned to do something about this over Christmas, but alas, family
had other plans, and thanks for that.

Now however I got a working prototype of what I wanted to build:

https://github.com/kasperosterbye/PlantUMLDiagrams

The tools are intended as investigation tools. Similar or better tools
might be out there, but I mistook this to be a minor thing, and ended up
spending too much time on this.

And thanks to Christopher Fuhrman for the plantuml gizmo. I extracted a
minimal interface out of his code, which I have put up as a separate
project (https://github.com/kasperosterbye/PlantUMLBridge) simply because
it is such cool code, and I wanted to be able to do the minimal plantuml
integration possible without commitment to any pharo tooling.

Best,

Kasper


On 20 December 2019 at 21.30.00, Christopher Fuhrman (
christopher.fuhr...@etsmtl.ca) wrote:

Kasper,

There's a way to run PlantUML to process in a pipe (stdin/out) which gives
pretty good performance for rendering:

java -Djava.awt.headless=true -jar plantuml.jar -pipe -tsvg -charset UTF-8


It takes a PlantUML source as input and generates the format of the file
(e.g. SVG) on stdout. The VSCode extension called  markdown-preview-enhanced
<https://github.com/shd101wyy/markdown-preview-enhanced> runs it this way.
Because of the pipe complexity (and the fact that your machine needs a JVM,
GraphViz and a properly configured path, etc.), I never tried to use it
this way in Pharo.

The markdown-preview-enhanced extension for VSCode does a lot of things
(too many?) but I think of pillar when I use it. It shows an HTML version
in real-time as you type, which includes PlantUML diagrams. You can use
pandoc to get to LaTeX/PDF as final output. I'm using it for my course
notes because of this, but also because it does reveal output (useful for
presenting), too. If I had a Mac, I would use pillar :) -- I struggled with
using it in Windows 10 with MikTeX (which I use very well with LyX).

If my memory serves me, Pavel K. and/or Julien D. had done a visitor in
Pharo that would generate PlantUML script from (moose?) (meta)models, but I
can't remember the precise details. I didn't aim for the sexy visitor
version when I did the Moose support because I wanted people to be able to
choose easily what classes to include in the diagram (because there's
usually some context for it to be useful). A list with classes inside a
hierarchy (the way we did it in Moose) seemed to be adequate. I'm pretty
sure you could make an intuitive browser (or reuse the current one) with
filters to select the classes for the diagram.

As for using UML to make diagrams, I also have toyed with the idea of
making an editor on top of PlantUMLs SVG, such that you could change the
source script intuitively. For example, if you don't want to see the 30+
messages a class supports, you can right click on the class in the SVG and
choose a "hide" option. Sadly, the SVG that is generated by PlantUML is
more for drawing (it was ported from the PNG code I think) and so things
like a bounding box of a class or the IDs for classes don't exist. Classes
are "drawn" as a rectangle for the title, a rectangle for the attributes,
etc. However, those are all things that could be coded back into PlantUML
(it's open source). SVG (in a modern browser at least) can be pretty
powerful.

These days, the only UML diagrams I "draw" are on whiteboards or an
electronic sketch pad (Surface pro). Pushing rectangles and lines around in
a graphics editor is something that only makes me anxious (I have used some
Visio templates a few years ago, but they're all now requiring too many
clicks when you're used to PlantUML). Plus, PlantUML also supports many
other formats (including DOT, just put @startdot/@enddot).

On Fri, 20 Dec 2019 at 14:31, Kasper Østerbye <kasper.oster...@gmail.com>
wrote:

> On 20 December 2019 at 19.59.05, tbrunz (wild.id...@gmail.com) wrote:
>
> What I would find useful (and what I think Kasper has started down the
> road
> to) is the ability to generate PlantUML script from a specified (set of)
> packages or classes in Pharo. That would make it easy not only to examine
> the design (in a more synoptic way -- something I've seen several other
> newcomers express an interest in), but also to embed diagrams in
> documentation such as PDFs & web pages.
>
> I expect that to be done over the hollidays. I expect to have a working
> copies of
>
> - Generate object diagram from a root (I will filter on category names and
> subclasses)
>
> - Generate a sequence diagram by analysing a MessageTally from a block.
> Filter on categories, subclasses and methods
>
> Short of that, and probably much easier to implement, is to just add
> PlantUML script to Pharo class comments as you write them -- but have a
> simple way to trigger the system to parse the comment and render the
> script
> into PlantUML diagrams. This could be in the form of opening a web browser
> in the host and having the diagram appear via the PlantUML server. But
> more
> useful perhaps would be to have it create PNG file(s) in the host
> filesystem
> (and open them).
>
> I have that working in my image. The
> https://github.com/kasperosterbye/PillarRichTextRender allow pillar to be
> used and rendered in class and package comments. Again, in my image I have
> an extension which allow the [[[ … ]]] syntax of pillar (and ```of github)
> to use a language called ‘plantuml’, which renders the diagram in the
> documentation. I hope to package it all up over the holidays or early
> January. The same thing allow latex math to be rendered in those same
> comments.
>
> Best,
>
> Kasper
>


--
Christopher Fuhrman, P.Eng., PhD

*Professeur au Département de génie logiciel et des technologies de
l'information ÉTS (École de technologie supérieure)*

http://profs.etsmtl.ca/cfuhrman
+1 514 396 8638
*L'ÉTS est une constituante de l'Université du Québec*

Reply via email to