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

Grapher, to create graphs from an Injector #213

Closed
gissuebot opened this issue Jul 7, 2014 · 14 comments
Closed

Grapher, to create graphs from an Injector #213

gissuebot opened this issue Jul 7, 2014 · 14 comments

Comments

@gissuebot
Copy link

From limpbizkit on June 23, 2008 12:48:17

It would be great if we had a robust, easy-to-use class that creates graphs from Injectors.

I've attached the source of a proof-of-concept, its source, and a generated image. The application
uses Graphviz, which makes the actual graph part easy. http://www.graphviz.org/ It would be nice if the graphs that were easy to read. There's two major types of edges (Bindings, InjectionPoints ) in the graph, and they should look different. In the attached code, I used different
arrowheads for this. A good implementation could go much further (colours, line styles).

There's a lot of information in an Injector, and a good graph could make understanding it very easy.
It would also be nice if it the grapher had extension hooks.

Attachment: gist
   InjectorGrapher.java
   Graphed.java
Binary attachments: Picture 3.png

Original issue: http://code.google.com/p/google-guice/issues/detail?id=213

@gissuebot
Copy link
Author

From victorcisneiros on June 24, 2008 08:22:02

Hi. I saw your blog post and I'm interested in helping with this issue. I have some
experience with the Java2D API and think I can help.
Here is a sample of my work with Java2D (still work in progress) http://www.cin.ufpe.br/~vcac/projetos/PaintOnline.jnlp If you are willing to accept my help please send me an email with further
instructions (gmail: victorcisneiros). I have never contributed to an open-source
project so I'm not sure how I should proceed.

@gissuebot
Copy link
Author

From limpbizkit on June 24, 2008 10:18:58

FYI, I talked to victorcisneiros and he's no longer interested in implementing this. If anyone wants it, it's up-for-
grabs yet again.

@gissuebot
Copy link
Author

From avishn on July 02, 2008 14:35:46

I'm working on a library for automated graph layout -- https://code.google.com/p/modsl/ .  The primary goal of my project was to be able to
process a simple domain specific language into a UML diagram (for quick and dirty UML
sketching). Internally the graph is represented as a simple hierarchical tree of
nodes, edges and labels of different types, so I think it wouldn't be that hard to
reuse it for your injector graphing. Also it is quite flexible in terms of
customizing look and feel. I could work out the integration part. Please let me know.

@gissuebot
Copy link
Author

From limpbizkit on July 02, 2008 17:15:53

We've already got Graphviz for graph rendering and layout. It works fine and meets our needs.

The problem I'm interested in solving is generating the actual Graphviz file to use as input. This file should
describe the injector, balancing the tradeoffs between readability and completeness.

@gissuebot
Copy link
Author

From avishn on July 03, 2008 07:48:34

Graphviz is an excellent tool. I'm curious though if you're planning to bundle it
with Guice (Graphviz is not cross-platform) or if it is expected to be present on the
developer's machine to take advantage of the Guice graphing functionality.

@gissuebot
Copy link
Author

From limpbizkit on July 03, 2008 08:11:16

I'd prefer we generate a graphviz .dot file but not render it.

Users can view .dot files in many viewers. According to graphviz.org, there's viewers for Unix, Windows, Mac,
Java and even SVG.

@gissuebot
Copy link
Author

From esko.luontola on September 14, 2008 11:50:19

The tool should provide information about the scopes of the bindings, both built-in
and custom scopes. It would also be useful to see an object diagram, which visualizes
how the object graph will look like at runtime. This would be useful in debugging the
number of instances per scope (see http://groups.google.com/group/google- guice/browse_thread/thread/93dd8f0efc765ac8?hl=en).

@gissuebot
Copy link
Author

From phopkins on December 21, 2008 23:46:50

I'd like to take this on.

I've attached some output from the tool I whipped up. I still need to handle providers, and I think there's some
improvements that could be made to the display (Graphviz apparently has rough HTML support, so I could do
background colors, possibly small text, and italics).

Let me know what you think.

Binary attachments: guice-out.png

@gissuebot
Copy link
Author

From phopkins on December 21, 2008 23:47:34

Oh, and the generated dot file.

Attachment: gist
   guice-out.dot

@gissuebot
Copy link
Author

From limpbizkit on December 24, 2008 20:39:29

@phopkins - wow, this is fantastic. I really like the dotted lines styling the interfaces. Sweet!

FYI, I've recently made some big changes to the SPI, which will certainly break your code. I've changed the
Bindings to have proper types so the visitors aren't the only way to get at the data - they were quite clumsy to
work with.

I'd also like to use your grapher to help us to ensure the SPI is 'good enough'. What are the rough edges? What
are we missing? I'm going to try to fill in the gaps to make sure all the necessary stuff is in there, and your
input is extremely valuable.

@gissuebot
Copy link
Author

From phopkins on December 24, 2008 20:42:49

A bit more. :)

Gray background denotes an instance, double arrow denotes binding to a provider, and circle-arrow denotes a
constant type conversion.

I think I packed in most ways to Guice stuff together in this example.

There's no scope display yet, but I figure it'd be better to focus on getting this cleaned up and checked in first.

Attachment: gist
   guice-out.dot
   BackToTheFutureModule.java
Binary attachments: guice-out.png

@gissuebot
Copy link
Author

From phopkins on December 24, 2008 20:51:45

Crossed messages. :)

The two bugs I filed (that you found) are mostly what I found for roughness. The other big one I can think of is
Multibinding support. The bindings that it creates are a bit of a mess when viewed naively through SPI (in
particular, the RealMultibinder instance has no dependencies on the elements, just on an Injector), and the
classes that one could try to instanceof a way out of (such as @Element) are package-private, so no luck
there.

What's the best way to share the code, so you can see if the Visitor bits look right to you? It'll be a big CL.
(Btw, are there code conventions / developer docs lying around? Is it basically just Google style? 80 or 100?)

Looking forward to trying your updates. I haven't synched since the weekend, so I'll see how things come
together over the next day or two.

Oh, and as I said I haven't looked through Scopes yet, so I don't know how well the SPI stuff works there.

@gissuebot
Copy link
Author

From phopkins on December 30, 2008 12:05:07

(No comment was entered for this change.)

Status: Started
Owner: phopkins

@gissuebot
Copy link
Author

From phopkins on December 30, 2008 13:59:11

Fixed w/ r752

Status: Fixed

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

1 participant