19 January 2016

Interview Christian Haas

Christian_Haas commented one of my past posts, so it was natural to ask him for an interview as well. If you want to know more about Christian, read his blog or find him on Twitter.

Christian, you are a software developer?
I am a software developer "since always". I felt the call to create software already during my undergraduate years. Since a few years I understand what it means to be really professional. I was blind for a very long time. When I changed project and worked with another team, which applied more practises and patterns, I saw what is possible.

What do you consider your biggest success?
I founded the Coding Dojo Vienna. I started it because there was none and I wanted to have a Coding Dojo. In the beginning we just met in one of our meeting rooms after work. We practised a lot. Later a few people from other companies joined. And now it is self-sustained and will survive on its own. I am very proud of it.

STEM Photo CollectionYou commented one of my blog posts about diversity. Why does that matter to you?
My attention to diversity was started by Feminist Frequency. The podcasts showed me that there is so much more to feminism than I thought and that I had made mistakes. I was part of most men who do not want to do any harm but do not know better. I excluded or hurt people without knowing and did not want to do that. Like in the Coding Dojo I wanted to improve myself in this area of life as well.

Today feminism is very important to me. With knowing more about the topic I felt comfortable to discuss it with my friends. Now I want to inform others that are similar to me. In the beginning I tried to discuss with random people on the Internet - usually ending in flame wars - but it took too much time. I stopped because I am unable to change random people, nor do I want to do this. I focus on my direct surroundings and try to have impact there.

Diversity on itself is a huge area. I focus on feminism because I do not know much about other areas like racism (*ism) to engage actively. Still, I am happy about others pursuing social justice and - if there is a role model in my vicinity - I am willing to learn more.

What other topics are you concerned about?
There are many things worth complaining nowadays. I leave these fights to the people who know the details. I focus at the things I know enough about to engage actively myself. While I do not have the time and energy to engage actively all the things, I appreciate and support other people engaging these topics. Personal I care for saving the environment and recycling. Also I rather eat vegetables than meat without being a strict vegetarian.

I would like to see more impact on these important topics by my regular work. Do you think that is possible?
1. I see three options to have impact with your work. First you could work directly for a greater goal. For example when I create a web platform for feminism I surely have some impact by influencing society while not fighting at the fore-front.

2. The next, smaller option is more localised. While I do not believe I can make a change when working for a bank, I might make a difference when working on the public user interface of the banking application by making it #genderUX, e.g. by creating gender-inclusive forms. By influencing a single product I still can make people's live better.

3. Finally I can work in my team to raise awareness which might result for not hiring a man next time. This is not related to my job as developer and relies on social interaction. I can always try to influence the people around me.

LauraPlease tell a story of something you did because of your values and social responsibility. What was the problem? How did you react?
I have never been hesitant to speak up at my work places, and adding feminist views to my comments fits in naturally. My attitude was never a problem and I am confident that I would find another job if it would not work out. Whenever I see or hear something which I do not like, I speak up while I avoid becoming a hard-liner. My current project does not have any gender related impact so I am working according item three of my list above. As a team member I do have the power to affect hiring decisions.

How do you think about selecting industry, customer and project based on your values and social responsibility?
Even when given the opportunity, I do not want to work for dedicated feminist services, e.g. feminist online magazines, because they do not need my skill in raising internal awareness. Also I do not want to work for companies which are known to be anti-feminist. I do not want to be the leader of a movement, a figurehead. I feel comfortable influencing people around me. Otherwise I do not have any preferences on the selection.

Do you have problems with any industries?
I relate to the “hierarchy of needs”. When I have no other choice I would work for any company. But I am lucky that I consider myself at a higher level of the hierarchy. Given my current position, I would not work for stalking or porn or any project that conflicts my values. Other than that it is difficult for me to think about potential situations without concrete facts.

Did you ever reject a customer or project based on your values?
I never had such a situation where my work conflicted with my values.

On the other hand, what would be companies and projects that you would love to work on?
As I do not engage in feminism at the fore-front I do not look for industries or companies where I can amplify my impact.

Thank you Christian for sharing your views.

6 January 2016

IDE Shortcut Flashcards

From time to time I need to look up certain keyboard shortcuts in IntelliJ IDEA or PyCharm. (This would not be necessary would I use my proper keyboard always.) While there are official productivity guides, I usually just google the shortcut. There are plenty of pages listing the basic and more useful ones, nothing special indeed. But the one Google showed me the last time was special: 69 things you should know about IntelliJ IDEA by Krzysztof Grajek.

Remember theseThe list of IntelliJ IDEA commands was as expected, but at the end Krzysztof had put something new: flashcards. Flashcards are a great way to learn short facts. While I am aware of flashcards, I have not thought about nor used them since many years. I got curious and immediately downloaded them.

The package was an apkg, a file format used by Anki, a free flashcard application. According to Wikipedia Anki is most feature complete and available on many platforms, including smart phones. The apkg file is just a zip including a SQLite database, so it is pretty light-weight.

Unfortunately Krzysztof's original deck was created for the Mac version of IntelliJ, so I had to translate and verify it. Some shortcuts did not map to Windows keys (or were not available any more), so my IntelliJ IDEA shortcuts for Windows flashcards just contain 59 cards. There were several keys I did not know and a few I had never heard about. I recommend you instal the mobile version of Anki and start learning more shortcuts today!

There is also a community sharing Anki decks and I immediately looked for Eclipse shortcuts. I found a large deck of 91 cards for Eclipse, which - again - was created for the Mac version of Eclipse. I translated and verified them as well, which was much easier because I have been using Eclipse for more than ten years. Here are the Eclipse shortcuts for Windows flashcards.

Download 59 IntelliJ Shortcuts Win.apkg here. Download 91 Eclipse Shortcuts Win.apkg here.

28 December 2015

Testing Koans

Koans
Koans have been proposed as an effective way to learn a new programming language. But what exactly are Koans? According to Wikipedia a Koan (where the o has a macron, a straight bar placed above it - which my text editor refuses to produce) is a "case, story, dialogue, question or statement in the history and lore of Zen Buddhism". Huh? Reading the Wikipedia article did not help me at all. All I understand is that a Koan is something the Buddhist monks would work with, a mystical sentence or maybe a kind of poem, which does not make any sense, but somehow helps them on their way to enlightenment. It seems the metaphor has been transferred from Buddhism to software, e.g. Hacker Koans and Koans are related to the TAO of Programming. (Again no idea what TAO is supposed to mean here. This is like a recursive definition.)

Ruby Koans
As far as I know, the first Programming Koans were available in Ruby, created by the late Jim Weirich, a popular Ruby hacker. Ruby Koans consists of several little exercises, starting with basic things and building on each other to move to more advanced topics in the end. The goal is to learn Ruby, to walk the "path to enlightenment" as Jim put it. He also wanted to teach the Ruby culture. The Ruby community has a strong focus on testing, which is considered essential to "do great things in the language". In fact the exercises are a list of failing test cases, where tiny pieces of code have to be filled in to make them pass. For example, here is the exercise to learn accessing array elements,
def test_accessing_array_elements
  array = [:peanut, :butter, :and, :jelly]

  assert_equal __(:peanut), array[0]
  assert_equal __(:peanut), array.first
  assert_equal __(:jelly), array[3]
  assert_equal __(:jelly), array.last
  assert_equal __(:jelly), array[-1]
  assert_equal __(:butter), array[-3]
end
Doyle Spiral + InversionThe double underscore marks the place where the code has to be changed to make it work and pass the test. These tests are very simple and there is not much explanation. Maybe this is the connection to the Zen Koans: The Language Koans are a list of exercises to work through, to master the language (i.e. reach enlightenment). Each one is very small (i.e. a sentence) but does not make much sense on its own. The exercises are sorted by increasing difficulty (i.e. the path to walk). Following Jim's example, Koans are usually based on unit tests which you make succeed. Language Koans are available for many programming languages, see a list of Koans by Laura Diane Hamilton.

Testing Koans
I took the idea for Testing Koans from Carlos Blé's training JavaScript for Testers. He created some Koans for JavaScript with inverted work-flow. The code was already in place, but the assertions were missing. That was reasonable as the training was created for tester.

xUnit Koans
Earlier this year I ran an introductory unit testing workshop for the local PHP community. I expected a junior audience and aimed for the most basic exercise for xUnit assertions and life cycle methods. I wanted the participants to focus on PHPUnit alone. I created some sample code, together with unit tests, and then deleted the assertion statements. The first test looked similar to the following Java code:
import org.junit.Test;

public class Session1_GreeterTest {

  @Test
  public void shouldReturnHelloName() {
    Greeter greeter = new Greeter();
    // TODO check that "Hello Peter" is greeter.greet("Peter")
  }

  @Test
  public void shouldReturnHelloForNull() {
    Greeter greeter = new Greeter();
    // TODO check that "Hello" is greeter.greet(null)
  }

  // more tests skipped...

}
The participants went through the tests one by one, adding assertions or fixing incomplete statements, making the tests pass. While this looked like a very basic and short exercise, developers unfamiliar to PHPUnit (and xUnit in general) needed several hours to complete all my PHPUnit Testing Koans.

Due to the uniform nature of all xUnit ports, the style and structure of the exercise can be used for other programming languages. I ported the exercise to Java using JUnit, creating Java/JUnit Koans. Both Koans cover the basic functionality of PHPUnit and JUnit, e.g. assertions, testing for exceptions and before- and after-methods. More advanced features could be added. I will port the Koans to C#/NUnit and Ruby/minitest as soon as I will need them.

Conclusion
Koans are a great way to partition the process of knowledge acquisition into a series of little exercises. They verify themselves, giving you fast feedback but you can still learn at your own pace. Language Koans are established and available for many languages. These can be extended to any library or public API you want to master. Testing Koans work similar, just inverted. They are available for PHPUnit and JUnit for now. I would love to see more ports and also Koans for different testing styles, e.g. RSpec or Jasmine Testing Koans.