-
Notifications
You must be signed in to change notification settings - Fork 144
[DOCS] Add a class diagram #482
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
Conversation
7ffbb84
to
d6e9c21
Compare
The rendered class diagram can be viewed at https://github.com/MyIntervals/PHP-CSS-Parser/tree/docs/class-diagram . |
d6e9c21
to
25e3c42
Compare
This diagram aims to provide an overview of which classes we have and how their are interconnected. Hence, it does not contain any methods or properties. As the Mermaid render on GitHub does not support namespace, the classes are not grouped into namespaces in the diagram. Fixes #422
25e3c42
to
4029601
Compare
@oliverklee did you generate this diagram manually or was it auto-generated by some tool? |
I created it manually (by reading the sourcecode). |
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 created it manually (by reading the sourcecode).
A good excercise to get an overview and understanding of the codebase 👍. However, this seems to me like something an automated tool should do well. Is there not something that can auto-generate the Mermaid mark-up? It would make updating easier following changes.
I've only looked at a small section of the diagram so far; I've marked up some comments:
If you want to quote-reply, here they are:
- This copies the code rather than the diagram. Is there a way to get the diagram as a PNG for easier viewing, or perhaps printing out?
- This should be over here. Do we have any control over the layout?
aComponents
is not used byRuleValueList
, though is used byCalcRuleValueList
. Should the arrow bypass (or be chained)?
This should be over here. Do we have any control over the layout?
I saw there was a left-to-right setting, but it doesn't seem to be working properly. The rendered diagram comes out as a jumbled-up mess, when it could obviously be rendered much more clearly by enforcing that inheritees are always to the left of their ancestors, with a wider peice of paper provided if necessary.
I've done some googling and packagist-ing, and I'm going to have a look at https://github.com/tasuku43/php-mermaid-class-diagram.
On GitHub, you can zoom in with the
No, I don't think so. (Reordering things might have an effect, but I'd prefer keeping the thing in the Mermaid code in the same order as in the PHP code.)
The associations work the other way around:
I've fiddled around with it a bit as the default setting created a diagram that was horizontally very wide, which caused it to get tiny within the rendered Markdown file. |
d5b3105
to
c9e81fb
Compare
I've given it a go. These are the results:
|
According to the tool docs, there is an argument for the format, but the tool refuses to accept it.
No, we don't. I've tried to have the tool in a separate repository and analyze our code, and that also works.
I've checked https://phar.io/, and this tool is not available via PHAR.
Maybe we can automate this in some way that we only need to manually add the associations and have the other things generated. What do you think? |
I’d like to use the autogenerated diagram in the future and see two possible approaches here: a) merge this PR and then create a dedicated PR to switch to the auto-generated class diagram (plus hand-crafted associations) Both approaches should include some documentation about updating the generated part of the class diagram. I’d prefer approach a) so we can go in smaller steps and have the first version of the class diagram merged soon. @JakeQZ @sabberworm What do you think? |
I agree. Let's get it in first, then refine it. |
I'd rather have the rendered diagram always show descendent classes to the left of the ancestor. What I pointed out seems to be a bug in the rendering. I am not bothered about it being wider - it can't be easily viewed within GitHub's markdown viewer anyway (the zooming and scrolling tools aren't the best), which is why I asked if it could be rendered as a PNG (actually, ideally, PDF or SVG).
Ah. I see. There is a slight design flaw here. A parent class should never be referencing a child by name. #499 should solve that. `` ` joke My sister just gave birth to non-identical twins: a girl and a boy. She was too exhausted to fill in the forms, and hadn't really decided on names anyway, so, in a siblingly gesture, allowed me to name them. For the girl, I chose Denise. For the boy, I chose Denephew. `` ` |
I'm going to disagree with myself a bit now. The parent might create objects of a child type (e.g. in |
This diagram aims to provide an overview of which classes we have and how their are interconnected. Hence, it does not contain any methods or properties.
As the Mermaid render on GitHub does not support namespace, the
classes are not grouped into namespaces in the diagram.
Fixes #422