DEV Community

Cover image for Visual Microservices
Tomaž Vinko
Tomaž Vinko

Posted on • Updated on

Visual Microservices

Inheriting dysfunctional code can be nightmare

I frequently struggle with fixing bugs and debugging code that I inherited. The problem is that the code is poorly written,
without programming design principles and many unnecessary duplicate parts of code.

This made me to start brainstorm what would be an ideal solution. I started thinking outside the box, beyond classic object oriented concepts.

I came up with the idea that reusable parts of code would be in the form of drag'n droppable visual boxes of algorithms that I could connect in any order.

I could then run those visual boxes from my code by executing first box (some kind of entry point). Complete chain of connected boxes would be executed and last box will return some computed result back to my main application.

That will give me simple overview what application does. The other advantage is reusability. I could just connect visual boxes in different order and create different application logic. Without recompiling my codebase. Maintenance would be much easier this way instead of doing changes in spaghetti code.

There are no Object Oriented Desing Patterns in this direction yet. Or I'm not aware of them. I'm just going to call it Visual Microservices for now.
Visual because they are represented in form of visual boxes.
Microservices because each box represent some isolated, loosely coupled service.

Visual programming

Of course Visual Programming is nothing new. But curently there aren't solutions there yet, which would solve real life demands. The problems are mostly interoperability and poor performance.

Some of the benefits that must be sacrified by using existing Visual Programming tools:

  • I don't want that tool use more resources (memory, CPU) than needed. Just firing up an almost empty project created in visual tool takes 50MB of memory. Really??!
  • I want to be fast. Let's say that we have two or more connected Visual Microservices. I don't want that transition from one microservice to another takes longer then actual microservice execution.
  • I want to include Visual Microservices written in different programming languages. I like coding in C# but the truth is that in some areas, especially in ML, Python has better support. I want to effortlessly include my C# and Python libraries in Visual Microservices. My ideal tool has to support as much as possible different languages, because there is no tool to rule them all.
  • Everyone that tells you that a complete solution can be created just with a visual programming tool is a big lie. Yes you can do small projects, but as long as you have complex real world project, your hands are tied. It's nothing worse than when tool dictate which portion must be used. It might happen that in middle of project you realize it's weaknesses and you must start project from scratch with different technology. So I want that my tool could be easily integrated with my code
  • I want to have debugging capabilities. Not just "Console.log()", but a full blown debugger with breakpoints and run time variables inspection.
  • I want to share a state between Visual Microservices. I want to share objects - with all their states, properties and functions

My attempt to create "ideal" Visual Tool

As the wish list grows, I decided to make a tool that will overcome all these obstacles. I decided to write my Visual Tool in C because I wanted top-notch performance, portability and support for hosting many different programming languages on the top of it.

At the moment tool supports :

  • C# and Python languages
  • Visual Studio and web-pdb integration for debugging Visual Microservices
  • it can be referenced as library from 3rd party code. This gives me ability to seamlessly experience to include my Visual Workflows into projects

In short, tool is hybrid between visual and ordinary programming. Existing or new algorithms can be easily represented and combined visually. For that reason I also created marketplace for exchanging those algorithms.

I'm going to demonstrate it in the next posts. In meantime, you can check it here

Happy Coding :)

Discussion (0)