Idiomatic Code

Whether you find code readable or not can to a large extent depend on whether it uses an idiomatic style that you are used to. Different language communities have different idiom. In this session we look at how to convert non-idiomatic code into something recognizable for that language.

Learning goals

Session Outline

Connect

Show them some very non-idiomatic code in their language and ask them what’s wrong with it.

Concept

Describe some idioms for the programming language you will be using in the session.

For example

Bring up the code you’ll be using in the exercise, and talk about where it is not idiomatic for the language.

Concrete

Work on a refactoring kata with the explicit aim of making the code readable and idiomatic. Keep a list of names of any refactoring you use. For example work on Theatrical-Players-Refactoring-Kata

Conclusions

Does the code look idiomatic for the language now? Compare your code with that from the other pairs. How is the readability?