DOT DSL exercise

How do I figure out how to implement the Dot DSL exercise, I don’t know how to go about it. Could someone give me some hints, please?

Read the instructions, run the tests, get the tests to pass one at a time :slight_smile:

Is there some part in particular you’re having trouble with? Did you write any code yet?

Thank you for your reply. I have read the instructions, but I haven’t written any code yet, because I don’t really understand the requirements, even after looking at the test cases. I feel as if I am missing something obvious.

Have you done other practice exercises on Exercism or is that the first time that you try test-driven-development?

I have completed a few of the other practice exercises, but they seemed a lot simpler than this one.

Exercises all have a difficulty rating. Maybe focus on easy ones first and work you’re way up to hard.

The Java track describes the exercise as Easy (difficulty 2). In my opinion, this is inaccurate. Across tracks, the median rating for this exercise is Medium (difficulty 5).

2 Likes

I agree that the difficulty rating is inaccurate.

Rewrite Graph.java to create a class whose methods can create and store a graph structure with nodes, edges, and attributes. In other words, you create a simple (internal) DSL to describe graphs.

Thank you for your reply. This is embarrassing, but how do you figure out how to create the constructors for the graph based on the tests? I just find this exercise a lot more difficult than the previous ones that I have completed.

analyze the Graph class, there are two constructors there,
the second one has an attributes parameter, so you should probably do something with those attributes. Where are the Graph attributes used? …

use reversible logic to make sure everything works as the test expects,
i.e. when it expects a node named “a” which it previously created using node(“a”), getNodes() returns an object where node “a” is stored.

1 Like

Thank you, I finally solved the exercise.

1 Like