4 ms·
Yukihiro Matsumoto, creator of Ruby: > Everyone has an individual background. Someone may come from Python, someone else may come from Perl, and they may be su
by threatofrain 7y ago
Yukihiro Matsumoto, creator of Ruby:
> Everyone has an individual background. Someone may come from Python, someone else may come from Perl, and they may be surprised by different aspects of the language. Then they come up to me and say, 'I was surprised by this feature of the language, so Ruby violates the principle of least surprise.'
> Wait. Wait. The principle of 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. For example, I was a C++ programmer before I started designing Ruby. I programmed in C++ exclusively for two or three years. And after two years of C++ programming, it still surprises me.
- edbrown23 7y agoFor what it's worth, I don't think ruby achieves this goal either. I've been programming full time in Ruby for nearly three years and things like this [1] still surprise me. Ruby feels less surprising than C++, sure, but that's a pretty low bar to clear. [1] https://makandracards.com/makandra/46939-ruby-a-small-summary-of-what-return-break-and-next-means-for-blocks https://makandracards.com/makandra/46939-ruby-a-small-summar...
- loopz 7y agoPrinciples of least surprise (or astonishment), is one of cornerstones of Ruby. However, the language itself is dynamic, so take the end result with a pinch of salt: The language's OO syntax is beautifully simple, incredibly easy to structure into classes/mixins and have tons of useful libraries, to write code with. Not always so much for reading code, refactoring or discerning what REALLY goes on in a Rails application..
- gregkerzhner 7y agoI think there is a great middle line for a language that is easy to work with, and provides enough safety to be maintainable for a long time. Environments like C++ and enterprise Java miss this middle line by being too cumbersome. However, Ruby equally misses this middle line, just in the other direction - it's too simple and dynamic leading to lack of maintainability in the long run. The best solution will be somewhere in between.
- skrebbel 7y agoIn my opinion, Kotlin, C#, and TypeScript all come pretty close.
- jolmg 7y agoMy pet-peeve in ruby: '//'.split('/') # => [] instead of ['', '', ''] '/'.split('/') # => [] instead of ['', ''] ''.split('/') # => [] instead of [''] '//'.split('/', -1) # => ['', '', ''] '/'.split('/', -1) # => ['', ''] ''.split('/', -1) # => [] instead of [''] In comparison: "".split("/") # => [""] in javascript "".split("/") # => [""] in python
- simplify 7y agoTo be fair, blocks, procs, and methods are fairly fundamental to Ruby. After a bit of study, they stop being surprising. I'm sure there are other examples, though.