Last night at Ruby Hack Night, the crowd called out for more: We postponed the Mocks and Stubs workshop in favour of a second kick at the String Calculator kata (which many in the room had not completed). It was a good opportunity to revisit the kata and reinforce some important ideas (more about this below).
I was quite happy to see so many faces in the workshop – many new devs (many of you straight from the bootcamps) – and some senior devs to provide experienced insights and colourful background to our activities (you know who you are). Thanks to you all for your participation.
We’re now in a very good position to take on Mocks and Stubs in the coming months. As of now more than 80 of us have done the String Calculator kata at Ruby Hack Night – impressive!
Some take-aways from last night:
- (from Dan’s talk) Introspection is a very powerful benefit to the Ruby environment, especially during development. Further, there are a number of facilities allowing access to all kinds of documentation and metadata dealing with Ruby classes. Dan provided some good examples of using ri, irb/pry/rdebug, git, rdoc to look at classes, expressions, and relationships.
- Practice the TDD workflow on simple examples so that it becomes habitual. It will allow you to focus on the testing code and functional changes and avoid disaster. See http://www.ryatta.com/refactoring-in-context/ for the TDD workflow and some commentary.
- Sticking to the “simplest code that will work” is difficult. Senior developers gravitate toward fully generalized solutions, which can be considered over-engineering in some circumstances (and may be warranted in others). Last night we saw some examples of this. We don’t all agree on what the simplest code is, and this is ok. But it is worthwhile to have the discussion.
- One of the most important steps in the TDD workflow is the refactoring step. The Bowling Kata (available here: https://github.com/k00ka/bowling-game-kata) is an excellent exercise in this regard. If you haven’t attempted it, please do!
- Ruby idioms are the tools you should be loading into your programming toolbox for the job. We all need to learn/revisit and hone our abilities with them. Idioms are powerful: taking advantage of both the expressiveness of the language and the underlying implementation, and delivering code which is easy (if not trivial) for other developers to understand and maintain. Last night we found out that this would be a great workshop topic. I’ll make it one for August/September!
Enjoy the summer and we’ll reconvene at the end of July. – David