[top-secret] TDD-ing one's way to `Macro.prewalk/3`

Hello fellow Exercism practitioners!!

I’d love to kick off a conversation about one of the rather advanced-topic-based exercises in this track: top-secret.

Personally, when I started the exercise, I was not versed at all with Elixir’s metaprogramming facilities. So, while I did skim the the modules introduced in this AST concept, I absolutely missed the fact that there is tree traversal support… and, yup, I failed to catch that sentence from the instructions:

… We will traverse the whole AST with built-in tools in the last step …"

Watching the “Dig Deeper” video by Mike Zornek was a real eye opener… especially at the end when he took a hard right turn and pulled in the tree traversal bit.

Once I became aware of the facility, it was a matter of refactoring my decode_secret_message/1 into the right shape.

It occurs to me that the concept of tree traversal, and within that using a walker, and writing a visitor is a hefty chunk to understand. But that’s just me.

What do the track maintainers think: do you think that it’s more useful to allow folks to work all this out themselves? or would it be welcome to provide some kind of primer of this aspect of the exercise?

1 Like

Track maintainer here :wave:

This is a tricky question. Let me explain a bit about the assumptions on which Exercism is based. It applies to the whole platform, not just the Elixir track.

Assumption 1: everything you need to solve a learning exercise should be included in the exercise’s introduction (or previous learning exercises!)

Top Secret is a learning exercise, so the introduction tells you where to look for a function for traversing the AST.

Assumption 2: Exercism is not meant for people new to programming. A general knowledge of computer science and at least one programing language is assumed.

Which begs the question: is the concept of tree traversal covered by that assumption?

I don’t know. We didn’t explain it any further because it never occurred to me before that it might need explaining!

Top Secret is the Elixir learning exercise with the lowest completion rate (only 82%). Maybe that’s the reason why?

1 Like

Thank you for all your work! :clap: :clap: :clap:

I’ve leaned hard on the curriculum to walk a “steel thread” through the language (i.e. get introduced to as many topics in a guided order as quickly as possible) and have been just delighted.

I’ve found the intros and referenced materials to be rich with relevant information. The mentoring I’ve gotten has been some of the best I’ve had in Exercism. :raised_hands:

Yeah… in fact, all the bits are there: the explicit mention of Macro and Code. I did not read the introduction carefully enough. And so, many of the important pointers, I just missed, myself.

… Top Secret is a learning exercise, …

This stopped me in my tracks. I have been blissfully unaware of this label. I vaguely noticed the “easy”, “medium”, “hard”… but I’m suddenly realizing that I was approaching this exercise almost identically those others.

What I think I’m realizing is that that label (i.e. “Learning Exercise”) will mean selecting a different approach to the exercise: I will slow down and digest more thoroughly the introduction material… I will expect to spend a little more time developing my mental model… a little more time in the docs… not so TDD-ish flow.

Had I just done that, I think I would have found that smoother learning path through the material.

I think it is.

I also think that depending on the kind of programming one has been exposed to, someone might or might not have chops around tree data structures. It’s one thing to be away they exist, it’s another thing to have had cause to write a Visitor. Personally, I’ve done it only a couple of times… but experiences vary a lot. :person_shrugging:

Might be a good opportunity for an experiment, here. For example, is there some way of providing a “hint”? Like a section that’s hidden, at first, who’s prompt is, “First time dealing with Abstract Syntax Trees and feeling a bit overwhelmed?” And then the revealed content is an even more in-depth, even more methodical treatment of the topic.

Thoughts?

I’m pretty sure there are hints section for each of the tasks already.
Very good hints, I’d say!

I’m inferring that you were able to flow through the exercise well, @glaxxie. If so, that’s fantastic!

If our desire here, at Exercism, is to have an inclusive community, one of the ways we can do that is to be willing to step outside our own experience… and consider the possibility that others might be having a different experience from our own.

If we don’t empathize, we risk negating their experience (especially if it is one containing some difficulty). One way we can negate someone’s experience is to say, “Well, that wasn’t a problem for me, so there’s no problem, here.”

I don’t know what the intention of your response was, @glaxxie, but it had the effect of dismissing the original point of the post.

Seems legit to me if the maintainers of a track say, “we hear your concern and see that the completion rate is <90% and we’re okay with that.” Or, “yeah, this is a particularly challenging exercise and that’s intentional.”

But that’s a world away from, “was fine for me (must be a you thing).” (I’m saying the quiet part out loud for clarity).

Was that what you meant? Or was there more in your mind that didn’t make it into the post?

The post was literally just a confirmation that the exercise got hints just like what you suggest

Like a section that’s hidden, at first, who’s prompt is…

It is hidden, you need to click on it to show the hint for each task.
And they were very good hints, I used them to complete the exercise.

2 Likes

Oh wow, I absolutely misread that. Perhaps it’s best I just stop while I might be able to remove both my feet from my mouth. :grimacing:

1 Like

We got there in the end :wink:

Fun sidenote, the Exercism rep of the people in this thread are 2k, 4k, 16k and 54k. I was so hoping I was at 64k once I’d looked at the first three :joy:

2 Likes

You’re such a nerd :smile:

1 Like

AMAZING. If you add jiegillet’s 10k rep to my 54k, we hit 64k! What a fantastic day!


(No-one else is allowed to post and spoil this, unless you can get me a 32k from somewhere :grin: )

5 Likes