-
-
Notifications
You must be signed in to change notification settings - Fork 709
binary-search;binary-search-tree;custom-set;linked-list;simple-linked-list: use generics? #230
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
Comments
@jtigger I think the use of generics is a good idea. We don't use them much in this track, and it's a key feature of the language. I think we should go 'all in' for generics here. |
@jtigger neither of these options seem to be consistent with our recent discussion on @matthewmorgan good point, but how should we handle existing canonical test data? Add tests above and beyond the canonical tests? PR into the canonical test data with new tests that use different data types for all tracks, or for statically typed tracks only? |
@stkent said:
Ahhh... my apologies, Stuart. I was not paying close enough attention / thinking holistically enough to catch the fact that the type variable was being required by the test suite. In my comments in that discussion, I was focused on the example code, not the test. Whether or not the example code uses more language features than are strictly required by the test suite, I currently believe is largely an implementation detail. If the contributor wants to write a super generic solution... as long as it passes the tests and at least covers the behavior, I'm personally not too terribly concerned... I'm sure there's a length to the leash, but I haven't seen it yet. But the tests themselves.... well! That's another story! I think we should be strict and intentional in the tests as they are the heart of the user experience on the track. Did I clear things up? |
I see this is also the case for
I'm hearing rough consensus that the answer to 1 is "YES!" |
@jtigger nicely summarized, thank you! Very clear :) And my answer for part 1 of the question would indeed be yes! Part 2 is probably yet another decision that is dependent on #142 (still planning on getting to that over the weekend; triaging another OS project of mine at the moment), and we could ask part 3 in x-common now to see how other tracks feel. There may be other languages that have already explored this path some? |
Doing some homework on this... JavaThere's some history/prior conversation around generics on this track (even including yours truly).
X-Commonexercism/problem-specifications#488 notes that some Objective-CLooks like the Objective-C camp went "all in" on generics: exercism/objective-c#45. In that issue, @kytrinyx does poke at the added complexity and looks like Mr. Jimenez (@masters3d) opted to pull back on the first so many exercises. C#
|
Some programming languages, as well as earlier Java versions, do not have Generics. So, exercise descriptions may mot contain references to it, as well as test specifications, but it seems like a good idea to prod a learner to explore new language features. It might not be a problem if such exercises are not at the beginning of a track. Also, one can submit whatever solution, may be containing only the method main() and learn how others solved the problem. In addition, one can learn from JCP where different implementations of the same JSR innovate on their own, they add new features on their own, which can later be added to the JSR. So, various implementation of exercises can be used to update test descriptions. Not necessarily right now. Maybe using generics in some exercises is YAGNI, but adding some unnecessary functionality using Generics is not high cost and it teaches one about Java as well. As to tests, for example, The C# implementation for list-ops contains some tests for different data types, like Integer, String, and List, so the Java track would not be the first if tests for different data types are added. Also, not all exercises have test descriptions, so it's time to come up with proposals. |
Having watched a Java learner go through these exercises, I will say that requiring support for but not exercising generics causes confusion. I'd recommend we update the tests where possible. |
... you wouldn't be referring to a professor friend of yours, would you?!!? :)
... and by that do you mean that we should explicitly exercise generics? |
🎓 😉 I propose that for exercises whose tests force implementations with support for generic types we:
in that order. |
Here are the difficulty rankings of the exercises in question:
Seems like at least the last three in that list should be massaged into clear requirements for generics (including, perhaps, a short introduction to generics and references). Two questions:
|
A good first step would seem to be to actually deprecate [Aside: I've been trying to encourage Rebecca to post issues here rather than telling me when she thinks an exercise is awkwardly placed... no luck yet, but I'll keep asking her!] |
Please do! Least she forget, she's made significant contributions in mere suggestions (e.g. more exercises with starter code); great source of ideas! |
Agreed.
I have yet to do these, so I'll defer (with confidence).
Sounds very well reasoned, @stkent. @FridaTveit, you good with all this? |
Sounds good :) |
I did
I think it would be very helpful to more closely align |
So these exercises should be reviewed/cleaned up, it seems.
I'm starting out with linked-list now. |
Taking |
From what I can tell, |
I think |
I agree, I'll untick it in the list then and hopefully do a PR for it soon :) |
@rstockbridge all these exercises featuring generics have been rewritten (thanks, @FridaTveit!). They have also been reordered within the track, if you would like to revisit them:
|
linked-list
's tests only insert and expect integers. However, the tests force the practitioner to generify the class.We should:
Number
orInteger
What do you think?
The text was updated successfully, but these errors were encountered: