In the tradition of Programming Études, here are some exercises, or studies, in Ruby.
Saying "some excercises" is, at the moment, an exaggeration: there's only one, for simplifying boolean expressions (based on an old blog post). But I'm playing with the idea.
Some subjects that might be fun to cover:
- Data structures. Implement binary search, or a stack, or a deque.
- Decompose classes or methods. Target: get the average method's flog score under a threshold.
- Meta-programming.
- Working with closures.
A glance at Programming Praxis suggests that they often do algorithms, math, and bit-twiddling, which could be a good source of ideas. Project Euler is also very math-y, but they already do such a good job that I'm not sure this format has much room to improve on it.
The boolean-expressions étude uses minitest to tell you whether your solution is still correct, and it uses flog, which uses something like ABC metrics, to tell you how good your solution is. (It even gives you a target flog score.) I know ABC metrics are an imperfect measure of code quality, but they work well enough here. I don't imagine all the études will use flog, but I think minitest will probably be pretty common.
In general, I think it'd be nice if a student could have automatic feedback, but I'm not stuck on the idea.
If you want to try the études, fork this repo and commit your changes to mark your progress. (But I won't accept pull requests that solve the études.)
If you want to contribute your own études, fork it and send a pull request. Thanks in advance!