Author Topic: Class designer  (Read 805 times)

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Class designer
« on: July 26, 2019, 03:47:49 pm »
Any plans for a plugin/tool to display classes of a project? Visual Studio has a class designer and I've noticed it's a useful way to plan and check out class hierarchies which can be difficult to visualize in a bigger project.

Offline BlueHazzard

  • Developer
  • Lives here!
  • *****
  • Posts: 2432
Re: Class designer
« Reply #1 on: July 26, 2019, 03:52:07 pm »
Document your classes and use doxygen?

For this to be implemented we finally would need some robust code parser....

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #2 on: July 26, 2019, 07:29:33 pm »
Symbol browser has a parser? Seems to work ok. Extend that to boxes and draw lines between inheritances.

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #3 on: July 28, 2019, 01:44:38 pm »
I think you need special type of comments for doxygen which isn't something I want to do. Besides is doxygen even near the same as class designer in VS? There are UML tools you could use, but I think they are way too much for this purpose (and trying out new programs is pesky). The class designer is really useful tool in my opinion, along with anything that can help organizing projects. It could also be used to create a structure for the program and then create files and classes based on the plan. That way you could outline a class hierarchy which is such an essential part of a good OOP code.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11899
    • Travis build status
Re: Class designer
« Reply #4 on: July 28, 2019, 03:22:20 pm »
OoP is not modern anymore... Now we're to use DoD or FP...

Doxygen doesn't need anything to generate the diagrams. Just create a config, tell it to process all files you're interested and don't skip uncommented files and run it to generate the documentation. If you want something integrated in CB I guess you'll have to write a plugin.

BTW: Symbol browser is disabled because it is buggy. There is no one willing to spend the time to rework it to be less buggy. :(
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #5 on: July 28, 2019, 10:00:56 pm »
What? Isn't doxyblocks the plugin of doxygen? Not only that, symbol browser is working fine in 17.12. Did I miss something or have I entered a parallel universe?

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11899
    • Travis build status
Re: Class designer
« Reply #6 on: July 29, 2019, 01:18:48 am »
Why do you care for plugin? You want class diagrams. The only way currently is to use doxygen or some other external tool. Sorry.

Try a build which uses wx3.x and you'll see how the symbol browser is missing badly :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #7 on: July 29, 2019, 09:07:09 am »
The only way currently is to use doxygen or some other external tool. Sorry.

Doxygen does output (bloated) html document, but I don't know yet how to create a class diagram with it. Seems like an ancient tool. Even more reason to create a built-in class diagram viewer. Visual Studio's class diagram is a good reference, it creates only one data file for the diagram and that's it. When you reopen the diagram it updates changes (removed things), although it doesn't seem to add new classes for whatever reason, but you can do it easily. And you can delete the data file and create new one which resets the places of classes etc.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11899
    • Travis build status
Re: Class designer
« Reply #8 on: July 29, 2019, 12:13:09 pm »
Doxygen does output (bloated) html document, but I don't know yet how to create a class diagram with it.
One search away http://www.doxygen.nl/manual/diagrams.html
But hating a tool is easier I know.

Seems like an ancient tool. Even more reason to create a built-in class diagram viewer.
Be my guest write a plugin in a week! It should be easy. (and next post follows with complains that you don't know the code and it will best someone from the dev team to do the plugin, please spare me this) To me it looks like a month worth of work. Also our parser is not really good and it is not getting updated too much, so it even doesn't support c++11 and we already have tons of stuff coming in c++20.

p.s. I also think it would be useful, but someone has to find the time and energy to do it. Code::Blocks need improvement to a lot more important components before we can get fancy with class diagram generator.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #9 on: July 29, 2019, 02:26:25 pm »
One search away http://www.doxygen.nl/manual/diagrams.html
But hating a tool is easier I know.

It creates a large image of class hierarchy which isn't that great. I'm probably going to continue using Visual Studio's class diagram tool, but for reasons I outlined in my blog post (http://roguehut.blogspot.com/2019/07/the-day-that-would-never-come.html) I quit VS as the main IDE for now until they can figure it out. If that ever happens...

Quote
Also our parser is not really good and it is not getting updated too much, so it even doesn't support c++11 and we already have tons of stuff coming in c++20.

I don't understand why you would need C++? support for class a diagram tool. It doesn't need to do much, just find classes and their inheritance structure in the project.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 11899
    • Travis build status
Re: Class designer
« Reply #10 on: July 29, 2019, 03:52:09 pm »
I don't understand why you would need C++? support for class a diagram tool. It doesn't need to do much, just find classes and their inheritance structure in the project.
Ignorance is bliss. 8)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #11 on: July 29, 2019, 06:56:57 pm »
Ignorance is bliss.

I began to work on a tool that can give more information about classes. How hard it can be, right?

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #12 on: July 30, 2019, 02:44:42 pm »
The first step in my command line tool was to find source files from current directory. There is a new filesystem library in C++17 so I had to use VS for this, because in 17.12 C++14 is the latest. Filesystem is quite easy compared to anything else, you don't need a lot of code for that task:

Code: [Select]
string const Files::extensions[]={".cpp", ".h", ".hpp"};

Files::Files()
{
fs::path dir{"."};
    for (auto entry : fs::directory_iterator(dir))
{
if (entry.is_regular_file())
{
if (Is_Source_Extension(entry.path().extension().string()))
files.push_back(entry.path().filename().string());
}
    }
}

bool Files::Is_Source_Extension(const string &source)
{
for (auto &it : extensions)
if (it==source) { return true; }

return false;
}

How smooth is that, right?

Online sodev

  • Regular
  • ***
  • Posts: 311
Re: Class designer
« Reply #13 on: July 30, 2019, 03:21:14 pm »
Seems like an ancient tool.

It's only the de-facto standard tool to create documentation for at least c/c++-code.

The first step in my command line tool was to find source files from current directory. There is a new filesystem library in C++17 so I had to use VS for this, because in 17.12 C++14 is the latest. Filesystem is quite easy compared to anything else, you don't need a lot of code for that task:

You like to hear you talking? So much foobar, better get your facts straight. CodeBlocks isn't a compiler, it doesn't need to support anything. You can use CodeBlocks with VS 2019, latest Clang or GCC to get the newest experimental c++ features you like, all together with CodeBlocks.

So all you need to write a fully fledged CASE tool or at least modeler with bidirectional sync is some C++17? Great, so it won't take long until your plugin is ready and we can use it in CodeBlocks.

Offline Krice

  • Multiple posting newcomer
  • *
  • Posts: 122
Re: Class designer
« Reply #14 on: July 30, 2019, 07:10:05 pm »
CodeBlocks isn't a compiler, it doesn't need to support anything.

Oh I'm sorry. Let's make this simpler so you also can understand: the compiler that comes with 17.12 if you download it with the compiler.

Quote
So all you need to write a fully fledged CASE tool or at least modeler with bidirectional

I don't have to do anything I don't want. In this.. well, case, I don't need to write a real parser, obviously. I only need to find out classes (and structs) from the source code. Can't be that hard I guess. I already have a plan to read the file until first open curly brace. Then backtrack to find class or struct keyword before first ';' (or closed curly brace?). I think it should work. Also, when reading a part, remove spaces and line feed characters to make it easier to parse. The difficult part will be inheritance relationships between classes. Or maybe they are not difficult, who knows.
« Last Edit: July 30, 2019, 07:11:41 pm by Krice »