I decided to learn a new language, which is different than Java and thought that Ruby would be a good candidate.
After searching the web for good tutorials and not just basic ‘Hello World’ I found this one:
I liked the idea that the learning is step by step and it feels that there’s lot of thinking behind it.
What I mostly liked was the TDD approach in the learning method.
At the beginning the tests are simple and teach the basic syntax and semantics.
Gradually the tests become more interesting and complex.
Each test file starts with ‘about_’.
The first interesting and more challenging test was the triangle. Not due to the “algorithm”, but the usage of another file. I tried to have separate class for validation. Just to make a habit.
Then came the ‘calculate score’. The basic solution was simple, but it took me several iterations to make the code cleaner and get familiar with Ruby Hash usage.
I wonder whether I did make it better and cleaner.
Inheritance exercise was simple although I needed to grasp the meaning of: “inheritance and cross-methods”
Modules: I didn’t really understand the modules usage in a class. What is it good for?
So “about scope” helped me understand it.
I really like the idea that the tests are built one on top of the other.
‘About Proxy’ is really interesting! It took me the longest time to solve.
It is based on many previous assignments and was a real challenge. I had to recheck classes, symbols, arrays and many other tests.
There’s an extra credit assignment, which I’ll do next.
In the meantime, here’s the code in GitHub: