Open Ubadub opened 6 years ago
Thanks for reporting this. Can you please be more specific about which reference disturbs you and what kind of explanation is missing?
What would you propose? Do you want to move the higher order function section? Or remove the higher order function reference?
Sure. In the Options exercise, we find this piece of text:
An alternative for pattern matching is performing collection style operations. This is possible because an option could be looked at as a collection with either one or zero elements.
One of these operations is
map
. This operation allows us to map the inner value to a different type while preserving the option:
This makes reference to map
, which is a higher order function. Higher order functions may be obvious or intuitive to people who already know some Scala or know another functional programming language, but they aren't very intuitive to people without programming knowledge, or who come from a procedural/imperative programming background.
Similarly, the next piece of instruction references fold
:
Another operation is
fold
. This operation will extract the value from the option, or provide a default if the value is None
I would suggest moving the higher order function section, to come right after Classes, or perhaps even before Classes. Scala is primarily oriented towards object oriented programming and functional programming, so it makes sense for both Classes and HOFs to be introduced very early on.
I also wonder if it would be worth adding just a section for "Functions,"which provides an introduction to the concept and syntax of functions in Scala, perhaps after Classes but before HOFs. Again, functions are obvious for people with prior programming knowledge, but are not for people without programming knowledge. Further, even if someone has prior programming knowledge, if they come from a procedural/imperative/otherwise non-functional background, they may not be familiar with the concept of a "pure" function, and it would be nice to introduce that somewhere.
@FRosner any thoughts on what I wrote?
Sorry @Ubadub I'm very busy at the moment and I couldn't find the time. Maybe another maintainer can take over.
@FRosner Ok, thank you.
The Options exercises makes reference to higher order functions, with very little explanation, which can be confusing for beginners. It should come before Options. The explanations should be buffed up too.
I'm willing to fork it and make the necessary changes if no one objects.