hediet / vscode-debug-visualizer

An extension for VS Code that visualizes data during debugging.
https://marketplace.visualstudio.com/items?itemName=hediet.debug-visualizer
GNU General Public License v3.0
7.85k stars 409 forks source link

Visualiser Support for Java #70

Open thefreakingmind opened 3 years ago

thefreakingmind commented 3 years ago

This really seems to be a Cool Feature. I am looking forward to add the Support for Java as it is my Main Programming Language. This is super cool for Working on Algorithm and Data Structures. Helpful for debugging and should be available for a Most important Competitive Coding Language (Java).

hediet commented 3 years ago

Hey, that is awesome! I would love to assist you doing that - we should schedule a virtual meeting!

thefreakingmind commented 3 years ago

Hey Sure. Let's schedule it on Thursday

hediet commented 3 years ago

Hey! Which time suits you on thursday? This time interval would work very well for me.

thefreakingmind commented 3 years ago

4 PM German time work for me.

hediet commented 3 years ago

We can meet here https://meet.jit.si/ImpressiveProofsTellSilently ! See you there ;)

thefreakingmind commented 3 years ago

Hey Let's meet in 2 hrs. I am out right now. Works??

hediet commented 3 years ago

Hey! Would be in 3hrs ok too?

thefreakingmind commented 3 years ago

Sure.

hediet commented 3 years ago

I'm in the jitsi meeting now!

DhruvDh commented 3 years ago

Did something become of this?

I am someone who's teaching Data Structures next semester. We do the course in Java, and this would be very, very useful for students to have.

For my student's use case, they only need to visualize certain classes, for example a LinkedList<T>. These are not from the standard library, but to be implemented by students themselves.

From your reply here - https://github.com/hediet/vscode-debug-visualizer/issues/63#issuecomment-683347518, for python the steps would be -

  1. I think the first step would be to document which python values should be visualized and how they should be visualized. For now, the "how" should be one of the existing visualizations. All those existing visualizations can be described with JSON, so the goal would be to collect (python value, JSON document) tuples.

I happen to know what java classes I want visualized, and I think the existing visualizations would suffice.

  1. Then, we can think of python functions that build such JSON documents from such a python value. For the debug visualizer, such a function is called "Data Extractor". These python functions also need to decide whether they can extract a JSON document for a given value and how good the extracted visualization data is in terms of a numerical priority. Each such data extractor should have a unique id.

So writing java methods that take an object as an input and return a JSON description that the visualizer ingests to produce visualizations. Each kind of "extractor" java method should also return a value talking about how useful it is to use that extractor for the input object.

  1. Given a list of those data extractors, an optional preferred data extractor id and some value, we need some logic to return the best visualization data for that value, considering the preferred data extractor id. Also, all applicable data extractors should be reported (so that the user can select one of them, this is already implemented).

In my case I intend to write bespoke extractors for each java Class I care about, so this should be easy.

  1. Now we need a way to make this data extraction library available to all python scripts. In case of javascript, the debug visualizer extension just evals the library into the debuggee.

If I implement an interface VisualDebugable, with a extractor abstract method for all classes I care about, that's it? In terms of making the data extractor method available, this sounds enough to me.

It feels like what I describe will end up working up till here. But I am not sure where to go from here? How would the debugger know to call a certain data extractor method, and how would the JSON description of the visualization reach the methods that render these visualizations?

Any guidance would be much appreciated, I have a soft goal of having a prototype ready for visualizing any one java class by 21st of December. And I have for the most part all day free to work on this.

I know you've hopped on to video calls guiding people trying to make visual debug work for other languages - can I make a suggestion here? Could you record these conversations? It would help future contributors, and it would save you the trouble of having the same conversation with multiple people.

PS. This work is great, if my course was taught using JavaScript the students would have loved this!

hediet commented 3 years ago

Hi, that sounds great! If you like, we can schedule a meeting and discuss the steps to do this - I'd be happy to help you! What time would suit you? My timezone is CET, anything between 10am to 10pm works for me.

DhruvDh commented 3 years ago

That sounds great. From the times you've listed, my waking hours fall between 4pm to 10pm CET. How does 6/7pm 17th December sound?

hediet commented 3 years ago

Great! I'll post a meeting link later.

hediet commented 3 years ago

Meeting link: https://meet.jit.si/debug-visualizer-java 6pm CET

DhruvDh commented 3 years ago

Thank you! I'll be there.

DhruvDh commented 3 years ago

I've joined the meeting in the link.

harshlele commented 3 years ago

hey did anything happen of this?