gbaychev/NClass

Naming diagrams in in project is not strict enough

mrpetro opened this issue · 2 comments

Currently its possible to create or rename two or more diagrams having same type and same name under one project.
2018-01-05 22_52_20-nclass running - microsoft visual studio

This may lead to odd behavior while code generation

There is also problem with using white characters and nonstandard characters in diagram names, since the diagram names are used in RootNamespace generation and the RootNamespace is used in code generation, which leads to bad code generation.
2018-01-05 22_58_44-untitled - paint

Two things can be done here:

  1. Restrict naming/renaming diagrams to use only characters allowed in namespace naming of C# and/or Java
  2. Separate Namespace as a Diagram setting which could be auto filled (and validated) on diagram naming (and then changed as an diagram property.)
  1. Absolutely. Also everything used for code generation should be validated as well (e.g. Class names, etc.)
  2. In general I agree that we should decouple the namespace from the diagram name, but also theoretically is also possible that you can have more than one namespace/package per diagram. What do you think about it?
  1. Yes, that's absolutely fine, because this is what UML Packages are for, a containers for other types. And also I think that Class Diagram itself can be treated as sort of "root" package where other packages can be nested.

OK, so are base assumption is that one UML Class Diagram is equivalent of C# Project, and each C# project has its assembly default namespace. And this can be set to something different than the {Solution}.{C#Project} name.