6 Ruby questions to Piotr Szotkowski

RubyC-2017 (rubyc.eu) continues to interview 2017 speakers!
This time we annoyed Piotr Szotkowski (aka @chastell ), a brilliant Polish hacker scientist: Cheap Science Officer at Rebased, an assistant professor at Warsaw University of Technology and co-maintainer of Bogus and Reek. Piotr is also a coacher in Rails Girls Warsaw and Rails Girls Summer of Code and organizes Warsaw Ruby Users Group. On RubyC-2017 Piotr present topic “Ruby Smells” devoted to writing good object-oriented code. Lear more rubyc.eu/#speakers

1. Tell us about your recent work, what have you learned/found out/achieved.
My recent programming-related work was quite interesting; at Rebased I’m working with a solar energy company, writing software for monitoring and administration of their solar panel farms, and at my university I’m researching reversible computing, while dabbling a bit in Crystal.

2. Your Topic “Ruby Smells” is devoted to RuboCop and Reek. Why have you decided to talk about them? What projects or problems motivated you?
RuboCop becomes more and more a widely-recognised set of standards for writing Ruby syntax, and while I wholeheartedly disagree with some of its rules and can fully understand the frustration it causes in some developers I still think it’s in general a welcome tool in our everyday life.

Reek, while seemingly similar, is totally different: rather than concentrating on the syntax it tries to point out potential architectural problems in a codebase on an OOP level. Reek’s results are much less rules and much more suggestions where to look for potential issues, and can’t really be auto-corrected (but rather require — often quite extensive — refactoring).

I talk about Reek because it taught me *a lot* about OOP, structuring my programs and, in general, moving code closer to where it belongs, even if it’s non-trivial. I got fascinated by the amount of OOP code smells that can be automatically recognized (and, as a result, became one of Reek’s maintainers).

3. Sometimes recommendations from RuboCop and Reek are different. How to bring them into line?
There are relatively few areas covered by both RuboCop and Reek; RuboCop is more of a syntax style enforcer, while Reek is an architectural tool. There are some common areas of interest —e.g., RuboCop tries to eradicate long methods because they’re a readability issue, while Reek points them out as potential code smells that mix the level of abstraction — but in general the best approach is to figure out what are acceptable thresholds for a given project (e.g., maximum number of lines in a method or maximum number of instance variables) and adjust them as necessary.

In general, RuboCop is much more opinionated because it usually deals with much cleaner choices — ‘this kind of syntax should be indented this many spaces’ or ‘single quotes where possible vs double quotes everywhere’ are relatively easily made choices that should indeed be uniformly enforced across the whole codebase if possible. Reek seldom deals in absolutes; there are often cases where a given piece of logic *technically* should live closer to class A, but *in practice* is much more useful when put in class B.

My general rule of thumb for RuboCop is ‘try to please it as much as possible and only reconfigure it on the most blatant disagreements’, while my rule of thumb for Reek is ‘this are fascinating suggestions, let me look at the smells one-at-a-time and I’ll probably whitelist quite a few of them — and that’s perfectly OK’.

4. We know that you often present at conferences around the world, can you share latest rumors?
😇 It’s surprisingly hard to share technical rumors without heavily coating them with your own superstitions (or hopes), but it’s really interesting what the Ruby world learns and picks up from functional languages like Elixir and Clojure. Also, the dry-rb family of libraries might be worth a closer look. ;) Also, TruffleRuby seems like a super interesting project...

5. What do you expect from 2017 for Ruby?
More advances in stability and performance, with wonderful results delivered by TruffleRuby and sustained progress of incremental improvements from the relentless JRuby team. Probably a few new libraries that will show how to do implement Ruby some interesting features of other languages.

6. What are you interested in above coding?
I really enjoy photography — nothing fancy, but some of my street shots can be found at chastell.net/1/125
I also like casual city cycling, sadly I have time mostly on my daily 2×10 km commute. 🚲

До обраногоВ обраному0
Дозволені теги: blockquote, a, pre, code, ul, ol, li, b, i, del.
Ctrl + Enter
Дозволені теги: blockquote, a, pre, code, ul, ol, li, b, i, del.
Ctrl + Enter

Підписатись на коментарі