the solution for this deconstruction problem is incomplete! it requires another step for the instruction to be useable. the student must understand that the current ‘solution’ doesn’t work in a real-world use scenario because THERE IS NO WAY FOR half TO KNOW THAT stats IS BEING PASSED INTO IT!!
a simple, more complete, solution to this would be something like this:
i’ve come across several such ‘solutions’ and finally had to say something. the novice student may use this as reference and may not connect the necessary dots to get this to work. which means they’re frustrated and that’s not useful when learning.
Use destructuring assignment within the argument to the function half to send only max and min inside the function.
Calling the function is not part of the instructions. The console.log has absolutely nothing to do with rewriting the function half to use destructuring.
my point is that call should be in the code. the whole reason i am actually doing this post is because a colleague got stumped on this question and asked me about it. so as a learning tool, this should have the call in the code. which, AFAIK, is what this site is all about. plus it’s a small tweak that adds a lot of clarity for noobs.
The function call is in the test. The user is supposed to modify the function to have the appropriate behavior when the function is called.
Honestly, if a user is that far into the ES6 section and does not understand the difference between a function and a function call or does not know how to experiment with a function to see what it does, they probably are moving too fast and are not ready for the lesson they are on.
@JeremyLT that’s a good point. i’ll mention it to my colleague. he’s a pretty linear thinker (a touch on the spectrum methinks) and is trying hard to get up to speed on our projects. i’ll also have a word with our training officer. maybe she can help him pump the brakes a bit.
Thank you, for taking the time to provide feedback about your experience with this lesson. It is useful to have, and perhaps there is conversation to be had about improving either, as you have mentioned, this lesson, or the lessons prior so that this one is not out-of-the-blue.
As a learner, I would like to add my own experiences with the deconstruction problem: It was the first and only challenge I did not solve myself and needed help. I will not claim that I have solved it with the function call console.log(half(stats)); but this line would have been helpful in retrospect.
Even if I do not have much knowledge in programming, I do have some adult education experience. I always tried to follow two maxims:
Provide a learning environment that comes as close as possible to reality.
Whenever possible, make all hidden assumptions transparent.
In my opinion, not including the functional call violates both maxims.
BTW: I found the defense for not including this line strange because I am missing an argument why NOT including this line.
all the challenges have been uniformed to not include function calls in the editor, and as less as possible of other stuff, probably this one like others could also not include the object in the editor but in the description - learners tend to focus too much on global objects instead on having the function being able to do everything, and rely instead on the function parameters. It’s a thing in progress.
I admit, the previous version of the challenge did had that… I think it was my first question on the fourm, or around there - how are the function and the object connected?
I think it’s just really confusing, at a point in which you are starting to familiarise with functions and all the other ES6 stuff, and boom, destructuring, which kind of fry your brain even more
Agreed. Having the learner make the leap from seeing that the function they wrote working for the global object and single function call they see in the editor to having the learner understand that functions are reusable entities that do not rely upon their inputs existing on the same screen at the same time seems to be a big stumbling block for some. In real production code, you often have function calls in separate files from the function definition, so learners need to eventually understand that a function can exist and be correct without being called in the same file.
Issues understanding scope and independence of function calls seems to especially come out of the recursion lessons all the time. The abstraction that a function is a separate logical entity and each function call is a separate entity is hard for some people to get used to.
I see. This was helpful for me and countered my first maxim as it is obviously a reality that “a function can exist and be correct without being called in the same file.” I didn’t think about that.
But still: Is it pedagogically advisable to explain/teach a new and difficult to understand feature embedded into another complexity? The lesson aims to understand “Destructuring Assignment to Pass an Object as a Function’s Parameters” and not to “understand that a function can exist and be correct without being called in the same file.”
I agree that it is useful and important for raising the level of proficiency to combine different taught concepts into challenges. But after a new taught concept is studied on its own and understood.
Maybe? Somehow we have students this deep into the curriculum who are not understanding that functions exist independent from what similar global variables exist or if the function being called. That is a concept that should be understood by now. This should not be a new idea at this point. And by this point the learner should know how to add function calls and console logs to interact with their function.
What’s the best way to set up this lesson and the entire curriculum? I don’t know. But I’m confused at students not knowing how to add log statements and experiment with the code this far along.
Luckily, we do have the forum to answer any questions that come up. Learning how to ask questions is a big step is becoming a programmer.
I believe I understand our different assessments of the problem. I do not have your broader perspective and experiences with other students. I just wanted to contribute ideas and thoughts about the educational structure of this one challenge.
Yeah, different ideas and perspectives are definitely helpful. You’ve added more information to a problem I don’t yet know how to solve, which is great.