Really confused about the Coordinate Transformation exercise on the Closures topic

Sorry if the tone for this thread is overly negative, but I’ve honestly been baffled by this exercise for the last couple of hours. This has been the first time in the JS track where I really didn’t get the point of the exercise. I’ll try to break down the issues I had with this exercise:

  • I don’t see how these exercises are supposed to help me understand the concept of closures, and the fact that they revolve around functions returning functions, something that wasn’t covered in the topic’s explanation, makes it extra confusing, as this is something that hadn’t been covered previously either and isn’t immediately clear as to how it relates to Closures.

  • The questions themselves are difficult to understand, they seem to assume previous knowledge of terminology like “translating” and “scaling” as meaning “sum to an offset” and “multiply by a factor”. Maybe these are obvious to the creator of the exercise, but it wouldn’t hurt to clarify these points within the question or in the hints.

  • The hints aren’t really helpful to someone struggling with understanding the idea of the exercise. In previous exercises, the hints would give you a starting point, followed by steps to achieve the final answer. I really liked this, as it would give me a general direction to start in when I was completely lost, with optional further hints to guide me along. The hints for this exercise have none of that, they’re basically just reasserting the question itself without any further orientation.

I was only able to get through this exercise with help from ChatGPT, and don’t really feel like I learned anything from it. I’m disappointed in my own inability, but also feel like this exercise could really be improved in a variety of ways. The track so far had been fantastic, with a gentle but challenging difficulty curve, but this section was a discouraging difficulty cliff.

1 Like

I appreciate the constructive feedback, thank you.

After solving it, do you have any specific ideas as to how we could fix things, beyond the general points? (e.g. are there specific hints we could add to improve things?)

Hi! I’m not a maintainer, just a fellow learner. But,

Did you read the Closures concept page? It gets into functions returning functions etc.

Speaking of that page I think the example in point 2 of Reasons to use closures in JavaScript section is wrong.

// Or apply a few to create a flexible system of functions for reuse.
function buildHttpsExercismUri(path) {
  return partialBuildUri('https')('');

should either be

function buildHttpsExercismUri(path) {
  return partialBuildUri('https')('')(path);

'cause what is path doing otherwise, or

const buildHttpsExercismUri = partialBuildUri('https')('');

The second usage makes more sense with regards to closures. You use partialBuild to generate a function to then reuse multiple times, where the scheme and domain are pre-set via the closure.

That’s odd, I don’t recall seeing that explanation before, was it added recently? Either way, the explanation on functions returning functions doesn’t appear in the notes next to the exercise, in the editor.

In regards to the hints, I would prefer if it was like the previous exercises in the track, starting with something broader then breaking down the steps to completing each exercise in more specific terms. Also, maybe add a simpler exercise first, to ease into the harder questions about returning functions. On a different note, the explanation on returning functions does not appear in the sidebar next to the editor when solving the exercise.

1 Like

In an oversimplified terms, a closure is when a child function can access variables defined in the scope of its parent function. That’s all there is to worry about. (Of course I’m oversimplifying here for the sake of brevity)

@nicodmp, I remember picking up your mentoring request for this exercise, so I’d be more than happy to assist you if you need more help specifically about your implementation, or here if you wish to discuss with more people.

1 Like

I think we should solve this as this part is not hard to fix.

I think this is a good idea. Do you have a suggestion for hints we can show? These can both be in the form of the hints on the right side, or admonition blocks we can add in the instructions (highlighted “extra” content).

I agree. Same question as above.

For context, this exercise was written before we had a tree / structure for the syllabus, and thus, it has not yet been improved upon. We can make that happen.