java icon indicating copy to clipboard operation
java copied to clipboard

Add concept: `optionals`

Open sanderploegsma opened this issue 1 year ago • 7 comments

The goal of this issue is to add a new concept to the Java track that introduces optionals. The corresponding concept exercise can probably be based on the "Role Playing Game" exercise from the Rust track or the Elm track.

Instructions on how to contribute to the Java track and how to implement concept exercises can be found in the contributing guide.

As always, leave a comment here if you want to work on this exercise, and we'll assign it to you. In case you have any further questions, feel free to ask here.

sanderploegsma avatar Nov 05 '23 13:11 sanderploegsma

After adding the concept, it should probably be added as a prerequisite to the following practice exercises:

  • Error Handling
  • Word Search

sanderploegsma avatar Nov 24 '23 09:11 sanderploegsma

I would like to try on this one!

manumafe98 avatar Dec 28 '23 15:12 manumafe98

Great, looking forward to it! I'll assign you.

sanderploegsma avatar Dec 29 '23 19:12 sanderploegsma

@manumafe98 just checking; are you still working on this? Or did it perhaps fall off your radar while tackling the other issues? 😉

sanderploegsma avatar Jan 26 '24 08:01 sanderploegsma

@sanderploegsma This is still under my radar! just I was trying to get more knowledge on how to create exercises to make a better job

manumafe98 avatar Jan 26 '24 12:01 manumafe98

@sanderploegsma I was thinking on how to tackle this concept, and checking the rust example that you passed in the description, they introduce in the same exercise the nullability concept. We already have a our own concept exercise for nullability and my idea was maybe to introduce Optionals in that same exercise as we have done for example with the exercise that introduces List and Generics, I would like to know your opinion on this idea.

manumafe98 avatar Feb 20 '24 18:02 manumafe98

I'm not sure that is a good idea to be honest. null and java.util.Optional are two very different concepts that I think deserve to be highlighted in their own respective exercises. I don't want to teach students that one is better than the other, as it's perfectly fine in Java to never use Optional.

checking the rust example that you passed in the description, they introduce in the same exercise the nullability concept

Not really though, the Rust track doesn't have a concept nullability, it only provides the option concept. That's because unlike Java, Rust doesn't have null. It has None, but that is just an Option<T> with no value, which would translate to Java's Optional<T>.empty().

sanderploegsma avatar Feb 28 '24 09:02 sanderploegsma