Write C++ in a graphical scratch-like way?

2020-06-06 04:46发布

I am considering the possibility of designing an application that would allow people to develop C++ code graphically. I was amazed when I discovered Scratch (see site and tutorial videos).

I believe most of C++ can be represented graphically, with the exceptions of preprocessor instructions and possibly function pointers.

What C++ features do you think could be (or not be) represented by graphical items? What would be the pros and cons of such an application ? How much simpler would it be than "plain" C++?

RECAP and MORE:

Pros:

  • intuitive
  • simple for small applications
  • helps avoid typos

Cons:

  • may become unreadable for large (medium?) - sized applications
  • manual coding is faster for experienced programmers
  • C++ is too complicated a language for such an approach

Considering that we -at my work- already have quite a bit of existing C++ code, I am not looking for a completely new way of programming. I am considering an alternate way of programming that is fully compatible with legacy code. Some kind of "viral language" that people would use for new code and, hopefully, would eventually use to replace existing code as well (where it could be useful).

How do you feel towards this viral approach?

When it comes to manual vs graphical programming, I tend to agree with your answers. This is why, ideally, I'll find a way to let the user always choose between typing and graphical programming. A line-by-line parser (+partial interpreter) might be able to convert typed code into graphical design. It is possible. Let's all cross our fingers.

Are there caveats to providing both typing and graphical programming capabilities that I should think about and analyze carefully?

I have already worked on template classes (and more generally type-level C++) and their graphical representation. See there for an example of graphical representation of template classes. Boxes represent classes or class templates. First top node is the class itself, the next ones (if any) are typedef instructions inside the class. Bottom nodes are template arguments. Edges, of course, connect classes to template arguments for instantiations. I already have a prototype for working on such type-level diagrams.

If you feel this way of representing template classes is plain wrong, don't hesitate to say so and why!

11条回答
Melony?
2楼-- · 2020-06-06 04:54

The complexity of a nontrivial program is usually too high to be represented with graphical symbols, which are low in their information content. Unless your approach is markedly different in some way, I am skeptical that this would be of value based on past efforts.

So, practically speaking, his will be useful only for instructional purposes and very simple programs. But that would still be a great target market for a product like this. sometimes people have trouble grasping the fundamentals, and a visual model might be just the thing to help things click.

查看更多
beautiful°
3楼-- · 2020-06-06 04:55

I've been working on a new model-driven software development paradigm named ABSE (http://www.abse.info) that supports end-user programming: It's a template-based system that can be complemented with transformation code. I also have an IDE (named AtomWeaver) implementing ABSE that is in pre-alpha stage right now.

With AtomWeaver, as an expert/architect, you build your knowledge Templates, and then the developers (or end-users if you make your meta-models simpler) can just "assemble" systems by building blocks, and then filling template parameters in form-style editors.

At the end, pressing the "Generate" button will create the final system as specified by the architect/expert.

查看更多
乱世女痞
4楼-- · 2020-06-06 04:56

I'm surprised you think function pointers would be a particular problem. How about anything at all to do with pointers?

A programming language can be represented by a hierarchy of nodes - that's exactly what the compiler turns it into. It is very strange that the UI for editing programs is still a sequence of characters that get parsed, because the degrees of freedom in the editor is way larger than the available set of allowed choices. But intellisense helps to reduce this problem a lot.

C++ would be a strange choice to base such a system on.

查看更多
欢心
5楼-- · 2020-06-06 05:00

I prefer hot-keys instead graphical menus and buttons.
And I think same thing will happen with graphical development tool. Many peoples will prefer manual codding.

But, source code visualizer - should be nice thing.

查看更多
Summer. ? 凉城
6楼-- · 2020-06-06 05:07

Much as I like Scratch, it is still much quicker for an experienced programmer to write code using a text editor than it is to drag blocks around, This has been proved time and again with any number of graphical programming environments.

查看更多
ら.Afraid
7楼-- · 2020-06-06 05:11

Interesting idea. I doubt I'd use it though. I tend to prefer coding in a flat text editor, not even an IDE, and for tough problems I prefer a pad of paper. Most of the really experienced programmers I know work this way, Maybe it's because we grew up in a different environment, but I think it's also because of the way we think about programming. As you get more experience, you start seeing the code in your head more clearly than any GUI tool will show it to you.

As for your question, I'd nominate templates as one of the harder / more interesting sort of thing to try to represent well. They are ubiquitous and carry information that you won't have access to as you are designing your tool. Getting that to the user in a useful way should pose an interesting challenge.

查看更多
登录 后发表回答