I’m a Ruby programmer. I enjoy the language, and I credit it for revitalizing my curiosity and interest in writing software for a living. I’m constantly learning more about Ruby and Rails every day, but I have a solid grasp of the language and platform.
I’ve recently started to learn Haskell because I’d like to contribute to thoughtbot’s Haskell projects and expand my mind.
Haskell is fundamentally different than Ruby. It’s purely functional and has strong static typing, while Ruby has dynamic typing and is more object-oriented than functional. My functional programming skills are very limited, so many of the functional concepts are as new to me as the Haskell language itself.
Right now the Haskell universe feels mysterious and vast, which is exciting and motivating for someone who loves to learn.
Endless possibilities
In the beginner’s mind there are many possibilities, but in the expert’s there are few.
Shunryu Suzuki, Zen Mind, Beginner’s Mind
Suzuki’s quote warns against becoming close-minded as more of your topic of study becomes revealed to you. As I expand my toolkit for solving problems in Ruby, I have to be careful not to become complacent with my choice of techniques. I should always be looking for a better way, which requires believing that there might a better way.
Paradox of human expertise
Paradoxically, the very underpinning of expertise can entail degradation in performance as well, such as tunnel vision and biases.
Itiel E. Dror, The paradox of human expertise: Why experts get it wrong
With increased knowledge come more assumptions about how things work. These biases can be useful, as they enable experts to efficiently process information and solve problems. However, “default” solutions can prevent the expert from considering a more appropriate solution to a given problem. The expert’s brain specializes in its field, which is to say that the mind becomes more narrow and rigid.
The value of mental agility
The measure of intelligence is the ability to change.
Albert Einstein
I’m reminded of thoughtbot’s Research Trello board. We use this as a place to experiment with changes to our processes and technology stacks. We’re opinionated about which tools we use and how we use them, but we’re also willing to change them when something better comes along. Constantly challenging our assumptions using the scientific method ensures that we use the best tools and techniques to solve problems, both today and into the future. In technology fields where change is inevitable, this mental agility is a very valuable asset.
Adding to your bag of tricks
…in some cases, by applying the power of monads wisely, we can untangle nested callbacks, make parts of our code more reusable, and generally make our programs better.
Tom Stuart, Refactoring Ruby with Monads
A monad is a functional programming abstraction essential in Haskell. Tom’s talk explores 3 practical examples that use monads to turn awkward Ruby snippets into elegant solutions. It’s clear that Tom’s code benefits from his experience with functional programming. He shows that it’s possible to borrow foreign concepts to solve everyday problems, while keeping an idiomatic Ruby style.
Will I ever be a Haskell expert? Will I work full-time on a Haskell project? Maybe, but if not, I won’t consider it a wasted exercise to learn Haskell. I am adding to my bag of tricks, so I can attack problems from different angles. When I implement a feature in a Rails app, I will think about whether a functional approach would be more appropriate than my usual OO-leaning code.
Striving to be an expert is a worthwhile cause. The trick is to bring in more knowledge and experience, while continuing to search for alternate approaches that are better in some way or for some specific case.