-
Notifications
You must be signed in to change notification settings - Fork 91
Add UML diagrams #71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add UML diagrams #71
Conversation
This commit replaces "doc" with "html" in the .gitignore file so the ford-generated doc/html/ directory will be ignored, but other doc/* files will not be ignored. This prepares for committing other forms of documentation such as PlantUML scripts for generating UML diagrams.
This commit provides a high-level, graphical depiction of the class relationships in neural-fortran.
@milancurcic these diagrams can be especially helpful for a high-level picture of what's in neural-fortran with some information that doesn't appear in FORD graphics (e.g., the different types of class relationships such, including type extension and aggregation/components). As one example of the utility, I naively misinterpreted |
@milancurcic if you can tell me what derived types are intended to be user-facing versus which ones are strictly for internal use, then I'll contribute one more pull request with just those to describe the "user API." This too is really helpful for a quick introduction to neural-fortran for newcomers. |
@milancurcic I would also be glad to contribute some UML sequence diagrams that would depict the expected runtime behavior of neural-fortran, including the sequence of type-bound procedure invocations in a common use case, the objects involved, and the lifetimes of those objects. |
Thanks @rouson. I'd like to have diagrams like this. What's the advantage of these diagrams over the ones generated by FORD and graphviz? I'm reluctant to add yet another developer documentation over the one we already have. As the API will change and grow in the near future, I suggest not committing the UML sources to the repo, but merely providing a script or instruction how to generate them. Otherwise, the diagrams will quickly fall out of date. The user API is/will be what the nf module provides. I say "will be" because I just realized that the MNIST example uses an optimizer and MNIST loaders directly from their own modules. I think it will make sense, and be convenient, to organize the public API by themes, e.g. It's unlikely that the users will want to fiddle with |
Try 2. Responding inline this time:
Great!
UML class diagrams can provide much richer information than FORD's diagrams of class relationships. FORD diagrams will show that two types are related and show the direction of the relationship (in a way that always confuses me) but nothing else about the relationship. UML class diagrams can succinctly depict whether the relationship is inheritance versus aggregation and whether it's a one-to-many versus one-to-one and the relationship line can have a custom annotation. Also, UML class diagrams can attach formal correctness constraints to the type and its procedures (preconditions, postconditions, and invariants). I generally recommend that all such constraints be enforced by a runtime assertion, which can provide useful diagnostic information whenever a constraint is violated. The corresponding assertions provide strict verification of assumptions that people often put in a comment. Comments of course have no runtime benefit.
In case it's helpful, the diagrams aren't part of the repository. They use the GitHub file storage trick that we discussed.I think it's really helpful to have them in the README.md because I doubt most people will generate the diagrams themselves even if given instructions. I would be glad to maintain them if that's ok with you. They're super-lightweight and easy to maintain.
I'll get started with the User API based on your response. Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed the typos and removed the redundant info. I'll let you finish up the User API diagram.
@rouson, I just noticed that you wanted to do the User API UML in another PR. I agree. If this is ready from your end, let's merge it. |
This PR adds UML documentation in the doc/ subdirectory, including
To Do (in a future PR)
Add a User API diagram depicting only the derived types, type-bound procedures, and constructors intended for use in applications.