Feature Poll for Version 22

Thanks to everyone who voted in our feature poll for Version 22! This feedback is essential ensuring that you get the software you want. Here are the results.

Being able to save diagrams was the most popular feature, narrowly edging out AI integration. Adding a chat feature generated the least interest.

We also got a lot of comments from respondents. Thanks for those! I really appreciate all this detailed feedback. Several of the comments requested features that PlantText already has. So clearly we’re in need of better help documentation! Actually, that was another request, lol. I’m hoping to add a series of help videos soon, but that’s been slow going. Some of these already present features include:

  • Swim lane diagrams
  • VIM-like key bindings – just open Settings and turn it on
  • Auto update on the fly – Auto refresh is coming in version 21 (next week)
  • Auto save diagrams – Auto save is coming in version 21 (next week)
  • Smart suggestions / Auto complete – This is addressed with the Snippets feature that was recently introduced. Log in and turn it on! If you need more for a particular diagram type, just let me know.

Below are the actual comments that people left about what additional features they would like to see in PlantText. You can read the comments and my thoughts on them below as well…

Your CommentsOur Thoughts
Swimlane Cross Functional Flow ChartYes, you can already do swim lanes in multiple diagram types. We will add examples, and do a blog post on it.
Couldn’t care less about chat, and even less for AI integration. But had to select something.Thanks for the honesty!
Integrated docs. I’d like to hover keywords and see a short brief 🙂Wow, would like to hear more about this. I am not sure exacly what this means, but sounds like a great idea. Email me if you want to elaborate.
Support local path to my plantuml preset (library actors for c4 model as example)Would like to hear more about this too. I am not sure exacly what this means, but sounds like a great idea. Email me if you want to elaborate.
The ability to export all files at onceGreat idea. I will add it to the list of features.
Vim-like key bindingsWe have VIM-like binding. Go to settings and turn it on!!
It would be nice to have diagram 1) auto-update on the fly 2) if there are errors show them near the previous valid diagram version.1) This will be coming in version 21 2) I’d like to hear more about that
Love the vi editor, auto complete?Thanks for the feedback. Tell the other guy above 🙂
No. I actually quite like plant text a lot. it is quite helpful so thank you very much 🙂You’re welcome!
Google says this means “No”, so good to hear you are all good. 🙂
Multiple type of exports –> like not only .uml files and image files also should be like .mdj files etcOh, well I will look into this. Maybe I can use OpenAI to do this as well without much development.
Would be nice to make formatting a diagram a little easier, especially for beginners, even if its in the help section where the commands are listedOk, this gives me an idea. Many of you asked about adding a copy paste snippet list off to the side of the editor. Let me think about this one.
Save automatically, so when you accidentally close the browser or tab, the diagram isnt lostDone in version 21 just released.
Venn diagramI found this. But, it doesn’t seem like PlantUML supports it. https://github.com/plantuml/backlog/issues/22
Integrated contextual documentationI started adding hover over help messages in Version 21. Will make sure it is complete in the next release.
Vim-like keybindingsHey someone else said that too. We have VIM-like binding. Go to settings and turn it on!
As an extension to option B. Lightweight version control. E.g. enable storing last N versions with a retention of X days, and being able to revert to previous versions.Wow, I have been thinking about that too. Maybe using AWS S3 with versioning or GIT, or something. Looking into this right now. This would need to be a paid feature for sure…lots of time and effort.
Circular layout (as circo in graphviz)Darn, wish I understaood what this one was about. Email me if you want to elaborate.
1. Either live updates or just correct shortcut on macOS – cmd+Enter
2. Zoom in/out a diagram
3. Smart suggestions (complete already exists name of an entity or function from a drop-down list)
1. Done in version 21 just released.
2. Interesting Idea. I will add it to the feature list.
3. You should try Snippets!! Just log in and you have this feature!
1) AutoComplete 2) Navigate to code section when a portion of the image is clicked.1. Done in version 21 just released.
2. This is an interesting idea. But, I don’t know how it could be done actually. Sorry.
Scaling of diagram so it can stay on the right even on smaller screens (laptop)Thanks for the suggestion! It is done in version 21 just released.
Improve documentation on the available featuresWill do. I am thinking about a YouTube video. Would that help?
The website does everything it is asked for no need to aim too high only thing that i think could be added is same kind of syntax list like for example you can see on the site https://sqliteonline.com/ on the right there is room for it but if you could also hide it that would be perfect for us forgetful peopleThis really got me thinking. I have some good ideas on how to do it. I looked at teh website you sent. I will do something similar. 🙂
Create diagrams from C# classesWe used to do this but keeping up with the code was a pain in the butt. I am going to start doing this again, but with AI this time.
Examples showing Full support for a specific version of UML, e.g 2.5, with all diagrams listedGood idea. Will think more about it.
YesDarn. Wish you had said more than just “yes”. Email me if you want to elaborate.
Accept donation from more countries. I wanted to but currently my country is not accepted.Oh, wow. Good idea. I wonder what country you are talking about. Email me if you want to elaborate.
Choose the color of the text (mulit coloured)Hummmm, not sure if you mean the text in the editor or the diagram image. You can change the Editor Theme and the Diagram Theme in Settings. You can also change the color text displays in the diagram image. I’ll add samples. 🙂
Add support for libraries like plantuml-stdlib’s, awslabs’, tupadr3’s, ideally with some dialog(s) helping to visually select assetsOh, let me look into that. I have no idea what that is right now.
Offline app/standalone outside of browser, or some integration with an extensionUgggg, too much work. You do that.
I’d love to have a draw.io like system where i could drag and drop elements that are essentially just snippets.
Another nice feature i believe would be a general make-over of the front end. I really love this service, but i noticed it’s a bit of a tough sell to new people sometimes because the front-end is experienced sometimes as bit dull/dry. However, once they see the essence pretty much everyone loves it. Love your work! Plenty more ideas, but these a few nice ones i feel.
You’ve given me a lot to think about here. I have some thoughts about how to make the existing Snippets feature easier to use. I still need to add a lot of snippets but it works great. If you haven’t tried Snippets yet, just log in to use it.
No, but GPT would be very welcome as listed aboveYES, I am excited about this as well!!
Some kind of history of changes so I can step through what was added to the file, supporting a git repo ?Versioning….yeah, thinking about it now. Git support might be a good way to go.
I would like to have a working gui where I can draw something and get plantUML code. This would be very helpful and will increase the publicity of PlantUML very much I thinkDarn. I wish I understood this idea better. I am not really following. Email me if you want to elaborate.

And here’s a graph of the raw survey data if you are interested. It can be a little confusing at first glance. The blue bars indicate responents’ #1 feature choice. The highest blue bar is “Save diagrams to the server.” The red bar signifies their #2 choice. The orange bar signifies their last place choice. Save diagrams and AI Integration were pretty closely tied – they got the most #1 and #2 rankings. The chat feature clearly generated the least interest.

So again, thanks for your feedback. We’ll keep working to make PlantText the best online Plant UML Editor tool out there.

Design Patterns: Singleton

In my last post on building Class Diagrams in PlantText, I mentioned I’d be kicking off a Design Patterns series. I figured we’d start simple and then build from there. You can’t get much simpler than the singleton pattern, right? So here we go. Just don’t ask ChatGPT to generate a singleton pattern for you (at least without refining your question), because it’ll barf out some very clumsy code. I argued with ChatGPT a bunch while writing this post actually.

Before jumping in I wanted to mention that I really enjoyed this article by Jon Skeet (from his book C# in Depth) examines the singleton pattern in C# and comes up with 6 versions that are commonly written. They range from sloppy ones that’ll barely get the job done, to perfect implementations for any situation. It is funny how something so simple can be so complex. After reading his article, you might wonder: Will the PlantUML for the singleton pattern be mostly the same for all of his 6 versions? You’ll just have to read to the end here to find out!

What

The singleton pattern is used all the time and in lots of different ways, so it’s a good one to start with. Sure, it’s often seen as problematic because it can be referenced globally and can easily be made to violate the Single Responsibility Principle in your applications. But it solves real problems.

How about we start with a definition of the singleton? The singleton pattern is a software design pattern that restricts the instantiation of a class to a singular unique instance. So it ensures…

  • Only one instance of the class is ever created in an application space
  • That there is direct and easy access to that one instance
  • That the object manages it own instantiation

If you read a lot of different development gurus, they’ll add other best practice details to this list, like…

  • The unique instance should be thread safe
  • The class should be lazy as well (load on demand, not at creation)
  • It should prevent other classes from inheriting from it (must be sealed)

Why

Singletons can be problematic but they are important when you’re modelling something that should have only one instance and centrally manage that data and logic. A singleton puts all the global variables in one place and makes sure that there can only be one instance of an object managing those “variables.” That makes global variables less likely to cause problems. You can even have some logic in the instance to protect the usage of those variables.

Just be disciplined in how you use the singleton. Referencing your singleton in every class throughout your API will get you into trouble. In layman’s terms, I try to pass the data and logic of singletons to other classes through constructors and method arguments as much as possible, even though you can just reference them directly anywhere in a class. You may remember that whole “high cohesion, low coupling” and SOLID principles stuff from school. If not just google it or have a nice little conversation with ChatGPT about it.

When

More importantly, when would you think about using the singleton pattern in real world applications? Well here are a few examples provided by ChatGPT…

  • Database Connection Manager: In a system that interacts with a database, you may want to ensure that there is only one instance of the database connection manager throughout the application. This is because creating multiple database connections can be expensive and may lead to performance issues. By using the Singleton pattern, you can ensure that all database requests go through a single connection manager, thereby improving performance.
  • Configuration Manager: In a system that has multiple configuration files, you may want to ensure that there is only one instance of the configuration manager throughout the application. This is because multiple instances of the configuration manager can cause inconsistencies in the configuration data. By using the Singleton pattern, you can ensure that there is only one source of configuration data throughout the application.
  • Logger: In a system that requires logging, you may want to ensure that there is only one instance of the logger throughout the application. This is because multiple instances of the logger can cause conflicts in the log data. By using the Singleton pattern, you can ensure that there is only one source of log data throughout the application.
  • Cache Manager: In a system that uses caching, you may want to ensure that there is only one instance of the cache manager throughout the application. This is because multiple instances of the cache manager can cause conflicts in the cached data. By using the Singleton pattern, you can ensure that there is only one source of cached data throughout the application.

This probably seems overly obvious to you, but it’s a pretty good list I thought. I was surprised that ChatGPT left out “Load Balancer,” but that’s just me.

How

Oh, yeah, this article is supposed to be about PlantUML, so let’s get back to that. Below you can see the basic PlantUML for a singleton, which has 1) a static property to hold the single unique instance that is created and 2) a static method for getting the instance so it can be used in client code. Wow, simple…why did I write this article!?

@startuml

class Singleton {
  -{static} Singleton _instance
  +{static} Instance(): Singleton
}

@enduml

Singletons in the Wild

What follows next are a couple of the most common implementations you tend to see in real code in the wild. We’ve all seen and probably built these classes hundreds of times in our careers. Yeah, they may be sloppy, but they usually get the job done.

public sealed class Singleton
{
  private static Singleton _instance = null;

  private Singleton() {}

  public static Singleton Instance
  {
    get
    {
      if (_instance == null)
      {
        _instance = new Singleton();
      }
      
      return _instance;
    }
  }
}
public sealed class Singleton
{
  private static Singleton _instance = null;
  private static readonly object padlock = new object();
  
  Singleton()
  {
  }
  
  public static Singleton Instance
  {
    get
    {
      lock (padlock)
      {
        if (_instance == null)
        {
        	_instance = new Singleton();
        }
        return _instance;
      }
    }
  }
}

I thought that was all you needed, but the truth is we can analyze this to death just like anything else…and many people have. After reading all the gurus’ thoughts on the singleton, I realized there are some additional things to think about. Take a look at the version below that is thread safe, lazy loading, and also very simple and elegant. I had never heard of the “Lazy” class in C# so that was new to me. I’ll probably start using it all the time now.

public sealed class Singleton
{
  private static readonly Lazy<Singleton> lazy = new Lazy<Singleton>(() => new Singleton());

  public static Singleton Instance { get { return lazy.Value; } }

  private Singleton()
  {
  }
}

Above, when client code calls the property “Instance”, it always returns the single unique instance of Singleton. And Singleton is created using the Lazy object via a lambda expression calling Singleton’s own constructor. So clean and simple. No need for conditionals, locks, nested classes, etc. Very functional, efficient, clean, and simple.

Anyway, the C# code is cool, but does the PlantUML for the singleton pattern change at all for any of these different implementations? Big reveal… No, of course not. And that’s the point when you’re trying to communicate the intent of your design. In a UML diagram, we don’t care about the implementation and all of its details and complexity. That’s the beauty of it! Let’s keep it simple so we can all talk and be on the same page, regardless of our experience level and badassness.

Oh so pretty, let’s look at it again!

For More on the Singleton Design Pattern

PlantText Release Version 20

Version 20 is Released!

Version 20 of PlantText is here! We are really pumped about it and hope you enjoy using it.

Most exciting are the new features for registered, logged in users. Remember, it’s free to register on PlantText. Version 20 also offers many new features for everyone else too. Let’s go through them one at a time…

Code snippets

The new code snippets feature allows us to add blocks of code that can be quickly added to a diagram with just a few key-strokes. First, log in and open the Settings windows. Make sure “Snippets” is checked, then select the diagram type you want. Now code snippets are activated for that diagram type only. Just type the first three letters of a diagram type name (like “act” for Activity or “cla” for Class Diagrams) and pop-up options will appear. If you have the “Live Autocompletion” setting checked, the options will just appear automatically. If “Live Autocompletion” is not checked, press CTRL+SPACE to make the code snippets appear. If you can’t remember the full name of the snippet you want, just remember the three letter prefix in front of it so they all pop up like you see in the image below…

We will eventually have snippets for all the different PlantUML diagram types. We can add them over time on the back end. We want to get them right and make the best snippets possible, so we need to take our time. Here is an example of how it works right now. The snippet “act-ife” will write an activity diagram if-then-else block into the editor once you select it. You can then tab through and add text to the ${1}, ${2}, and ${3} tags. Once we have hundreds of snippets, your typing will be minimal. Here is an actual snippet in the database.

snippet act-ife
	if (${1:condition}) then (yes)
		:${2:this};
	else (no)
		:${3:that};
	endif

And here is another example but for class diagrams…

Syntax Highlighting

We also added syntax highlighting for a bunch of different languages besides PlantUML. You can choose one from a dropdown list in the settings window. But the cool thing is that the editor will now look for the PlantUML “@startuml, @startjson, or @startyaml” tags at the top of the editor and automatically switch the syntax highlighting for you to the appropriate language. So notice below that the Syntax Highlighting setting is JSON below because the @startjson tag is present…

Diagram Pop-out Window

The Diagram Pop-out Window is finally here! We have wanted to do this for a long time, and finally made it happen. You can now have the editor in full screen on one monitor and the diagram image at full screen on another monitor. Just toggle the checkbox for it in the settings window.

For users who are not logged in we also added a bunch of other great features too. I am most exited about the Live Auto-completion and Diagram Themes.

Live Auto-completion

Live Auto-completion of words in the editor is useful and works along side the snippets. Just start typing (or turn off Live Autocompletion and press CTRL+SPACE) to get a list. Press enter to select the item and it gets inserted into the editor for you.

Diagram Themes

Now you can choose a diagram theme from a dropdown on the main window. It is pretty sophisticated, as it will also parse the content in the editor and stay in sync with the dropdown menu. There’s a pretty decent variety of different color schemes to choose from. Give it a try!

Fixes

Lastly there are a few additional features / fixes. Here is a short list…

  • Added a warning message before file deletion. No more ooops! deleted files.
  • The local file list is now sorted in the open window. Small but helpful.
  • Accidental refreshes when scrolling has been fixed, mostly for mobile.

Looking ahead

Here are a few features that we are currently working on for the next few releases…

  • Save registered users diagrams to our server. Share them by email address?
  • Dark mode. The light hurts my eyes!
  • In-application community chat. Discuss your issues with other users? Real time and ephemeral?
  • ChatGPT or GPT-4 integration. Have the PlantUML generated automatically! 🙂

Anyway, again we have greatly accelerated the development of new features and putting in a lot of time. If you can spare a few bucks for a donation, that would be great. A monthly recurring donation of even $2 makes this a sustainable project! We want to keep PlantText free forever!

If you have any thought on these or other enhancements, please share your thoughts with us at admin@planttext.com