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.

2 Likes

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')('exercism.org');
}

should either be

function buildHttpsExercismUri(path) {
  return partialBuildUri('https')('exercism.org')(path);
}

'cause what is path doing otherwise, or

const buildHttpsExercismUri = partialBuildUri('https')('exercism.org');

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.

2 Likes

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.

3 Likes

unless I’m missing something, there’s nothing on that page about returning functions from functions?

To echo what nico has said, I found this exercise very strange. I was going to post the same things that they have.

The hints don’t have anything useful in them, the instructions for the first 2 tasks are basically identical and there’s nothing obvious to suggest that you just add vs multiply.

The other exercises all have some context to them for example: “The arcade hall keeps a separate score board on Mondays. At the end of the day, each player on that board gets 100 additional points.” This one doesn’t…

This exercise genuinely feels like its bugged or is an incomplete draft.

You’re not missing anything. The exercise notes really don’t mention returning functions (although, the examples do) and that’s because closures are not necessarily all about functions returning functions, it’s just the simplest way to create a closure. Did you check out the Closures concept page? It has a bit more details than the exercise notes.

Your criticism (and others’ for that matter) is valid tho. I think the docs for this exercise can be made more clear and if you have any particular suggestions on how to do that, you’re welcome to share.

1 Like

I think what’s happened is that I’ve completed more of the learning track (or perhaps just the closures exercise) and I can now see more of the content of that page.

The screenshot I posted earlier was all I saw when navigating to that link (it was also posted by themetar), now I am seeing significantly more stuff in there, so I think that’s added to the confusion. It certainly would’ve helped in making the exercise make more sense if I had the extra info when trying to tackle it.

Presumably that also happened with Nico above "That’s odd, I don’t recall seeing that explanation before, was it added recently? "

Maybe there’s a bug with the closures concept page?

I can confirm that there is something wrong:

I also have not yet solved the exercise associated with the concept. Opening the closure concept page, I only see the shorter version (matches screenshot above).

Opening the same URL in a new browser without being logged in to Exercism, I see a much more explanatory article on closures. I suspect, this is the version one sees after solving the exercise.

1 Like

This is by design. Please see concepts about.md. While the introduction.md might need more information in this situation, having more information display after you have completed the exercise is intended.

There are some tracks that do make the concept introduction.md match the about.md. But others - like JS and Python have shorter introdcution.md files, with longer about.md files.

The logic being that students would read the concept introdution.md to get grounded, then learn by working through the exercise introduction.md + instructions.md and examples (and whatever documentation links are provided). Afterward, they then get more details/caveats/avenues of exploration in the concept about.md doc, should they want to refer back to the concept later, or explore further. Usually, the concept about.md is a superset or combination of the concept introduction.md and/or the exercise introduction.md.

You can see an example of this on the Python track for Little Sister's Vocab, which is the concept exercise for strings (``str`):

  1. The String concept introducton.md
  2. Little Sister's Vocab (strings) introduction.md
  3. Little Sister's Vocab (strings) instructions.md
  4. The String concept about.md

More information/documentation here : Building Tracks on the website.

1 Like

But if I’m not logged in, I have completed the corresponding Concept Exercise?

To the workflow design choices: I don’t ask to change that, but I wouldn’t do this. It’s like expecting people to look again into a book they have read to find the sequel in there now. That’s very uncommon and surprising. Usually you read the whole enchilada first and then do exercises that refer back to what was in the document. At least there should be hints about available goodies in the very same place when the exercise is done (and don’t forget to flush the browsers cache to get them).

1 Like

Maybe. And agree it would be good to have a prompt to the student to “revisit” or “review additional details” in the about.md once they’ve completed the exercise. And I think some mentors encourage that as well during mentoring sessions.

However, we did (and still do) get loads of complaints about “too many words”, and “too much text” and “too many details to pay attention to” for concept/exercise introductions (on the Python track at least), so this was a way to avoid some of that - the same way that approaches docs (accessible after an exercise has been completed) dive into multiple ways of solving an exercise in detail – but not before a student has worked through the problem at least once.

That doesn’t meant that things don’t need to be adjusted for certain concepts or exercises – everything can be improved. And I do find myself changing the way intros and about docs are structured more and more as I start to work on more complex or compound concept exercises for the track.

It also doesn’t meant that the docs have to be different lengths, or have different content. It just means that there is flexibility in what goes where, and there is a timing thing that kicks in: introduction.md shows ahead of exercise completion, and about.md shows after.

Edited to add – the logged-out/non-joined behavior is something different. As I recall, @iHiD had a write-up of the reasoning for it, but I can’t find it at the moment. Something to do with non-joined track members having full details of what they might learn in order to decide to join or not.

It’s 100% SEO.

I think I approve of this approach. This way a student is going through the necessary knowledge base at least three times, once before the exercise is started, once while solving it and once after it is done, so higher chance to actually learn things.

However I do think that many students would completely miss that there is extra info to read after they’ve done the exercise so there may be need for some sort of prompt or hint to make it clear that you can go back to read extra. (Assuming that there is any extra)


To get back to the topic at hand, in particular for the Closures exercise, improvements can be made, I think.
I don’t know if I’ll have time to restructure any of it so if anyone else may have ideas, they’re welcome. Otherwise, well, I may get to it eventually…

1 Like

If the content is 90% the same, I personally would not want to read nearly identical content to try to find the bit that is different. But maybe I’m an outlier.

Hey I’m not a mod but I’m agreeing with you. Although I somewhat enjoyed functions calling functions after being frustrated for perhaps 40mins and then calling on some old discrete mathematics theory. But that isn’t what this exercise is about. It’s not supposed to challenge anything else much other than perhaps previous concepts taught. Closures, if I’ve got this right, is basically scope defining of variables and such. And this shouldn’t be this difficult to learn and practice.

Unfortunately the mental model for enclosing values and/or variables is very hard to a lot of people and doesn’t exist in all programming languages.