22 November 2016

Followup Global Day of Coderetreat 2016

This is an email I sent to all the participants of the recent Global Day of Coderetreat, Vienna. Because it applies to all participants worldwide, I repost it here.

Looking back at the Global Day of Coderetreat 2016
It is a month since you participated in the Global Day of Coderetreat. Let us look back for a moment. At the end of the day, during the final retrospective, you answered the questions
  • What you learned at that day?
  • What surprised you during that day?
  • What you planned to do differently?
Final RetrospectiveSome of you learned "new programming concepts" and that "it can be done in a simpler way". (These quotes were things you wrote on the Post-its on the picture on the right.) Others found new ways "how to split the problem". Several people discovered that pair programming was productive. You were surprised that there were so "many different ways to do the same functionality". But most important you decided to do things differently in the future. Here are some things that you wanted to do:
  • "Try TDD at work!"
  • "Learn more shortcuts!"
  • "Aim for simpler code!"
  • "Code more!"
These were just a few examples for the 21 things you wanted to do differently. Try to remember your personal plan. What did you write on your Post-it? In the last month, did you apply the things you learned? Did you do the thing you wanted to do differently? Did it work for you? We fall back into old patterns easily - changing habits is hard. If your first attempt failed, I encourage you to try again. Do not give up!

A box of things to take from the Coderetreat
At the end of the Coderetreat the facilitators, Houssam and I, talked about things you might want to try after the event. Houssam called it the "Box of things to take home".
  • Code Katas. Code Katas are exercises like the Game of Life. You can find many suitable exercises at codingdojo.org or codekata.com. If you like to crack some math problems I recommend Project Euler. It is a lot of fun!
  • Coding Dojo. A Coding Dojo is an event like a Coderetreat, just shorter. In Vienna there is the Coding Dojo Vienna. If you need for more practise this is the place to go. The dojo happens once a month. To get notified about upcoming events register at Softwerkskammer Gruppe Wien or follow #CodingDojoVie on Twitter. More information about Coding Dojo can be found in Emily Bache's excellent book.
  • Pair Programming. You can run your own practise session in a coffee shop or McDonalds. Talk to people in your company or at local meetups and find some like minded individuals.
  • Screencasts. Recordings of Code Katas, sometimes called Katacasts, are a great source for learning. This way you can (kind of) pair program with famous people like Robert C. Martin, J.B. Rainsberger, Sandro Mancuso and others.
  • For more details on how to improve your skills further, I recommend Houssam's (and Boris Gonnot's) article How to Boost Your Skills to Become a Better Developer.
Craftsmanship Community
Finally I want to point you to the Software Craftsmanship community in general. In Germany, Austria and Switzerland the local Craftsmanship communities are hosted by the Softwerkskammer. There is a group for Vienna and Linz. These communities run yearly conferences, the SoCraTes (Software Craftsmanship and Testing) unconferences. Currently we have SoCraTes conferences in many countries. In Austria the next SoCraTes will be autumn 2017 in Linz.

I wish you all the best for your future. You can do it!

9 September 2016

Mechanical Keyboards

Over the years I developed a love for keyboards. It is not surprising as I used keyboards since 1995 to do my work. I spent countless hours typing and writing. I am not a collector, I own some cheap and a few mechanical keyboards. Each of them has its use. Recently I did some research about them. Here is what I found:

Cherry G81-3000 KeyboardCherry - G81-3000 (DE)
The Cherry G81 does not look special. I did not select it, I just bought it together with one of my early computers. It is a regular 105-key PC German QWERTZ keyboard as used in Austria and Germany. (The 104/105-key layout is like the 101-key keyboard including some special keys to activate common Windows functions.) I bought it in 2000 and it worked well. Two years later - when I killed it by pouring a glass of water into it - I bought another one. It is connected via PS2 plug, which gets rare these days.

Switches: It was cheap and I always believed it to contain rubber domes. But even after buying my first mechanical keyboard I went back to using it. I was used to it and liked the typing experience. Recently I found out why. During cleaning I recognised the typical Cherry MX mounts - could my old Cherry keyboard be a mechanical one after all? The Cherry G81 contains the Cherry MY switch, a semi-mechanical keyboard switch, with a spring in each switch. It is considered something between rubber dome and MX with a life expectancy of 50 million presses, which is the same as of modern MX.

Typing: The Cherry MY have no tactile feedback and actuation happens two third on the way down. The counter force of the spring increases linearly while pressing it, with a peak force of 120 cN. In a way they feel like linear MX switches. (Some people say MY feels like MX-Black but harder. I do not own any MX-Black, but the keys are definitely harder to press than any MX I know, even MX-Clear. The comparison of MX switches states that MX-Black has an actuation of 60 cN, much less than the MY.) There is no click sound, only some slight noise from the key caps. This is the most muted keyboard I know. When I press slowly then there is absolutely no sound at all. None of my other keyboards are that quiet.

The Cherry G81 is heavy because it has a steel plate, like high quality keyboards nowadays. This might explain why I stayed with it for such a long time without looking somewhere else. For the small price of 29 Euro (price in 2002), it is definitely the best keyboard I own.

DasKeyboard Model S Ultimate KeyboardDas Keyboard - Model S Ultimate (III) (DE)
Das Keyboard Model S is a "high-quality mechanical keyboard." I was new to mechanical keyboards - thanks to peer-geek Michael Clay for telling me about them - and had no idea about switches. The Model S was the first high quality mechanical keyboard that I liked which I found on the German market. It was supposed to be cool so I bought it. I even went for the ultimate version with blank key caps, because I wanted to master touch typing.

Switches and typing: The Model S contains gold-plated, mechanical, Cherry MX-Blue switches. They offer the classic mechanical typing experience: There is a tactile feedback halfway down as the key actuates. The noticeable bump lets you know that your key press has been registered. And it is noisy. Really, the MX-Blue clicks noticeably, and can be disruptive in close working conditions. It makes so much noise that it breaks my own thoughts when I type fast, especially as I am used to the super quiet Cherry G81. Due to this noise I am not using it on a daily basis. Maybe I should by it again with other switches.

The Model S comes with an USB hub included, which is very handy to connect a mouse or other devices, especially when working with a different computer almost every day. I love the look of its blank surface. The packaging includes a tiny cloth to wipe it and keep it shiny black. Its blankness makes it perfect to show off your mastery of the keyboard to your peers. Most colleagues are confused (and unable to use it) or amazed. It is definitely useful to improve typing accuracy, and it has improved mine.

TKL Keyboard Bag, courtesy of Michael ClayTKL (Tenkeyless)
Since my Pair Programming Tour and working as freelance Code Cop, I am almost exclusively programming in a pair. When I visit someone to pair with, I bring my own keyboard. I have to carry it, which makes me wish for a small one. I do not like compact or laptop keyboards, because I am really used to regular QWERTZ layout. The answer is TKL - "Tenkeyless". As the name suggests, tenkeyless keyboards are standard full-sized keyboards without a tenkey / number pad on the right side. The number pad contains not ten but 17 keys, making the TKL an 88-key PC German QWERTZ keyboard (if such a thing exists). As the TKL is a standard keyboard I am able to type as usual. The only slight problem is that I am unable to press Ctrl Numpad / which toggles line comments in IntelliJ IDEA. I own a bag for the TKL, courtesy of Michael Clay. When he heard about my planned Code Cop Tour he showed up with four different TKL keyboards so I could chose one. I bow to the master of keyboards.

Diatec Corp Filco Majestouch-2 TKL KeyboardDiatec Corp - Filco Majestouch-2 TKL (DE)
I needed a TKL to put into my backpack. While I could have created one by myself, I bought a Filco Majestouch-2.

Switches and typing: This time I avoided Blue switches and bought the Majestouch with Cherry MX-Brown ones. The Brown switches are one of the most widespread switches today. They are tactile, non-clicky and relatively soft with an actuation force of 45 cN. They are supposed to be silent, still there is some sound from the key caps themselves. When I type fast the plastic key caps make a high pitch noise. Of course the sound is not as nasty as from the Model S, but it is quite noisy for my liking. Fortunately its noise is not a problem during pair programming because there are no extended periods of silent, fast paced typing.

The Filco Majestouch-2 is a basic keyboard, exactly what I need. Maybe it is a bit of an understatement because it looks so very basic. The TKL version is ideal for travelling. I always carry it with me when I am going to pair with an Austrian or German developer during work or Coding Dojo. With the Majestouch I mistype more often. I guess this is because the mechanical switches actuate half way down, while the MY switches register the key around two third of the way. I am just too used to my old Cherry G81.

Cooler Master NovaTouch TKL KeyboardCooler Master - NovaTouch TKL (US)
During my pair programming activities I often work under UK or US layout. I am able to operate the English layout sufficiently well if I see the right labels on the keys. So one TKL is not enough. I took the NovaTouch with (87-key PC) US English QWERTY keyboard layout. It is "exceptionally quiet and suitable for heavy-duty typing or gaming."

Switches: The NovaTouch contains Topre switches with MX compatible key caps which is great if you love custom keys. The Topre switches are semi-mechanical, hybrid capacitive switches "that combine the benefits of a mechanical spring-based switch and an electrostatic capacitive sensor to provide excellent tactility, comfort, and durability. The unique design of these Hybrid Capacitive switches require no physical mechanical coupling, therefore eliminating key switch bounce and chatter for a frictionless experience."

Typing: The Topre switch is similar to the Cherry MX-Brown, a tactile, non-clicky switch. There is the bump halfway down. Compared to the Majestouch-2 the force needed to press the key is slightly higher and the bump seems "bigger" and more articulated. (Actuation is at least as strong as for MX-Clear as used in the CODE keyboard described below.) While the marketing description above describes the keyboard as exceptionally quiet, unfortunately it is not. Like the Majestouch-2, its plastic key caps create some noise when pressed. The NovaTouch ships with a set of o-rings which made it more quiet, but some sound remains, especially when typing fast. At least the noise of the key caps is more low pitched than of the Majestouch-2.

The NovaTouch is a bit bloated because it has some audio and repeat rate adjustment function keys, which I never use. Even worse, the function (Fn) key replaces the menu/right click key. I do use the menu key because I love keyboard navigation and I rely on it to activate functions from context menus that do not have their own keyboard shortcut.

The NovaTouch is despite the missing menu key a very nice keyboard. Its cable is braided and can be removed from the keyboard. It comes with o-rings and and a wire key cap puller to remove the key caps. But the best thing is its box. While all other keyboards ship in a simple cardboard box, the NovaTouch lies in a large, shiny black box, softly bedded on rubber foam. It looks like decoration inside its jewel case. It is marvellous.

I use the NovaTouch when I pair program with someone who uses UK or US layout. I bring it to international Coding Dojos or workshops. It is small enough to fit into my hand luggage when flying. During my Pair Programming Tour I even carried both, the DE and US layout because I never knew which layout my next pairing partner would use.

WASD Keyboards CODE V2B KeyboardWASD Keyboards - CODE V2B (DE)
Despite all these keyboards I was still looking for a keyboard to use every day - as a replacement of my trustworthy Cherry. I did not really need it, but somehow wanted it - the perfect opportunity for a present. For Xmas I ordered a WASD CODE V2B, with 105-key PC German QWERTZ layout. It is a "simple, clean and beautiful mechanical keyboard, a collaboration between WASD Keyboards and Jeff 'Coding Horror' Atwood."

Switches and typing: I selected the CODE because of its switches. The MX-Clear are stiffer than the Brown ones, with a tactile bump and weighting of 65 cN. The harder actuation force is good for me, being used to the Cherry-MY keys, which are still harder to press. The tactile bump feels right. Again the plastic key caps make some noise and the keyboard is louder than the NovaTouch.

Like the Majestouch-2 the CODE is a very basic keyboard, without any label, its black matte surface looks sharp. Like the NovaTouch its cable can be removed and a key cap puller is included. Most important has a series of dip switches which enable the function key, caps lock and different layouts. This is most useful, because I can have my menu key instead of the function key. It also has LED back lighting, which probably is the reason for it to be more expensive than my other keyboards. (The CODE is around 200 Euro where my other keyboards are between 100 and 160 Euro.) There is a slight glitch: when my computer wakes up from power-saving/standby mode, sometimes the keyboard is not activated and I need to disconnect and reconnect the USB cable to activate it, which is annoying. After a few months I got used to the CODE and despite the glitch it is my favourite German keyboard. I enabled LED back lighting and found it quite comfortable because I am working a lot in the evenings.

Future
It is difficult to predict the future. At the moment I like my CODE and it looks like I finally found a keyboard to keep. On the other hand I have not tried all Cherry switches, e.g. MX-Black. Maybe I should get a Cherry MX Switch Pro Sampler to compare them. The sampler looks like a great desk toy to impress and confuse colleagues. At the moment MX-Clear is the stiffest switch available from Cherry, so I might need to look for alternatives. I am curious about the Buckling Spring as used in the original IBM's Model M. People say that this is the best keyboard ever made. I will have to try it one day.

16 August 2016

Absolute Priority Premise, an Example

Optimus Prime, Transformers ToysTransformation Priority Premise
I would like to start this article with Uncle Bob Martin's Transformation Priority Premise - TPP for short - which he defined in 2011. With the premise Uncle Bob gave an algorithm how to find the next test when doing Test Driven Development. During (classic) TDD we use transformations to change the code to get from red to green. For example when starting with a new method the very first test is usually red because the empty or generated method returns null. We fake the first test by changing that null to return a constant value, e.g. return 5. This transformation is called nil->constant and has a high priority. A later test might force us to add a conditional to enable another fake. This transformation is called unconditional->if and has a medium priority. Replacing the value of a variable, i.e. variable->assignment has a low priority.

According to Uncle Bob, these transformations have a preferred ordering. We should prefer higher priority transformations to pass tests and chose tests in a way that they can be passed with higher priority transformations. When an implementation seems to require a low priority transformation, we could backtrack to see if there is another test to pass first which does not need that transformation. The theme behind the TPP is that as the tests get more specific, the code gets more generic. If you want to know more about TPP, see Uncle Bob's cartoon follow-up on the TPP and Sorting and his talk on the Transformation Priority Premise.

Absolute Priority Premise
In 2012 Micah Martin set out to define some heuristics to compare code objectively and proof that some code is better than some other code. Building on the TPP's priorities he defined the Absolute Priority Premise - APP for short. The APP knows six components, i.e. basic building blocks of code, and assigns them a mass. The building blocks and their weights were
  • constant, a value in code has mass of 1.
  • binding, a name or variable has a mass of 1, too.
  • invocation, calling a method or function - mass 2.
  • conditional, any form of if, switch or case - mass 4.
  • loop, for or while loops - mass 5.
  • assignment, replacing the value of a variable - mass 6.
More complex building blocks have a higher mass. The total mass of a piece of code is the sum of the mass of its respective components. A lower value is better. The best set of specific values of mass are unknown and I will use Micah's weights. If you chose to count different, please let us discuss!

A detailed explanation of the Absolute Priority Premise is given in the two presentations of 8th Light University (8LU) - Part One and Part Two. See also Micah's Coin Changer Kata as a complete example of applying the premise.

Measuring the Mass of Code
I like Micah's idea to measure the mass of code. It might not be a direct indication of readability but simpler code is always better. I wrote six different versions of the Word Wrap kata and was wondering which one would be considered the "best". I should have calculated the mass of these algorithms manually, but I followed Terence Parr's advice, to avoid working by hand five days what I can spend five years of my life automating. I had to create a tool to calculate the mass of Java code - which of course took me much longer, especially as I verified the mass of each algorithm manually to make sure my code worked as expected.

Absolute Priority Counter
I created abpricou, the ABsolute PRIority COUnter. It parses Java source and collects its mass as defined by the Absolute Priority Premise. It is written in Python, because it was Python month when I started working on it. It uses the Python Java Parser plyj. plyj offers a Visitor API for parser events,
class CountingVisitor(m.Visitor):
    def __init__(self):
        super(CountingVisitor, self).__init__()
        ...
Constants and bindings are staight forward, e.g.
    def visit_Literal(self, literal):
        return self._a_constant_value()

    def visit_FormalParameter(self, parameter):
        return self._a_name()
Literals in the code are counted as constants and parameters are only names for values, thus bindings. A method or function counts as a constant for the code it represents and a binding for its name.
    def visit_MethodDeclaration(self, declaration):
        self._a_name()
        return self._code_is_a_constant()
Invocations, conditionals and loops are the same. For example
    def visit_MethodInvocation(self, invocation):
        return self._an_invocation()

    def visit_IfThenElse(self, conditional):
        return self._a_conditional()

    def visit_While(self, loop):
        return self._a_loop()
The only interesting case is the assignment. Not every assignment in Java is counted as an assignment, only re-assignments which modify values are counted. final fields or local variables are just names for expressions similar to parameters.
    def visit_Assignment(self, assignment):
        if ... :
            # code to ignore
            # final field is assigned in constructor
            # final local is assigned in block
        else:
            return self._an_assignment()
Get the tarball and installable egg of the Absolute Priority Counter.

Let's see some code: Word Wrap Kata
As I said before, I developed the counter to calculate the mass of my different implementations of Word Wrap. I was interested in the mass of the algorithm and skipped constructs like class definitions. (I suppose a class definition is a constant for the code and a binding for the name.) I also ignored Annotations, Enumerations and Generics. The first algorithm uses recursion to loop over the blanks to find the end of each line. Its code is
   final char BLANK = ' ';
   final char NEWLINE = '\n';

   String wrapRecursive(String line, int maxLineLen) {
      if (line.length() <= maxLineLen) {
         return line;
      }

      int indexOfBlank = line.lastIndexOf(BLANK, maxLineLen);
      int split;
      int offset;
      if (indexOfBlank > -1) {
         split = indexOfBlank;
         offset = 1;
      } else {
         split = maxLineLen;
         offset = 0;
      }
      return line.substring(0, split) + NEWLINE
           + wrap(line.substring(split + offset), maxLineLen);
  }
including the components
| Component   | Mass  | Count |
| constant    |   1   |   7   |
| binding     |   1   |   8   |
| invocation  |   3   |  10   |
| conditional |   4   |   2   |
| loop        |   5   |   0   |
| assignment  |   6   |   0   |
resulting in a total mass of 53. Further implementations have the following masses:Scales
  • The tail recursive solution has neither loops nor assignments similar to the recursive one and has a total mass of 71. (The source of this and all further variants is given in Word Wrap Kata Variants.)
  • The looping variant contains a loop and an assignment resulting in a mass of 68.
  • The optimised loop which avoids temporary String objects, contains a loop and an assignment and some more invocations. Its mass is 80.
  • The loop using a buffer saves even more heap allocations and needs more invocations summing up to 105.
  • The solution using Regular Expressions as shown in the original article has a mass of 55. Merging the parts of the expression into a single expression would save five invocations, but makes the expression less readable. I argue that the Regular Expression itself has some weight, as it contains one conditional ("|" in line 3) and two loops ("(.{1," + maxLineLen + "})" in lines 1 and 4). So a fair weight is 69.
  • The functional version using flatMap and reduce is quite verbose due the lack of inferred pair types in Java. As plyj does not support Java 8 I was unable to measure its mass.
First Conclusion on Algorithms
The most basic, recursive version of Word Wrap has the least weight. What does it mean? Is it the best version? It is the most compact version without playing Code golf, at least in Java. It does not mutate any variables but it puts the highest load on the Garbage Collector. All the discussed algorithms have different memory and run time performance characteristics. I had hoped for a clear answer what the best version would be and I am not seeing that. I challenge you to leave a comment with a version of Word Wrap with a smaller weight. Would it be considered better code?

The mass of the basic loop version seems too much compared to the recursive version. The current weights favour functional programming by putting a penalty on loops and assignments. Mutating a local variable has a smaller weight than mutating the state of an object. The looping version uses StringBuilder instead of plain String + which needs two more invocations for its construction. Then its components are
| Component        | Mass  | Count |
| constant         |   1   |   8   |
| binding          |   1   |  10   |
| local assignment |   1   |   3   | like a new local binding
| invocation       |   3   |  10   |
| conditional      |   4   |   1   |
| loop             |   5   |   1   |
| assignment       |   6   |   0   |
and its mass is 60 which is a bit more code than the recursive solution.

More Structure
The different wrap() functions above are just algorithms. They are not factored into parts that might change at different speeds over time and definitely violate the SRP. They also break the OCP as it is impossible to change the strategy of splitting without touching the logic of collecting. To address this I wrote another recursive version following Tell, don't ask,
interface Page {
   void renderLine(String lineOfProperLength);
}

class Wrapper {

   final char BLANK = ' ';

   final Page page;
   final int maxLineLen;

   Wrapper(Page page, int maxLineLen) {
      this.page = page;
      this.maxLineLen = maxLineLen;
   }

   void wrap(String line) {
      if (line.length() <= maxLineLen) {
         page.renderLine(line);
         return;
      }

      int indexOfBlank = line.lastIndexOf(BLANK, maxLineLen);
      int split;
      int offset;
      if (indexOfBlank > -1) {
         split = indexOfBlank;
         offset = 1;
      } else {
         split = maxLineLen;
         offset = 0;
      }

      page.renderLine(line.substring(0, split));
      wrap(line.substring(split + offset));
   }
}
which is very similar to the tail recursive solution above, with a total weight of 56. The number is smaller because it does not contain the necessary implementation of Page.renderLine(). The shown code does less, which makes it difficult to compare. On the other hand Page.renderLine() might be used by other parts of the code as well, so it is not strictly a part of Word Wrap.

Moar Structure!1!!
Later I created an extremely factored and decomposed implementation of Word Wrap that separated concepts of rendering, splitting, accumulating lines and hyphenation rules which should fulfil both SRP and OCP. Ignoring the HyphenationRule because that is not covered by the other solutions, its mass is 167 due to many method invocations and parameter names:
| Component   | Mass  | Count |
| constant    |   1   |  17   |
| binding     |   1   |  33   |
| invocation  |   3   |  30   |
| conditional |   4   |   4   |
| loop        |   5   |   1   |
| assignment  |   6   |   1   |
There is a loop and an assignment, at its core this implementation is a looping one. Using the recursive solution I should be able to get rid of the loop and the assignment.

Conclusion
The Absolute Priority Premise counts the different components of a program and sums their weights. If the weights are correct than the program with the smallest mass would be considered the "best" program. This is not true for algorithms like the Word Wrap because the APP ignores features like memory usage or performance optimisation. For general purpose code the validity of the APP is unclear. It just measures the number of code constructs, favouring more compact, functional code. On the other hand the four rules of simple design encourage us to introduce explaining variables to reveal the intent of the code which is more important than fewer elements.

27 July 2016

Improving Typing Accuracy

Das Keyboard - Model S Ultimate (III)I am always interested to improve my typing performance and eager to use keyboard shortcuts. As Code Cop I mentor developers and pair with them in different environments. I need to improve my typing and shortcut-fu across different tools and use flashcards to memorise IDE shortcuts. I found that I need more visual hints to remember the positions of certain keys. I am able to touch type but I do not know the exact position of the keys consciously. This is sometimes a problem when typing passwords.

Using a Blank Keyboard
Iris Classon reported that using a blank keyboard improved her touch typing accuracy. She listed measurements and statistics on her web site regarding her improvements. I own a Das Keyboard Ultimate and have used it from time to time. It is true that using it improved my touch typing accuracy, but it did not help me to "know" where the keys were.

Key Flashcards
I want to memorise the exact locations of all keys on the keyboard. This is very difficult for me, but I want to master it. As with the IDE Shortcuts I used Anki to create a deck of flashcards containing all keys on the keyboard. It starts with pictures of the blank keyboard and the name of the key in question:
Where is the #'-key on a German keyboard?Showing the keyboard already on the front side of the flashcards - the question side - helps me visualise the location of the key. I use the TKL (tenkeyless) variant of the keyboard, ignoring the numeric keypad, to save horizontal space. When ready I advance the deck and see the key marked on the keyboard:Position of the #'-key on a German keyboardThe same layout on both sides of the flashcards help me keep my visual focus on the position. (Having two pictures for each card doubles the file size of the deck, which might be a problem on mobile devices running Anki but I had no issues when using the deck.) As I use German and UK layout depending on my pairing partner, I created two decks with German and UK layout respectively:I did not create these decks by hand, rather developed a sequence of little application that would allow me to mark the key positions on the image of the blank keyboard, render the keyboard with and without markings to be used in a deck of flashcards and write the CSV needed to import the deck into Anki.

During my practise with the decks I sometimes wanted to separate letters from non letter keys. So I created even more decks:

18 July 2016

Hosting Public Coderetreats

I described the needs and benefits of inhouse Coderetreats in the previous article. (In case you did not read it - a Coderetreat is a full day hands-on coding workshop focused on the fundamentals of software development and software design. It is a day full of fun and excitement.) In this second part about Coderetreats I will say more about the opposite of (buying) an inhouse event, which is (hosting) a public one.

Hosting a public Coderetreat is obviously more work for the organiser, adding promotion of the event and handling registration. There are several reasons why companies host a Coderetreat. I ran a public Coderetreat in Venice sponsored by Interlogica. The people of Interlogica were passionate about our craft and wanted to connect with like minded individuals. Three out of four attendees were not connected with Interlogica at all and the exchange of ideas and networking was great.

Sponsoring a Coderetreat is Awesome!
The hosting company is usually also the Coderetreat's main sponsor. Sponsoring a public Coderetreat is a marketing activity. Interlogica wanted to increase its visibility. While we cannot expect a huge impact from a single event, it definitely was a good start. I supported them because a Coderetreat is real value provided to participants and the Craftsmanship community. As the event was free for the participants, someone had to pay for the room, lunch, time spent on organisation, my (facilitator) travel expenses and so on.

Session in progress at Coderetreat Venice 2016 (C) Pamela AdediwuraThe sponsor deserves our gratitude and at least some "link love". The host and facilitator may create more buzz on Twitter and other channels, depending on the free time the host has during the sessions. I post at least some images of the sessions and retrospectives, drawing some attention to the sponsor as well. As sponsored event, this is part of the deal.

Finding Local Talent
Many companies have trouble finding developers to hire. Hosting a public Coderetreat is a great way to present the company. Sometimes a representative of the sponsor will open the Coderetreat and make participants aware of open positions. I recommend distributing handouts of vacancies in the room and on the tables.

Public Coderetreats are run on Saturdays to allow people to participate. Starting Saturday morning attracts only the most passionate developers, who want to learn and engage in deliberate practice. These are exactly the kind of developers companies want to hire. A lady from Interlogica's marketing department told me that "people who understand (the idea of Coderetreat) and come are the people we want to hire."

Community and Networking
The Software Craftsmanship community is growing and a Coderetreat is also a networking event. After a few Coderetreats the participants get to know one another. For me a Coderetreat is like a class reunion, I usually know at least half of the participants and some of them are dear friends whom I would like to meet more often. For beginners or people new in the city it is a great way to get in touch with local craftsmen.

A Coderetreat ends with drinking beer in a local pub in the evening. This is another opportunity to talk to fellow software professionals. At the Coderetreat in Venice, the sponsor set up a small reception including cheese, wine and finger food for all participants. (Did I mention that they rock ;-) Interlogica's CEO was amazed by the number of different people he met and talked to during that time.

Free for Participants
According to Corey Haines, one early proponent of the Coderetreat format, the event must be free of charge for participants. Many organisers ask people only for a safety deposit of ten to 15 Euro. The deposit is refunded as soon as the person shows up and is used to pay beer in the evening if the person does not. I strongly recommend using such a safety deposit to make sure that people show up. Most organisers use Eventbrite for handling the registration, because it does not take any fee when a ticket is refunded. An Eventbrite registration page might look like the one I used for GDCR14.

Promoting the Event
After setting up Eventbrite, every public Coderetreat should be registered at coderetreat.org and promoted through Twitter, Facebook and other channels. Coderetreats in large cities, e.g. Berlin or London are sold out in under a week. In smaller communities we need to allow enough time for people to get spread the word that a Coderetreat is coming up. I recommend having the registration ready at least one month in advance to have enough time for sharing and advertising the event.

Whenever I run a Coderetreat, I talk directly to local programming language user group leaders and ask for their support to promote it. Even if I do not know these group leaders, their members might be interested in coding activities. As a Coderetreat is open to any programming language, it is much more fun to have participants from various programming backgrounds. Collaborating with user groups ensures that there are participants offering more interesting languages like Go, Elexir, Haskell, Dart and so on.

you are awesomeThe same is true for women in technology. For a Coderetreat in Berlin last year, one facilitators got in touch with several local women-only programming groups, like Rails Girls or PyLadies, told them about the event and opened private registration for them. He waited for a week before making the registration public. After public registration started, the event was sold out in a week.

Being Awesome!
So if your company wants to be seen to care for craftsmanship, dedication and quality, you are looking for great developers to hire or you just want to work in an awesome company, hosting a Coderetreat is the right things to do. Even when you are not able to host a full Coderetreat, buying food for participants or covering expenses is appreciated.

10 July 2016

About Inhouse Coderetreat

What is a Coderetreat?
A Coderetreat is a full day hands-on coding workshop focused on the fundamentals of software development, software design and communication. During the day participants get several chances to try something completely different and have the opportunity to learn new ways of coding and testing, programming languages or IDE usage. A Coderetreat is a funny and exciting day for the people, sharing their thoughts on Test Driven Development (TDD), Simple Design and more.

The Role of the Facilitator
A Coderetreat is run by one or more moderators, called facilitators, who are an essential part of every Coderetreat. The facilitator guides the participants through the day and helps people to learn as much as possible. Different facilitators have different styles. (I like to explore these styles and travel to co-facilitate Coderetreats with other people, as I did for last year's GDCR.)

inHouse (cc)Hosting an Inhouse Coderetreat
In a business context Coderetreats are run inhouse and during working hours. Someone inside the company has to take over the role of the host, and care for the organisation, e.g. invite participants, find a proper room, etc. Usually this is done by a team lead or line manager, who is attending the event but not participating in coding. Lunch should be provided on-site for all participants. The lunch break is the perfect time for discussions and reflections on learning and participants should not wander off to get food on their own. Sometimes I allow lunch breaks up to 90 minutes to encourage more discussions.

Finding a Room
Finding a suitable room for a whole day can be challenging as large meeting rooms are scarce and contested resources in companies. The room must be suitable for people working on laptops in pairs and should be comfortable enough to allow for prolonged periods of working. Not all rooms are useful. University labs are not ideal because the room setup does not encourage pair working. Lecture rooms with benches are no good as they do not allow for comfortable coding. The facilitator should be able to walk behind the participants and movement between sessions should be free. Dividing participants into several rooms is possible if the rooms are located next to each other. The best setup is a single, large room with several tables, where each table allows one or more pairs working together. The best rooms are apart from the daily business, without disturbances, increasing the retreat character.

Further space is needed for the discussions and session retrospectives. Sometimes this is just an empty space in front of the room where people gather in a circle and talk, or it might be a different room - or even a light-flooded hallway. Sometimes a short walk to another room helps participants to detach from the previous exercise.

A Day of Learning and Practise
The goal of a Coderetreat is deliberate practise and learning. There is always something new to discover during such a day. Depending on the expectations and skills of the participants, the facilitator will choose suitable exercises that challenge them and push them outside their comfort zone. All exercises are based on TDD, Simple Design and Pair Programming. Even if participants are new to one or all these core practises, they will get a first experience using them. They will explore their first tests or might collaborate with more experienced developers and see how to drive their development with tests. It is a great way to start TDD. I have seen participants leave the event completely exhausted by all the new things they have learned.

Retrospective during Coderetreat at Wooga/Berlin 2015 (C) Stefan HothFor inhouse Coderetreats participation should be voluntarily. It is impossible to force people into learning. If someone does not want to attend, she can leave any time. During inhouse events I do explain more and push the participants less outside their comfort zone because they are still at work. Although it is difficult for me, I refrain from difficult or extreme constraints because I do not want to frustrate the participants. Some facilitators start an inhouse Coderetreat with a short presentation or discussion about the principles of TDD, Pair Programming and Object Orientation.

Kicking Off an Improvement Initiative
While an inhouse Coderetreat includes more teaching aspects than a public one, it is no training, there is no teacher and the participants strongly influence the day's agenda. Still it is a great way to get started with the spirit Software Craftsmanship, Continuous Improvement, Deliberate Practise, XP practises like Test Driven Development or Pair Programming and Agile Software Delivery in general. A major goal of an initial Coderetreat is to make people aware that there is more than training on the job and to spark the interest in topics like TDD or Clean Code. A Coderetreat is a great way to break the ice, because it is without any obligation for participants. I also make the whole day as much fun as possible, because fun is important for learning and I want my participants to look forward to future events. I strongly recommend running a Coderetreat to kick off any technical improvement initiative or coaching engagement.

The Facilitator's Perspective
A Coderetreat is also an opportunity for the facilitator and the host company to get to know each other, enabling further collaboration. Deliberate Practise events like Coderetreats or Coding Dojos cover only some aspects of technical improvement. Additional activities like lectures, focused programming workshops, team coaching, mentoring by Pair- or Mob Programming might be necessary. During a Coderetreat the facilitator sees how the participants approach problems, how they write code and how they communicate with one another. These fist impressions of the team's skills help to plan further learning activities.

Conclusion
Since I started working as independent trainer and coach in Vienna I have used the Coderetreat format extensively. Its open nature allows the participants to experience a way of practise and learning which are usually not known in enterprise environments. On the other hand it gives me a first idea of the overall skill level of the client's team and we get to know each other. I strongly recommend running a Coderetreat as kick off for any long term technical coaching engagement.

9 June 2016

Oracle Code QA

As Code Cop I want all my code to be clean so I keep my sanity when maintaining it. Some basic pillars that support internal code quality regardless of programming language are Coding Conventions, automated (unit) tests, Static Code Analysis and Continuous Integration. I discuss all of them in my Code Quality Assurance lecture (and its latest slides are here). A good development process covers all these and more.

Recently a colleague inherited a bunch of Oracle PL/SQL code and asked me for help. Being used to Java and many tools that help us keeping the code in shape, e.g. JUnit, Checkstyle, PMD, Jenkins, he wanted the same for his database code. While some programming language ecosystems are traditionally strong in supporting the things I mentioned earlier, some other languages seem to lack behind. Clearly there are fewer options for less used languages. But that must not stop us from applying the same rigour to our code. Let's get started!

Everyone is Marcin Grzejszczak todayDatabase Naming Conventions
First we need coding conventions because consistency is important. Unlike Java where most projects follow the Oracle conventions, there is no such thing for Oracle databases. Instead there are several, sometimes contradicting proposals and you have to put together your own set of rules. Here are some reasonable ones for schema objects:PL/SQL Coding Conventions
The Procedural Language/Structured Query Language (PL/SQL) was introduced by Oracle in 1992. It is a compiled, procedural and structured language. By these attributes it is similar to modern languages like Java or C#, and all the general advice for naming, formatting, commenting, function scope and code size apply. Even object oriented concepts like Encapsulation or Coupling are meaningful (to a certain degree). See my presentation on Clean PL/SQL for more details. Again there are no official conventions from Oracle.
  • Steven Feuerstein's Naming Conventions and Coding Standards contain a list of naming conventions for PL/SQL variables together with some guidelines and a discussion of rejected conventions. If you do not know Steven, he is probably the authority on PL/SQL programming and knows what he is talking about. He also outlines a way to check the conventions, which I really like.
  • Philip Greenspun's SQL Style contains a few rules on formatting SQL statements for better readability.
  • Trivadis' PL/SQL and SQL Coding Guidelines are a complete set of standards regarding naming, formatting, language usage and control structures. It is a very comprehensive document of almost 60 pages and looks really impressive.
How to Choose Your Own Conventions
As there is no standard, you need to roll your own. To get started I recommend reading all the resources above (and even google for some more) and get an idea what could and should be defined. Then you look at your existing database objects and source code. Usually developers follow some conventions and some percentage of the code uses similar patterns in formatting or naming. If one of the used conventions is in the limits of the different proposals above - and you like it - then start with it. (Starting from something that is already there reduces your options and the resulting conventions are less optimal, but on the other hand you have a bigger change to get the code into a consistent state, because some part of the code follows the rules. If there are no existing patterns in your code, if you are starting from scratch or if all you see is crap, you still need to define different conventions.)

Quality ControlStart with a small set of rules in the beginning. There should be some naming schemes, table aliases and formatting rules. If you define too many rules at once, there will be too many violations in the existing code and people will argue that adhering to the conventions is too much work. Later, when everybody got used to the rules, it is time to add more of them. You will find more specific rules during the lifetime of a project, e.g. by identifying bug patterns to be avoided in the future. Conventions need to grow. Unless you are beginning a new project and want to start with a full set of conventions, the Trivadis conventions mentioned above might be too comprehensive to start with. But they are an excellent example how a full blown conventions document looks like.

Reviewing your code, reading the provided resources and collecting the basic rules that apply and that you like should not take you more than a few hours. It is more important to start with the first version of coding conventions sooner than to start with a complete set later.

Unit Test
If you are used to JUnit, RSpec or Jasmine you will be disappointed. There is not much support for unit testing in PL/SQL.
  • Usually - if at all - developers create stored procedures that call other procedures and check the results programmatically. If these test procedures follow a common convention, e.g. raising an exception on test failure, it is possible to automate calling them from the command line or build server.
  • Another option is utPLSQL, a basic unit testing framework created by Steven Feuerstein. It works as expected, but lacks the comfort of modern unit testing frameworks. I used it to test my PL/SQL port of Gilded Rose. (Gilded Rose is a testing kata where you need to create a lot of tests. It is an excellent exercise to get a first impression of a unit testing framework.)
  • Oracle SQL Developer has some support for automated testing. Unlike utPLSQL it is driven through the user interface. Tests are created and executed through the UI of SQL Developer. A Test case is a set of input values - usually rows in one or more tables - and a call to a stored procedure. Then the updated values are compared against a set of expected values. To see this in action, check out Jeff Smith's introduction to Unit Testing Your PL/SQL with Oracle SQL Developer. It is easy to create first tests, but test definition lacks the power of a general purpose programming language. Further I do not like that test definitions are "hidden" in some SQL Developer specific tables, the Unit Test Repository. However if you are a heavy user of SQL Developer, it might still be reasonable to use it for testing, too.
  • DbFit is an extension to FitNesse, a standalone, acceptance testing framework. DbFit tests are written using tables, making some test scenarios more readable than xUnit-style tests.
  • Steven has more recommendations for unit testing PL/SQL, including Toad's Code Tester for Oracle. If you licenced the Toad Suite, it is worth checking out its testing functionality.
Unit testing is mandatory, but no single approach or framework looks superior. I believe the best approach is to evaluate the different options, using the tools you already have. Maybe create some tests for the Gilded Rose in each of the testing frameworks to see what works for you and what not.

Static Code Analysis
magnifyA vital part of code quality assurance is static code or program analysis. The source or object code is analysed without actually executing it to highlight possible coding errors. I love static analysis but have never used tools for PL/SQL myself. Steven agrees with me that we should use Lint Checkers for PL/SQL - and of course he is right. He lists some tools that add warnings besides the checks provided by Oracle.
  • A free tool is PMD for PL/SQL. PMD is my favourite code checker for Java and it works great. There are only a few rules for PL/SQL but more can be added easily. (See how I added custom rules to PMD in the past.) PMD is definitely a tool I would use first.
  • Trivadis PL/SQL Cop looks very promising. I am not sure about its licence, but it seems to be free. Rules must be checked automatically each day, e.g. in the nightly build, so tools must work from the command line. Again I do not know if PL/SQL Cop works like that. The next step would be to experiment with it and see if it can be run from the command line.
  • Another great tool is the Sonar Source PL/SQL Plugin. The plugin adds PL/SQL support to SonarQube. SonarQube is a free, open platform to manage code quality. It is widely used in the Java community. The plugin is commercial, but if you need to manage a lot of PL/SQL code I would recommend buying it nevertheless.
  • There are several other commercial tools available, e.g. ClearSQL by CONQUEST, which I did not check.
For static code analysis I follow the rule that more is better. I recommend to start with a basic tool, e.g. PMD, and keep adding tools and rules over time. In existing projects you need time to fix the violations, e.g. WHEN OTHERS THEN NULL, and starting with too many rules in the beginning creates a lot of work.

Putting It All Together
After you established conventions, added automated tests and configured some static analysis tools, it is time to put it all together and shorten the feedback loop. While you could run tests and checks manually from time to time, it would be more helpful to do so every night, or even better on each check-in/push. (Checking your code on each check-in requires you to put your DDLs and package sources under version control. While this adds some extra steps to your development workflow, I highly recommend doing so.) A tool like Jenkins or another Continuous Integration server could be used to create an empty database instance, execute your DDLs and compile all your packages. Starting with an empty database instance is important to avoid works on my machine problems. Then Jenkins should run all tests to verify that the code works as expected. The final step is to analyse your code for violations of coding convention and potential problems. Many people add more steps like generating documentation or packaging deployment bundles suitable to be deployed by the operations team's DBA.

Just Do It!
Terence Parr recommends to automate anything that you might screw up and he is right. Creating working software is hard enough, we should not bother with manual tasks, rather automate them. Further automated checks keep the quality of our software high, resulting in faster maintenance and less bugs. This leaves us more time for the interesting parts of software development - solving problem and creating solutions.

22 April 2016

Interview Franziska Sauerwein

My next "victim" for my series of interviews was Franziska "Franzi" Sauerwein. I first noticed Franzi volunteering information about developer ethics in the Software Craftsmanship Slack channel. As I kept meeting her at interesting conferences and unconferences around Europe, it was just a matter of time until she agreed to answer my interview questions. Franzi is very active on Twitter and posts to her Codurance blog from time to time. Let's see her views on work and values.

PuzzledHey, my name is Franziska Sauerwein and I'm a Software Craftswoman.
Puzzles have always amazed me and that's how I got interested in Computer Science. After completing my degree I learned that Software Development is much more about people than about sitting alone at a desk in a room and coding in isolation. I have worked as a software developer and consultant for three years in Germany before moving to London to join Codurance in the summer of 2015. My passions include Test Driven Development, Refactoring, XP techniques and high quality software development. I'm always trying to improve my skills and share knowledge. As an active member of the European Software Craftsmanship community I love to participate in unconferences and organise code retreats, hackathons, coding dojos as well as tech talks. I aim to use my skills and creativity to develop software that is reliable, easy to adapt and doing what it is supposed to do.

You said you like to discuss developer ethics. Why is that so?
As developers, we have a profound influence on our society and people's everyday lives. How we write software and what we write has an impact and with great power comes great responsibility. :)

What other topics are you concerned about?
I am a feminist, which means I believe in equal rights for all genders. I also believe in taking a critical look at my privileges as a white person with cis and class privilege. I try to inform myself on racism, ableism, hate on trans* and queer people as well as other forms of discrimination. I speak out when I witness discrimination and I try to raise awareness on these issues. I support other women, especially when they face discrimination in our industry. In my community work, I actively encourage women to take their space and men to give them their space. There are about a thousand little things that I do, from translating the Community Code of Conduct to German to recommending women to speak at conferences. I use my privileges and my extroverted personality to raise the voice of others.

What do you consider the biggest challenge of our times?
I consider the biggest challenge to show compassion towards and work with other humans in the face of a society that tells us to worry about our own safety and throw others under the bus (or out of our country).

Most people I meet are concerned about meat mass production or pollution. What could we do to engage in the topics? For example, did you take part in public protests, donate money to NGOs or sign petitions?
These are topics I used to be much more interested in a couple of years ago, when I did all the actions mentioned above. Nowadays, my passion and energy are put into issues that are closer to me and the people I care about and where I feel I can make a difference. That being said, I try to live a sustainable life as much as possible (using public transport, avoiding waste, not eating meat) but I do not consider that to be out of the ordinary. I also support people who need financial aid by donating and lending money. However, I believe financial inequality can ultimately only be solved on a political level.

Canadian Charter of Rights and FreedomsDo you think it is possible to work on "the right things" which are aligned with your values in general?
It definitely is. In fact, I believe that I can be a feminist while I am working. We need people on all levels, people that dedicate their life's work and people who are not primarily activists. And it is important to keep your activism to a level where it is sustainable, taking care of your needs as not to burn out. One can easily get overwhelmed with the number of problems out there. Allowing yourself some slack and amplifying positive changes makes it easier to deal with things.

Especially when you are in a discriminated group, there is a lot of expectation to fight and work against that. However, it should not only be your responsibility, but the responsibility of society as a whole, especially the privileged members. And it can be much harder and more frustrating to speak out and defend your position when you are affected by bad behaviour yourself.

Regarding the choice of working on the right thing: There are already many organisations out there that make conscious choices of what to work on. If you are in a position to choose, go for what you believe in. I believe in raising the bar of software development and building a community of professionals, that's why I chose to work for Codurance.

There are many decisions we take before and during a project. Which choices do you think are relevant?
I think the most likely choices we face as developers are whether to implement dark patterns, impede on people's right to their privacy, slack on security or engage in legal grey areas that ultimately cause harm. Choosing who we work with and who's voice we amplify also makes a difference. Examples like the Apple Watch not working on dark skin or health applications without period trackers show that lack of diversity in the people producing the software has a direct impact on the user. Increasing diversity in the workplace is therefore an important part of making software better for all humans. In my opinion, the largest cause of the lack of diversity in software development is due to everyday harassment, micro aggressions and systematic subtle disadvantages.

How do you think about selecting industry, customer and project based on your values?
I think everyone should choose the industry that interests them most and do what they can to make it better. If you are able to choose customer and project, choose according to whether you can leave them a better place. For example, through increasing transparency and user friendliness or providing users with protection against online harassment. You can also choose to increase profits for someone who invests some of that profit into a cause you believe in.

Do you have problems with any industries?
I do not think that it is that easy to steer clear of problematic companies, since it's not transparent who profits from what. All industries have some problematic part, mostly through exploiting people or benefiting from countries screwing each other over. I do not want to support the weapon's industry, as it profits from wars and conflicts where people get hurt.

Did you ever reject a customer or an actual project, based on your values?
I was not in that position yet.

On the other hand, what would be projects that you would love to work on?
I would like to work on projects that increase diversity and fight discrimination.

Thank you Franziska for sharing your views.

16 April 2016

Join me at GeeCON

GeeCON Conference SwagIn less than a month GeeCON is happening again. It is a great three day conference for Java and JVM developers. And you should go there! If you are from Vienna, Austria, it is especially easy and cheap to go there. But I am getting ahead of myself...

Why attending a conference?
Attending a conference has many benefits. Kevin Benore bas summarised some of them: Learning, networking, professional advancement and "Keeping the Flame Alive". Learning new things is a major reason to attend for many people. While you could watch all the content online at home, I have not met anybody who took two or three days off to do that. Also a conference gives you diverse content, sometimes you end in a talk about a topic you have no idea about. I bet that you would not watch such a talk online - why should you?. So the "change of scene" is a very important side effect of a conference. And of course there is swag - or how I call it - loot ;-). I consider swag less important and rather pay less for the conference, but the occasional shirt or mug are great mementos of past conferences.

GeeCON
GeeCON is my favourite conference and I go there every year since 2010. (I missed the first version in 2009 and I am still sad about it. But I have been to more GeeCONs that some of the organisers themselves.) I go there even when I am very busy. I am never disappointed by the content presented, see my extra short summary of GeeCON 2012. To make sure for yourself, I recommend checking out the GeeCON 2016 speaker line-up and the GeeCON Vimeo channel containing all past presentations since 2011. For this year I have the resolution to share the goodness and bring more people (from Vienna) with me, which is why I wrote this little advert.

Cost and Effort of Travelling
Some people like travelling, others do not. I am not fond of business trips and consider them a necessary evil. Kraków, the Polish city where GeeCON takes place, has an airport nearby. There are direct flights to different European airports, e.g. Berlin. From Vienna, where I live, it is even easier to reach using the night train. (I apologise for the following excessive details, but my main goal is to encourage developers from Vienna to join me.) The night train 406 leaves from Vienna Hauptbahnhof every day at 22:50 and arrives the following day at 7:00 in Kraków. When you book early, you might only pay 55 Euro for the special offer "Sparschiene". The night train is great because I can still be at work the day before the conference and I stay one night less at the hotel which saves me money again. The same is true for the return trip, train 402, which leaves Kraków each evening around 22:00.

Polish Night TrainFor the remaining two nights I usually book a cheap hotel next to the main railway station Kraków Glówny, e.g. ibis budget Krakow Stare Miasto, where I can stay for 40 Euro per night. I like the ibis because I can drop my luggage after arriving in the morning. Also one of the bus lines to the venue stops right before the ibis, reducing the hassle of travelling.

Value for Money
Depending on when I book, the total cost for a GeeCON visit (from Vienna) is between 380 and 440 Euro, excluding dinner. This is a ridiculous price for the value of a great three day conference. Because of the cheap travel, even other great community conferences like Devoxx cannot compete with GeeCON.

Training Budgets
The cheap total price enables several options.
  1. For employees now is the time to ask for your training budget. If you work for a reasonable company, there is some money for training and education for sure, however it may be small. The small cost might still make it possible to go to GeeCON on company expenses. Go, ask your manager now!
  2. In my experience money is less of a problem than the time not doing actual work. In such situations I offer to take the days off. As an employee, taking three days off is easier for me than paying 500 Euro from my wallet. This is also a fair approach as education is both the employer's and employee's obligation. So if your boss is unable to send you to GeeCON on company expenses, offer to take three days off to compensate and to show that you are serious about your continuing education. Taking the night train - while not very convenient - pays off again, because there are no extra days needed for travel.
  3. If you are independent, your training budget is exhausted or your boss is a moron, then just take the days off and pay for the whole conference on your own. I am very bad at bargaining and hate arguing with managers, so I took this option several times in the past. You might use your training budget to go to a really expensive conference like JavaOne and pay for cheaper ones yourself.
Come With Me!
As you can see - if you are from Vienna - it is easy and cheap to go to GeeCON. I would like to take you with me because I want more of us to participate and learn and have fun there. I am sad that there are only three participants from Austria attending a great international event with more than 1000 participants. So register for GeeCON now!. If you have any problems or doubts or if you need help in organising your trip, please get in touch with me.

20 February 2016

Memorising Keyboard Shortcuts

Two months ago I found a set of flashcards with IDE shortcuts and started learning them. After using the cards for some time, I noticed that memorising all the shortcuts is really hard for me. While many key combinations are sort of mnemonic, e.g. Ctrl-Alt-m to extract a method, some are not, e.g. Ctrl-Alt-l to format the source. I struggled to remember the shortcuts, mixing up the modifier keys all the time. It was frustrating to answer a card wrong for the n-th time and I had to reduce the number of cards I studied each day.

There is not much information in a key sequence like Alt-F12 to make it a reasonable entity to remember. There is no story around it, nothing to relate to. I have heard of people being able to remember huge numbers by translating them into sequences of pictures - a story, which is much easier to keep in memory.

Old KeyboardOn my German QWERTZ keyboard there are 105 keys. Ignoring the number block and a few other keys, there are up to 70 keys which might be used in shortcuts. There are three modifier keys which can be combined into eight combinations. (I ignored the Windows and Menu keys and till now have not seen an IDE that made a difference between left and right Shift or Alt.) Not all combinations of keys are special, e.g. Shift-a is just an A - I counted 400 potential shortcuts to activate IDE functions. Further some shortcuts mean (hopefully similar but) different things in different contexts, e.g. inside the editor window or navigator.

Modifier Keys
I do not know how translating the shortcut into a story might help, but I will experiment with hints for modifier combinations at least, because I never seem to get them right. Changing the order of modifier keys between shortcut descriptions makes things more difficult and I have not found an order which is easier to remember for me. Any ideas anyone?

Maybe some research is needed: The Control key was created to zero the leftmost two bits of the generated ASCII character. This created values below 32 which controlled where the next character would be placed on the display device. Its symbol is the helm, U+2388 (⎈). The Alt key was used to set the high bit of the signal generated by the other key. Its symbol is the alternative key, U+2387 (⎇). The third modifier is the Shift key, shown as an upwards white arrow, U+21E7 (⇧). It is the oldest of the three keys as it was used in typewriters to shift up the case stamp to change to capital letters.

By position on the keyboard and their prior usage, I sort Control before Alt, as in Ctrl-Alt-Delete. I am not sure where to put the Shift. JetBrains' Help puts the Shift between Control and Alt. The question for me is if Shift is a part of the character, e.g. uppercase A. I will have to experiment with Ctrl-Shift-Alt-something and Ctrl-Alt-Shift-something.

Visual Hints
I noticed that I take visual hints from the question, i.e. the typeface and text describing the shortcut, e.g. "Switch between views". Maybe that is how the brain works but this is not the kind of memory link I want to establish between the desired action in the IDE and the shortcut that activates it. Maybe I need a more visual representation to remember the shortcuts. The symbols (helm, alternate, upwards arrow) are very different and could be useful.

I experimented with Anki and it is possible to add pictures to the flashcards. I plan to create a new deck of cards containing a picture marking the actual keys on a keyboard. I hope that the visual representation of the keys will help me remembering them. Unfortunately images if keyboards make some shortcuts layout specific, e.g. Ctrl-z is in a different location on an US/UK layout than on my German one. As I plan to master both layouts, I will have to create and study the visual layouts of the relevant shortcuts twice.

Muscle Memory
Knowing the list of available functionality and their key combinations can only be the beginning of my "I know all shortcuts journey". There is no doubt I will need to practise typing them. I hope that knowing them will shorten the actual practise needed. Using flashcards allows me to study a few shortcuts whenever I have an extra minute, e.g. on the subway or when I am early for an appointment.

Going Crazy
I am already working on my "absolute mastery" deck. It will contain all the shortcuts of Eclipse, IDEA, Vim and possibly other tools like Word or Firefox, using both pictures of the US and German keyboard layouts when necessary. Creating all these images will take some time - coding time of course, as I will not draw them manually ;-)

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.