Skip to content
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

Higher Order Functions should come before Options #101

Open
Ubadub opened this issue Dec 16, 2017 · 5 comments
Open

Higher Order Functions should come before Options #101

Ubadub opened this issue Dec 16, 2017 · 5 comments

Comments

@Ubadub
Copy link

Ubadub commented Dec 16, 2017

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.

@FRosner
Copy link
Member

FRosner commented Dec 16, 2017

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?

@Ubadub
Copy link
Author

Ubadub commented Dec 27, 2017

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.

@Ubadub
Copy link
Author

Ubadub commented Sep 29, 2018

@FRosner any thoughts on what I wrote?

@FRosner
Copy link
Member

FRosner commented Sep 30, 2018

Sorry @Ubadub I'm very busy at the moment and I couldn't find the time. Maybe another maintainer can take over.

@Ubadub
Copy link
Author

Ubadub commented Oct 1, 2018

@FRosner Ok, thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants