Skip to content
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

The tool to make the class diagrams should be IDE independent #190

Closed
iluwatar opened this issue Aug 6, 2015 · 37 comments
Closed

The tool to make the class diagrams should be IDE independent #190

iluwatar opened this issue Aug 6, 2015 · 37 comments

Comments

@iluwatar
Copy link
Owner

iluwatar commented Aug 6, 2015

Not everybody uses Eclipse, which is a requirement for the current tool ObjectAid UML Explorer.

@iluwatar
Copy link
Owner Author

iluwatar commented Aug 6, 2015

I'm planning to auto-generate the class diagrams from the source code.

@bernardosulzbach
Copy link
Contributor

I would like to see this done.

@iluwatar iluwatar added this to the 1.7.0 milestone Aug 17, 2015
@iluwatar iluwatar self-assigned this Aug 17, 2015
@iluwatar
Copy link
Owner Author

iluwatar commented Sep 3, 2015

I'll give it a shot at https://github.com/iluwatar/uml-reverse-mapper

@npathai
Copy link
Contributor

npathai commented Sep 4, 2015

👍

@iluwatar
Copy link
Owner Author

It is a work in progress but I've put it to Maven Central with version 1.0.0. I've attached the plugin to JDP project in urm branch. Here's some output it has generated.

urm dot

urm dot

urm dot

urm dot

urm dot

urm dot

@npathai
Copy link
Contributor

npathai commented Sep 22, 2015

@iluwatar It looks good but still a lot of work to be done. I was really thinking whether its a pressing issue currently. I agree that not everybody uses eclipse but its a viable option for now. We can in parallel keep working on urm tool to create a free alternative that is usable. Once we are done with that we can again revisit this issue. Till then what we can do is keep the class diagram an optional clause in PR and we can take the burden of generating the class diagram.

I think we can also consider paid tools like https://www.genmymodel.com, which yes are paid but provide a good alternative. Core team can have paid access to the tool. It generates good diagrams https://api.genmymodel.com/projects/_WEMoIGDtEeW9D6sWhFfmrA/diagrams/_WqZsgWDtEeWzDrmBaWf_bw/jpeg

Awaiting your response.

@iluwatar iluwatar removed this from the 1.7.0 milestone Sep 24, 2015
@gilbertoca
Copy link

Hi,
What about this UML tool: DoUML
Or this plan text UML tool: PlantUML which can be rendered by github via PlantUML github support

@markusmo3
Copy link
Contributor

I dont know why this issue has been ignored. I quite like the idea of having things unified! And PlantUML sure does look very promising!

@iluwatar you have this nice UML reverse mapper project. I'm thinking of creating a new "PlantUMLPresenter" for it. With that it should be able to output plantuml code, right?

Because then we could use the PlantUML hosting webserver to draw and host the diagrams.
And the two together with some travis magic could be used to autogenerate our uml diagrams :D (i'm in a 'automate evryfin'-mood currently...)

What do you (other) guys think of that?

@bernardosulzbach
Copy link
Contributor

@markusmo3 I am not going to help as I don't have the time, but I cheer for you. It seems a good idea.

@iluwatar
Copy link
Owner Author

iluwatar commented Apr 7, 2016

@markusmo3 I will look into this.

@iluwatar
Copy link
Owner Author

@markusmo3 I think your plan could work.

  1. The reverse-uml-mapper generates PlantUML markup files
  2. The PlantUML markup can be further manipulated with IDE plugins or online tools Eclipse IntelliJ NetBeans
  3. Travis build generates the class diagram image from the PlantUML source

@markusmo3
Copy link
Contributor

@iluwatar Seems like im one step ahead of you 😉
One day i had too much time, so i just started ^^ It's not finished yet but works quite good allready.
image

@bernardosulzbach
Copy link
Contributor

@markusmo3 Fly as fuck. I'm just judging appearance, didn't read the attributes and methods, but that is the easiest part to get right as it is programmatically assigned.

Really good.

@iluwatar
Copy link
Owner Author

I'm not sure I understood @mafagafogigante 's expression but, woah, to me this looks awesome!

@bernardosulzbach
Copy link
Contributor

@iluwatar That's what I tried to say. It looks very polished, almost as if it was the result of several iterations already.

@iluwatar
Copy link
Owner Author

@markusmo3 anything I can help you with?

@markusmo3
Copy link
Contributor

markusmo3 commented Jul 22, 2016

@iluwatar Sorry i have been away for a long time. I graduated and got a job and to be honest somehow lost a little bit of motivation when i looked at the google analytics of our website. If you are interested in it i could do a little report for it.

I have the code for this sitting somewhere, i just didnt do the finishing touches, i will look into it the next few days.

@iluwatar
Copy link
Owner Author

@markusmo3 good to hear from you. Congratulations for your graduation and new job! We can discuss the statistics you mentioned in Gitter.

@markusmo3
Copy link
Contributor

Hey @iluwatar
Im wondering if you could help me with a maven thing here.
I have this issue nearly completed in my fork, but i need a way to now assign every subproject of java-design-patterns this jar so that it uses the plugin and thus generates the puml file.

Currently i only know the way of copy-pasting the part in the readme into every single pom.xml, but that is a very tedious task, even automated with bash scripts lots of conflicts arise. Is there a way to only write it once into the parent pom.xml and it being applied in every single subproject?

Reproduction:

  • clone urm repo on branch
  • mvn install (Version currently is 1.4.0-SNAPSHOT)
  • clone jdp-master repo
  • ???
  • plugin gets applied to each project

Any idea?

@iluwatar
Copy link
Owner Author

iluwatar commented Aug 7, 2016

We could try to move the plugin configuration to the parent java-design-patterns/pom.xml. Specify it as follows:

    <build>
        <plugins>
            <plugin>
                <groupId>com.iluwatar</groupId>
                <artifactId>urm-maven-plugin</artifactId>
                <version>${urm.version}</version>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>map</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <packages>
                        <param>com.iluwatar</param>
                    </packages>
                </configuration>
            </plugin>               
        </plugins>
    </build>

With this plugin configuration urm.dot is generated for each submodule and it contains all the classes from com.iluwatar package and its subpackages.

@iluwatar
Copy link
Owner Author

iluwatar commented Sep 18, 2016

For Builder pattern .puml I'm getting syntax error. Do you know what causes this? I've raised issue markusmo3/uml-reverse-mapper#3

@iluwatar
Copy link
Owner Author

Is my understanding correct that we would use online tools to generate the images from the .puml files? I'm referring to this script https://github.com/iluwatar/java-design-patterns/blob/master/_scripts/postPumlsToServer.py

I am worried about the performance of the online image generation. For example, I have tried to generate the image from the .puml of the Hexagonal pattern multiple times without succeeding.

@markusmo3
Copy link
Contributor

markusmo3 commented Sep 19, 2016

Lets clear some things up i guess,

The relation between AbstractDocument and Map is containment, right?

Yep, at least that is the symbol for "inner class" relation ship: It reads something like this "AbstractDocument has the inner class Map" but why it is there i have no idea. Thats why we need reviews. I thought i fixed an issue like that some time ago, maybe it creeped back up again. I'll have to look into that, yes.

This issue was put to the side again and i forgot about it 😇 i will continue work to at least a state that is reviewable locally.

The relation between Document and AbstractDocument is inheritance, right? AbstractDocument inherits Document. The same relationship is between Document and HasType. However, the line types are different (solid vs dashed). Why is this?

realitzation (dotted) vs inheritance (solid)
most resources i looked at did this so i did too.

btw im planning on providing a "legend?" that explains the various different arrow types, colors and characters.

The letters after class names e.g. Document (I), AbstractDocument (A), App (C) mean the type I=Interface, A=Abstract class, C=Class right?

Yep!

What are the relations between App and Army, King and Castle? It's not the same containment as in Abstract Document. Is the relation between Abstract Document and Map composition and the relation here between App and Army aggregation (makes sense)?

Usage! or more formerly called Association (because of the field variable)

I am worried about the performance of the online image generation. For example, I have tried to generate the image from the .puml of the Hexagonal pattern multiple times without succeeding.

Performance isnt really an issue here, at least for now. I hope the plantuml servers do a good job of hosting the images here and if not we can still take action later to combat that (e.g. generate locally, travis magic,... ) It just was the easiest solution at hand to go with plantuml webservers that autoupdate with every code changes.
The postPumlsToServer script was only executed once and exists only to archive its usage for the future and thus not intended to be used again.
The How2 use plantuml webserver and integrate with website topic is also part of the documentation that i have to add to the wiki yet.

@markusmo3
Copy link
Contributor

markusmo3 commented Sep 20, 2016

with commit d70bfca the new diagrams should be a lot simpler to review!
Just decomment (remove the hashtag #) the reviewmode variable in _config.yml and serve the website locally. The new diagrams are now shown on the respective pattern pages.

Problem that arise when reviewing are problems concerning urm directly, so an issue there or direct messaging me would be appropriate.

Proposed Future Usage on new pattern creation:

  1. When pattern is finished and fully approved by the jdp staff the diagram can be generated from source and finally committed

  2. generate via mvn test for simple one module patterns. For more complex multi module patterns look at how aggregator-microservices, naked-objects or api-gateway solved the problem or just ping markusmo3 for help

  3. commit the generate puml file(s)

  4. go to http://plantuml.com/plantuml/uml and add the following, while filling in the YOUR_PATTERN part. The url should point to your file in the 'raw' format.

    @startuml
    !includeurl https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/YOUR_PATTERN/etc/YOUR_PATTERN.urm.puml
    @enduml
    
  5. submit the form, if successful the diagram should be displayed correctly, if not the error message should be display. Also review the diagram if everything is displayed correctly.

  6. copy the id from the url

    http://plantuml.com/plantuml/uml/HERE_IS_THE_PUML_ID
    
  7. add the pumlid front matter variable with the in step 6. retrieved ID (example)

@iluwatar
Copy link
Owner Author

The relation between AbstractDocument and Map is containment, right?

Yep, at least that is the symbol for "inner class" relation ship: It reads something like this "AbstractDocument has the inner class Map" but why it is there i have no idea. Thats why we need reviews. I thought i fixed an issue like that some time ago, maybe it creeped back up again. I'll have to look into that, yes.

This issue was put to the side again and i forgot about it 😇 i will continue work to at least a state that is reviewable locally.

I've created issue markusmo3/uml-reverse-mapper#5

@iluwatar
Copy link
Owner Author

with commit d70bfca the new diagrams should be a lot simpler to review!
Just decomment (remove the hashtag #) the reviewmode variable in _config.yml and serve the website locally. The new diagrams are now shown on the respective pattern pages.

Problem that arise when reviewing are problems concerning urm directly, so an issue there or direct messaging me would be appropriate.

I will try this and review the diagrams.

@iluwatar
Copy link
Owner Author

@markusmo3 I went through the diagrams and this issue markusmo3/uml-reverse-mapper#7 seems to reproduce multiple times. AFAIK all the issues are on the list now https://github.com/markusmo3/uml-reverse-mapper/issues

@iluwatar
Copy link
Owner Author

Proposed Future Usage on new pattern creation:

  1. When pattern is finished and fully approved by the jdp staff the diagram can be generated from source and finally committed

  2. generate via mvn test for simple one module patterns. For more complex multi module patterns look at how aggregator-microservices, naked-objects or api-gateway solved the problem or just ping markusmo3 for help

  3. commit the generate puml file(s)

  4. go to http://plantuml.com/plantuml/uml and add the following, while filling in the YOUR_PATTERN part. The url should point to your file in the 'raw' format.

    @startuml
    !includeurl https://raw.githubusercontent.com/iluwatar/java-design-patterns/master/YOUR_PATTERN/etc/YOUR_PATTERN.urm.puml
    @enduml
    
  5. submit the form, if successful the diagram should be displayed correctly, if not the error message should be display. Also review the diagram if everything is displayed correctly.

  6. copy the id from the url

    http://plantuml.com/plantuml/uml/HERE_IS_THE_PUML_ID
    
  7. add the pumlid front matter variable with the in step 6. retrieved ID (example)

The process looks generally fine. The first step says that the diagram can be committed only when the pull request has been approved. I think this limitation should be removed and diagrams should be submitted as part of the pull request. In step 2 generation via mvn test feels hackish. Maybe we can map another lifecycle phase into diagram generation? In steps 4-7 I see that we are going to serve the diagram from the PlantUML online tool? Another option would be to use the generated image files.

@iluwatar
Copy link
Owner Author

@markusmo3 the step 2 can be accomplished via mvn urm:map and I think we should recommend using that. See https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

@markusmo3
Copy link
Contributor

Thanks for your help on this point here @iluwatar
Unfortunately my Desktop PC isnt available at the moment, i can organise and think through some stuff but not code :/

The limitation can be removed, if you'd like to review the diagram early in the pull request.
I used maven test to also ensure the user has successful tests, but thats just a personal opinion. I have no problem changing it to mvn urm:map.

The Steps 4-7 represent the interaction with the plantuml server yes.
This is something i want to enforce and not only make available to use. The server is autoupdating depending on the puml without any steps to be taken by the user and it also removes the redundancy of having the rendered image on disk (You also dont cache websites with screenshots)

But this system could be changed, if we find out it isnt really feasible, to a jekyll-side plugin. This would mean the whole build process would have to be revamped though, so im holding back on that one,

@iluwatar
Copy link
Owner Author

@markusmo3 the issue list https://github.com/markusmo3/uml-reverse-mapper/issues looks better and if I understood correctly the most critical issue markusmo3/uml-reverse-mapper#7 has been fixed? Maybe we are close to production use already or what do you think?

@markusmo3
Copy link
Contributor

@iluwatar yes i have not noticed major issues anymore.

Just decomment (remove the hashtag #) the reviewmode variable in _config.yml and serve the website locally. The new diagrams are now shown on the respective pattern pages.

After a review we could decide to fully switch to puml. Then ill do all the tutorial writing in the wiki and commit the changes to the codebase.

@iluwatar
Copy link
Owner Author

I regenerated all the pumls and reviewed the diagrams.

  • The generated UML looks perfect. Well done @markusmo3 🍾 🍾 🍾
  • There is a cropping problem on the PlantUML server with large diagrams and PNG image. This problem occurs in about 10% of the patterns. To reproduce try to feed a large diagram like this into the tool http://www.plantuml.com/plantuml/uml.

grzegorz2047 added a commit to grzegorz2047/java-design-patterns that referenced this issue Feb 13, 2017
* Initial commit of the object mother iluwatar#498

Add a simple king and queen classes which implement the behaviour of the
royalty interface. Also wrote the object mother of royalty objects which
is final so you can just call the static methods in it to create objects
with a specific state to use them fast in tests. The tests are already
created for testing the behaviour and the type of the objects which are
created by the object mother.
I also created the UML diagrams via object aid and updated the readme.

* Add PlantUML file for the UML diagram iluwatar#498

* End process logic clause has been corrected.

* Unused import removed.

* Add SonarQube.com badge

* iluwatar#502 Replaced usages of System.out with logger.

* Change name of variables in test iluwatar#498

* add entry to parent pom.xml iluwatar#498

* Fix pom.xml

* Fix pom.xml

Deleted </modules> tag because i added it one time more than neccessary

* FirstCut++

FirstCut++

* SecondCut++

SecondCut++

* App++

App++

* App

App

* checkstyle errors removed

checkstyle errors removed

* iluwatar#502 Reverted changes in composite example, due to nature of this example using logger isn't good idea

* Remove use of coveralls-maven-plugin (sonarqube.com covers this)

* iluwatar#502 Adjusted tests for logger introduction

* iluwatar#502 Introduced logging in new example

* Create presentation template

* Link Hexagonal Architecture pattern to corresponding blog entry

* Work on Hexagonal Architecture presentation

* Add new diagram

* Add presentation link to README.md

* Update App.java

The relationship between decorator and target (in the code example between Troll und SmartTroll) ist not a composition as described in the code comment lines of class App. It's a aggregation. In a composition both instances canncot live without the other one. But the target (Troll) could live without the decorator (Smart Troll). Changed "composition" to "aggregation" in the comment lines. Code lines are unchanged.
Greetings Thomas

* Review comments++

* Review comments++

* iluwatar#502 Reduced amount of information logged

* Issue iluwatar#450. First commit. Queue Based Load Leveling

* Issue iluwatar#450. Updated pom.xml

* Updated checkstyle errors.

* Updated pom.xml with maven-pmd-plugin

Added dependency "maven-pmd-plugin" to the pom file.

* Reverted pom.xml changes that are done previously.

* Fixed PMD issue.

* Decorator pattern: Improve the example

* Removed unused imports in tests

* Proxy pattern: Improve the example

* Proxy pattern: Add missing license header

* Update URM Version to 1.4.4 and regenerated all puml files

* Update license headers

* Fixed all the code changes after review

* Review comments++

* Sonar bug fixes using Yoda condition in equals expression when comparing String literal with String object.
Using try-with-resources if we use Scanner to close the underlying stream is a good practice to handle resources.
Minimal refactor.

* Sonar bug fixes using Yoda condition in equals expression when comparing String literal with String object.
Using try-with-resources if we use Scanner to close the underlying stream is a good practice to handle resources.
Minimal refactor.

* Adding initialization on demand holder idiom.

* Changing constant interface pattern with a Noninstantiable class

* Add some material for proxy presentation.

* Add presentation for Proxy pattern.

* Add link to Proxy presentation.

* Achieved milestone 1.14.0

* Set version for next development iteration

* iluwatar#525 Add link to Queue-Based Load Leveling blog

* iluwatar#525 Add link to proxy blog

* Changing code to use interfaces instead of implementations.

* Changing code to use interfaces instead of implementations.

* Reverting initialization on demand holder idiom.

* iluwatar#190 Regenerate puml files

* iluwatar#190 Rename package for Queue-Based Load Leveling pattern
markusmo3 pushed a commit that referenced this issue Mar 25, 2017
* updated zoom ratio on the viewer to reduce lag with big svg's
* added ".noViewer" css class to prevent images from using the viewer
* added "pumlformat" to the page variables to control the format used with plantuml webserver
* minor css improvements to pictures and the viewer
markusmo3 pushed a commit that referenced this issue Mar 25, 2017
* added pumlid where it was missing and possible
* removed pumlid where it generated a bad image
* regenerated some incorrect puml's
* added 'left to right direction' puml prefix to some diagrams to improve the automatic layouting
kemitix added a commit to kemitix/java-design-patterns that referenced this issue Apr 1, 2017
* upstream/master: (67 commits)
  Set version for next development iteration
  Reached milestone 1.15.0
  iluwatar#539 Checkstyle fix
  iluwatar#539 More Checkstyle fixes
  iluwatar#539 Checkstyle fixes
  iluwatar#497 Add missing puml and license headers
  iluwatar#77 Add missing license header
  Work on iluwatar#190: urm/puml updates * added pumlid where it was missing and possible * removed pumlid where it generated a bad image * regenerated some incorrect puml's * added 'left to right direction' puml prefix to some diagrams to improve the automatic layouting
  Removed AvoidStarImport Rule Added JavaDocType Rule
  Update App.java
  Update App.java
  Update after changes from review. Additional improvements.
  Pom.xml files fixed.
  iluwatar#66 Balking Pattern
  fixed pmd violation
  fixed checkstyle violations
  diagrams added
  comments, tests and description
  changed parent POM version iluwatar#69
  apply changes from review iluwatar#69
  ...

# Conflicts:
#	pom.xml
iluwatar added a commit that referenced this issue Nov 28, 2017
iluwatar added a commit that referenced this issue Nov 28, 2017
iluwatar added a commit that referenced this issue Nov 28, 2017
iluwatar added a commit that referenced this issue Nov 28, 2017
@iluwatar iluwatar added this to the 1.18.0 milestone Nov 28, 2017
@malekkadri
Copy link

pratigya0 pushed a commit to pratigya0/java-design-patterns that referenced this issue Aug 3, 2023
* Added the CI workflow which runs the scripts under the scripts/ folder

* testing ci workflow

* Gave required permission to the CI script

* Removed a typo

* Added shell parameter to job step in the workflow

* Added the sh command to run the script

* Added the command to install flake8 for running the ci workflow

* Corrected a typo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants