The description of the Kindergarten Garden exercise contains the following paragraph at the end:
In this exercise you’re going to be using a concept called dynamic programming. Dynamic programming - Wikipedia Your solution could use the class method #define_singleton_method or the combination of #method_missing and #respond_to_missing .
The term dynamic programming is not well used here, as it is a technical term from algorithm design which has nothing to do with metaprogramming suggested by the following sentence. As such, I find it misleading, which is aggravated by the fact that the link points to an article that, of course, discusses the algorithm design technique, not metaprogramming.
Sure, I can submit a PR. When it comes to rewriting the paragraph, I would also add a mention of #define_method into the suggested “reading”. As such, I would propose replacing that paragraph with this:
The exercise requires you to write a class that responds to a single method for each child in the class, respectively. You can make your work easier and less repetitive if, instead of manually defining 12 different methods, you use a bit of metaprogramming. Your solution could use the method #define_method (or #define_singleton_method), or alternatively a combination of #method_missing and #respond_to_missing?.
I suffered a nonsensical yet persistent misreading of responds as corresponds. Would your suggested paragraph lose significant meaning if it used with instead?
Another possible point of confusion (which actually contributed to my misreading): class is used twice in the same sentence, but with different meanings. Maybe replacing child with student would help here (as child could refer to a CS concept as well).
For the rest your suggestion looks good and makes sense to me. I am not familiar with Ruby though.
I suffered a nonsensical yet persistent misreading of responds as corresponds . Would your suggested paragraph lose significant meaning if it used with instead?
I think that responds to is a Ruby terminology (see, e. g., #respond_to? and #respond_to_missing?, though I am not completely sure. But it could be changed, I believe, without loss of precision.
Another possible point of confusion (which actually contributed to my misreading): class is used twice in the same sentence, but with different meanings. Maybe replacing child with student would help here (as child could refer to a CS concept as well).
Reading it again, I see the problem, but the rest of the assignment unfortunately already uses this terminology of children in a kindergarten class, so I am not completely sure how to rephrase it to stay consistent with the rest.
All in all, I could imagine a possible rephrasing like so:
The exercise requires you to write a class that provides a single method for each child in the kindergarten, respectively. You can make your work easier and less repetitive if, instead of manually defining 12 different methods, you use a bit of metaprogramming. Your solution could use the method #define_method (or #define_singleton_method ), or alternatively a combination of #method_missing and #respond_to_missing? .
@JakubSarnik The system doesn’t know that you’ve already had a forum discussion, but it will get reopened if you reference such a discussion (which has happened now)