-
Notifications
You must be signed in to change notification settings - Fork 35.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(17) New exercise | Flatten #445
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do we think about the benefit of this exercise in context, given that Array.prototype.flat
exists which is identical to this, other than the default depth is 1 instead of Infinity?
While any kind of practice with recursion is still practice with recursion, I feel like if we're to create new exercises for that purpose, they ideally should be:
- problems that are naturally more suited to using some kind of recursive approach than pure iteration. An exception can definitely be made for the Factorial exercise, given it's the first one and also a classic for dipping your toe in recursion. But later exercises should probably look to fit this bill.
- something that isn't just recreating a built-in function. If we want practice with recursion, we probably would be better off solving a problem that would need us to build something recursively, as opposed to recreating a built-in where in the real world, we'd just use the built-in.
My personal opinion is that this exercise doesn't meet the second criteria, where a different exercise that does would be more appropriate while still affording the learner plenty of good practice with recursion.
@JoshDevHub tagging you for your opinion since you did mention something among these lines at some point.
I honestly don't think it is a big deal that Take the HashMap project for example, you're not going to implement your own hashmap and probably going to use something like a Sure, it may be better to have more exercises that focus on other tasks, and are not necessarily about re-creating a built-in, however I don't think there's any harm in leaving this one in. People will still learn a lot if they complete it. Regardless, I'm content if you still think it should be removed. If we are at this point though, I think its now important to decide which exercises we want to add soon. I have added a comment to the original issue as it is certaintly more relevant there than in this PR. |
This is just my opinion though. If others disagree and think The difference I find is that with the Hash Map lesson and project, you're not tasked to recreate Sets or Maps. Also, the pedagogy behind the project is to practise some lower level concepts like hashing, collisions, growth etc. To practice those, you kinda need to create a hash map from scratch (again, not a Set or Map - just a barebones hash map according to that spec). The intent of that project is very different. In this case, the concept we want learners to practice is recursion, especially the recognition of patterns and problems that lends themselves well to recursion. Doing so is not particularly tightly bound to flattening nested arrays, so I don't see it as particularly necessary to make people recreate that built-in, when there are other exercises that can pose more unique and valuable recursive problems. Hope that helps my perspective make more sense? |
I see where you are coming from, thanks for clarifying it! You make a good point about the hash map project. |
Closing because we decided not to include this exercise! It is about mimicing the functionality of a built-in method and it would be better to have learners complete challenges that are more like real world problems. |
Because
It was decided to add new recursion exercises
Previous
This PR
Issue
Related to #27265
Additional Information
Pull Request Requirements
location of change: brief description of change
format, e.g.01_helloWorld: Update test cases
Because
section summarizes the reason for this PRThis PR
section has a bullet point list describing the changes in this PRIssue
section/solutions
folder