least surprise is not for you only. The principle of least surprise means principle of least my surprise. And it means the principle of least surprise after you learn Ruby very well. -Matz in "The Philosophy of Ruby” by Venners (2015)
a.k.a. CRuby alternatives • complete list https://github.com/cogitator/ruby- implementations/wiki/List-of-Ruby-implementations • most notable list https://www.ruby-lang.org/en/about/ in “Other Implementations of Ruby” • JRuby on top of JVM • Rubinius - Ruby in Ruby • mruby - embedded, led by Matz
for symbols, methods, variables • CamelCase for classes and modules (keep acronyms) • snake_case for file and directory names • Name of the file = name of the class -> One class, one file • SCREAMING_SNAKE_CASE for constants • Predicate methods end with a question mark, no prefix (ex. user.coach_subscription?) • Potentially dangerous methods end with an exclamation mark (a bang) • # comment • https://github.com/bbatsov/ruby-style-guide
Germany, she prefers cats, earns 40k per year, she studied Economics • Mike is 27, he is from China, he prefers dogs, earns 40k per year, he studied Medicine • Svetla is 35, she is from Bulgaria, she prefers cats, earns 80k per year, she studied Electrical Engineering • Theo is 60, he is from Germany, he doesn’t like pets, earns 50k per year, he studied Law 1. Create appropriate data structures 2. Find all people who are from Europe 3. Find all people who earn between 45k and 70k per year 4. Find all people who don’t like pets
the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. I don't own the right to the images unless otherwise stated. If you feel you rights have been violated, please contact me at [email protected] To view a copy of this license visit http://creativecommons.org/licenses/by-nc-sa/4.0/ You can find the slides on speakerdeck.com/nirnaeth