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.

20 December 2015

Interview Christoph Neuroth

C089 - or Christoph Neuroth - was the Code of Conduct "officer" at SoCraTes Belgium. Obviously I asked him to answer my questions. Here is what he wrote. If you want to know more about Chris, read his blog or find him on Twitter.

Turbo Basic (HDR)Christoph, how did you become a software professional?
It started when I found a tutorial on programming in BASIC as a kid. I really liked video games and writing stories, so I wrote text adventure games with that. I was hooked and started saving my money to buy books on programming and educating myself. At the same time I had tons of problems at school. I was later diagnosed with ADHD but this was way before that became a well-known "condition", so they just tried to get rid of me and at least one teacher told me I would never achieve anything. But I couldn't care less: I sat through it, went home, told my parents there was no homework and wrote code. I cannot really recall wanting any other job since then. I cheated my way through school to get some degree that allowed me to go to university with the least effort possible and went on to study computer science, which I believed was the road to becoming a professional software developer. That was a bit naive though and I did not learn a lot of useful things about software development there and continued to self-educate instead. It was a great time for personal development though. I also worked part-time programming jobs to get more experience and after graduating went on to become a full-time developer. The really important thing however was that by chance I got to meet people from the craftsmanship community. I had read books like Clean Code and understood about the importance of testing already, but learning from all these people and becoming an aspiring craftsworker myself was so important.

My most recent big success was going independent last year. I currently work as a developer in teams and lead by example when it comes to better ways to build software, run training sessions on testing and design and advise technical management on what they can do to help their developers get better. Going freelance allowed me to level up my career in many ways that were not possible in a traditional employer/employee model. But more important to me are the small, everyday successes: When a developer tells me she learned something useful from me or that I helped her team overcome a problem. That is what gives me the energy to pursue excellence and keep going.

And you already know I also organise SoCraTes Conference, an un-conference for all people that are passionate about well-crafted code.

I know that you are vegetarian and noticed you sharing content about diversity and harassment. Why does that matter to you?
Well, vegetarianism (or my as of now part-time veganism) is the much smaller thing for me really. After moving out of my parents place I had to care for my own food, so I had a reason to think about what I eat. I gradually and unconsciously removed meat from my diet. At some point I noticed "oh, I am a vegetarian", and went on with my life. It was later that I began to think more about the ethics behind that and while that is interesting, I think it is much more pressing to talk about diversity and harassment in our industry. Many people that are actually affected by this have written about this question and I encourage everyone to listen to them, but as you specifically asked why it matters to me, here goes:

Being a software developer is a great job. It has given me the opportunity to do something I enjoy for work, get a very good salary plus freedoms people in other professions can only dream of on top (right now I am working from the beach in Tunisia to escape the cold German winter). But many people with more talent than I have need to work much harder to enter this profession, and when they make it, they end up in a hostile work environment. Here's the problem with this industry: Way too many of us are able bodied, cis, straight, white men in their twenties or thirties - just like I am - and the moment you do not fit in, you are likely to be discriminated and harassed in this industry.

This initially is not obvious because it is so prevalent in the whole society, and sold to us as normal. But once you realise it, it cannot be unseen: When I recently recommended a junior developer to check out some videos by Sandi Metz and ended the sentence with "she taught me a lot", he uttered a "she?" that sounded not just surprised, but rather disdainful. I have seen whole offices with a culture where using "gay" as a synonym for "bad" did not even make people raise an eyebrow. I have seen rape jokes posted on the wall of a 100% male development teams' office. All those things and much more, every day. I do not want to work like this, and no one should have to.

Now most people are not that bad - they do not want this, and I am sure they often feel uncomfortable because of this. But they may be afraid to speak up, so it is important that those who have really nothing to lose do. So, because I enjoy the privilege of being in this industry, not having to fear and having my voice heard, it is my responsibility to say something. That is why it matters to me. And we will all benefit from this: We will get to work with many new talented people that we excluded before and can together raise the bar of professional software development, which is what craftsmanship is all about. Sure, we may lose some too: those that show toxic behaviour and do not want to change - but are we really going to miss them? I do not think so.

Refugee Welcome Center HamburgWhat other topics are you concerned about and what do you do regarding them?
I am concerned about many things really, but of course I cannot act on all of them. The other really big issue that has been interesting to me the last years has been how we treat refugees that come to Germany. As to what I actually do, I do not want to go into details but rather look at that question from a different angle, one that is related to craftsmanship too: Probably not enough.

I am often concerned about not doing more work like that; and instead go to a client’s office where I make money building things that do not really improve society. And in our community, we put a lot of focus on lifelong learning, and then I do extra work like organising SoCraTes. I often wonder if my priorities are right. For my career, definitely; but will I be satisfied with this when I look back on my life one day? I am not so sure about that.

Outside your personal topics discussed till now, what do you consider the biggest challenges of our times?
Finding a way to thrive on another planet before we completely ruined this one.

When I talk to people, many express concern about meat mass production or pollution, but almost nobody really acts on it. 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?
I did all of that, at different times and for different things, yes. All of these things can be helpful, it is just a matter of choosing the right tool for the right problem. Regarding things like factory farming and pollution, I think the most effective protest happens through consumption, or rather the lack thereof: People do not mass produce animals because it is such a fun thing to do, they do it because it is a profitable business. So in the system we live in that is the way to end factory farming: Take away the profits.

However, that is fixing a symptom, not the root cause: Greedy people will exploit something or someone to make a bigger profit. When it is no longer factory farming, dirty engines or selling tanks to Saudi-Arabia, they will find something different. I do not really have a solution to that. While we have made progress in technology, when it comes to being respectful to each other and nature, we haven't really made that much progress. It is just very frustrating really.

I would like to see more impact on these important topics of my regular work. I would like to keep doing what I can do best and earn my salary as usual, just working on "the right things". Do you think that is possible in general?
Do we really need that "usual" salary though? Many of us could probably live on so much less! Last year, I moved out of my big flat, sold or gave away nearly all the stuff I had and since then I have lived a much less cluttered and happier life than before. Today, I could easily work for less money or just work less. But I remember the time when a person I trusted stole a good amount of money from me, I lived with friends for a few months and then spent years paying back loans. That is the way capitalism takes us as hostages: Every time I get to decide "do I want to take that contract, or spend three months doing voluntary work for refugees instead", this situation will be in the back of my head.

The other thing, and I guess that is true for you as well, is that I actually enjoy what I do for a living. Finding a way to contribute more to society with the skills I have would be wonderful. I think it would very well be possible, but right now I feel it is very hard to find. I cannot really think of software projects that have positive social impact and are backed by organisations that can pay market rate for their development.

There are many decisions we take before and during a project. Which choices do you think are relevant?
The Volkswagen scandal is an extreme example. While I have no idea if developers can be hold accountable for the fraud here from a legal point of view, it is very clear to me from a moral standpoint: It was their responsibility to refuse this work and blow the whistle. This is not something I would be a part of. But there are many small things everyone of us can do every day to improve things. Lena Reinhard recently spoke on that in her Talk About Everything that goes into more detail than Martin Fowler did in the talk Not Just Code Monkeys. She says it so much better than I could, so I will leave the stage to her: Talk About Everything.

How do you think about selecting industry, customer and project based on your values and social responsibility?
That has changed a lot for me. I chose my first job based on technology and so I ended in eCommerce by chance. Now that is an industry I am not very passionate about. Useful as it is, society has bigger problems to solve than improving the convenience of buying stuff. But at least it does not seem to be bad in itself.

As I can get to chose companies more frequently as a freelancer than as a permanent employee, this is now much more relevant to me. I will certainly not only base that decision on the money I can make. As I said before I would really love to work for a company that builds a product that actually has positive social impact, though I am not sure what that would be really. And after what I said about harassment before, it won't surprise you that I would prefer to work for a company where everyone cares about those things and is committed to build better work environments. I would probably even stay if I found a company that does both. But industry-wise? I am not sure, I cannot see any industry that is just "good". That is not how industries work I guess.

Do you have problems with any industries? What about the meat industry or weapon manufacturing?
I also do not think there are many industries that are inherently evil, so it would mostly be a case-by-case decision. Having a bank account is pretty useful compared to carrying around all your money, yet I would probably decline most banking-related projects - because I believe they are not about solving people's problems, but only about making rich folks richer.

Error 404 - Advert not foundThe weapons industry would surely be a no-go. A bit more surprising may be advertising: I view the advertising industry as somewhere between completely useless and outright evil. It is a whole industry that creates absolutely zero value for society. And it is not even that advertising is a mirror of a fucked up society with all it is problems - sexist advertisement only exists because there is a sexist society that responds to it. Capitalist consumerism only works if people stay unhappy, and advertisement is the primary weapon to create that unhappiness. You may think "weapon" is a strong word to use for that. Ironically, in Germany there is a campaign by the ad industry for itself (meta ads!) that says exactly that: "outdoor advertising: hits everyone". You hit people with your hands, weapons - or billboards. It is a very subtle war against freedom, and there is no opt-out of advertising. Which leads back to that thing I said before about being a hostage of capitalism: Ads are used to sell people stuff they do not need, which forces them to keep working their jobs even if they have ethical or moral issues with what they do for a living.

This brings me to another problem I have with my fellow humans: Our imagination seems so incredibly limited. When I say "let's ban ads", people always react with that old "that is not possible". Yet the city of Sao Paolo did exactly that with outdoor advertising in 2006, and the world kept turning even there. Why not try more of that.

Did you ever reject a customer or an actual project, that would bring you money based on your values?
Until now, that never happened. I am certain I would reject offers based on that if I had good reason, but being able to just walk away is also just privilege I have.

But how about the other way around? Maybe many companies do not even want to have people with ethical standards around, because their whole culture and business model is based on the absence of that? We are having this interview because in my twitter stream I mix things about my profession with my private views and I proposed a few sessions on diversity at SoCraTes conferences. I do the same offline: When I work at a client, I speak up against the kind of discrimination I described before. I usually speak with offenders in private the first time and then do it in front of their peers if the person person continues this behaviour. I think that in any group where someone shows such behaviour, there are people who feel this is not right, but do not speak up. So far I have never received any backlash because of this, but if that ever happened and the group decides I am the problem, I am more than prepared to get out of there, quickly. If I did not do it, it would make me an offender. I am in a luxury position of being able to speak up without fearing for my personal safety. If I did not speak up, it would make me an accomplice. So maybe some people will not hire me because of all this. I think I can live with that. I will go somewhere else. If society one day is so fucked up that I cannot get a job based on that, I will rather be poor than complicit.

On the other hand, what would be industries, customers and projects that you consider having a positive impact on society?
Maybe I am being pessimistic or just cannot see it yet, but I do not see how creating a software will improve things really. If anything, nearly all software is dual-use. Martin Fowler used the example of the developer that wrote printer drivers and how that is useful when you are building a house. While that is certainly true, the same printer driver can also be used to print the verdict that sentences a person to be killed by a fascist regime. Building software is something I enjoy and that pays my rent, there are many things wrong in how we do it and we can improve on that - but I do not see a way to make it an inherently good thing. It will be as good or bad as the people who write and use it. I really hope I am wrong with that though and will find projects to work on that are fulfilling on that level too.

Thank you Chris
Thank you

11 December 2015

Interview Samir Talwar

Next in line is my friend Samir Talwar to share his views about meaningful work. Read his blog or find him on Twitter to get in touch with him.

Samir, please take a few sentences to introduce yourself in a professional context.
Samir Talwar, software developer and software crafter from the UK. I like to break things. I am currently focused on automation of large systems - deployment, testing and such. I have been developing software for five years full-time, about ten years part-time.

I know that you are concerned with social topics. Why does that matter to you?
I think my position in life is mostly down to luck. Software development is profitable, and I am lucky I am good at that rather than, say, gardening. I know people who do more important things like teaching, but get paid less. We spend lot of time destroying jobs. In return, I would like to help people suffer less or educate on things that make others suffer less. Also I believe we should have a Universal Basic Income, so people do not have to worry about eating or paying the bills.

austerityWhat other topics are you concerned about?
In Britain there is a huge push towards austerity, despite the opinion of most economists that it is a terrible idea. It is an ideological push rather than an economically sound one by our right-wing government, and the media are simply pushing in the same direction. We do not have enough well-known independent media institutions in the UK; most are owned by a few right-wing moguls.

I do not believe in the current implementation of capitalism, because some people do not work and get a lot of money - landowners, for example, who make money by the appreciation of their land, which is mostly down to the surrounding area. Destroying the environment is not recognised as a cost, so it is often cheaper in monetary terms than taking care of it. In addition, the jobs that people want to do are often paid less because the recognised importance is considered a substitute for money. For example, teaching makes less money than many jobs, so fewer good teachers are available. The large and complex society we have built does not value important roles as much as they should be valued due to short-term thinking. This is my top concern right now because it is in my face.

Otherwise, I am concerned about many issues. 1. There is war in Syria, and no one will take responsibility for the refugees, despite recognition that the war is partially the fault of Europe. 2. In the software industry many people are under-represented, e.g. women, black people, gay people and trans people. I see this close-up, as it's the industry I am in, so I am trying to do something about it, even when they are under-represented in many highly-paid industries, not just in this one. My main effort here is in attending and helping out with codebar.io to teach coding.

Outside these topics, what do you consider the biggest challenges of our times?
The environment. We are destroying it and we have no idea how to fix it. And even when we do, we refuse to. We are going to kill ourselves and everyone else if we continue on this path, but we do it anyway because human beings seem to be incentivised for short-term gain. I have no idea how I can help, as it seems to be not a problem of convincing people but forcing them to pay attention, which I am no good at.

When I talk to people, many express similar concerns, but almost nobody really acts on it. What could we do to engage in these topics?
I have reduced my meat intake to approximately one day per week and I tell everyone the health benefits. I donate to Greenpeace and other organisations. That is all I do for now though. I hope talking to people about it will help.

Most activities are personal choices or non-profit charity projects. This is great but most of our time is spent on regular work. I would like to see more impact on these important topics of my regular work. Do you think that is possible in general?
I think it will become increasingly possible as non-profit organisations move to the Internet for more than just petitions and newsletters. As we see the Internet become a force for change in its own right, we will be able to contribute with our skill sets.

There are many decisions we take before and during a project. Which guidance do you have to navigate these decisions?
I have historically been very bad at this. I do not think enough about how I might harm people simply by doing my job. I have recently decided only to work for small organisations and completely avoid large ones, which I hope will help. it is my opinion that because large organisations become faceless and bureaucratic, it is much easier for decisions to be made that harm people without any one person taking responsibility for their actions. If I am working for small companies, I will see the results of my actions directly, and I really hope this will make sure I hold myself accountable.

Syrian RefugeeHow do you think about selecting industry, customer and project based on your values and social responsibility?
I have worked in the finance industry, but I will not any more. I just do not think I am helping the world by funnelling money around for no reason. It is a recent call for me, but I am going to try and avoid industries or projects that I think would make the world worse.

Do you have problems with any industries?
The difficulty here is the personal consequences. I have people who depend on me to provide some income, so quitting a job does not just affect me. I am finally getting to a point in my life where this isn't so much of an issue, as finding a new job should be pretty easy right now, so I can afford to make a decision to quit.

I finally think I am comfortable quitting a job as soon as I find out it is involved in something I find morally reprehensible. These include the military, intelligence and incarceration industries. The others are less black and white; I have heard that the percentage of people in porn coerced into doing the job is very low, though I do not have the numbers to back this claim, and I have no issue with consenting adults doing whatever they like on camera, as much as I would like to avoid being in any part of the industry myself. Sweatshops are horrible places, but often they are the difference between a job and starvation.

Did you ever reject a customer or an actual project based on your values?
I have until now only been working in permanent jobs, but I have turned down a job offer and quit another based on my morals.

On the other hand, what would be industries, customers and projects that you would consider important and would have an impact on society and the problems we discussed earlier?
I would love to work in something related to health care or self-improvement, either physical or mental. I have experimented with software that teaches coding in the past, and found it incredibly rewarding. I would also love to work on software that helps people retain their privacy.

Thank you Samir for sharing your answers with us. Good luck for your next stage of life.

7 December 2015

Another Journeyman Week

Recently I had the chance to accompany one of my fellow Craftsman to his work and immediately agreed to do so. While my own Code Cop Pair Programming Tour finished in 2013 I am still enthusiastic about being on tour. In the spirit of documenting my previous 13 weeks, I consider these past days to be week number 14 of my (probably never ending) Code Cop Tour ;-)

Room for Coderetreat Gran CanariaGlobal Day of Coderetreat 2015
To improve my facilitation skills, I ask facilitators to run trainings together with me. My friend Carlos Blé agreed to host me for a Code Retreat and I ended in Las Palmas, Gran Canaria for the Global Day of Coderetreat 2015. I recommend Gran Canaria for GDCR because the weather was much nicer than in Austria during mid-November.

For the Code Retreat itself I proposed to have a specific focus, a theme that we would use to shape the day. Carlos selected Object Orientated Design and we built the whole day around it. We started the day with a (very) short introduction - probably more a summary - of basic object oriented design principles. During the day we only used design centric constraints like No Naked Primitives or Tell Don't Ask. I was concerned that some people would like to try functional programming and indeed there was one participant working in Clojure in all sessions. But he did not complain and tried to fulfil the constraints, which was certainly a great exercise, even when using functional paradigms. We also asked participants to use Test Driven Development and pair programming, but we did not stress these topics. By making the Code Retreat more focused, we were able to exercise a single topic more in depth.

Besides from copying Carlos' every move, I learned a lot from the changed setting. I was a guest and knew nothing about how the Craftsmanship group of Gran Canaria and their Code Retreats. Further I had trouble communicating clearly and talked too fast for the Spanish participants. In return I did not get much feedback because I had not communicated well - which left me confused and made me sweat. I cannot remember feeling that exposed. The whole setting proved to be very challenging, exactly what I had been looking for.

Ruben wrote a summary of the day, which saved me from writing it myself. The slides Carlos and I used are available here.

AIDA Secret DoorAIDA Canaries
Because I "happened" to be around, Carlos invited me to spend a few days with his current client, AIDA, probably the largest IT company native to the island of Gran Canaria. I spend three days mob programming with Carlos, Emilio Medina and Ronny Ancorini. I used the opportunity to improve my C#, which I had not used since my session with Paul two years ago. I learned some more things about C# and ReSharper. We worked long hours and I did not see much of Gran Canaria during these days. As I had not come as a tourist, I did not mind.

Carlos published his summary of my visit already, which saved me a lot of typing again. (It seems that it pays off that my post is a month late ;-) I really loved staying some days in AIDA, everybody was nice and very inclusive. While a few employees had problems talking English, everybody seemed to appreciate my visit and the discussions I started. I enjoyed my time there. Thank you!

Spontaneous Unconference on Functional Programming
The following Friday I was lucky to meet Nicole Rauch. She had come to Vienna for her talk at the Agile Tour Vienna. She was one day early and we took the opportunity to spend the day together. While I had planned to host her, my friend Görge Albrecht, the "Code Mentor", stepped up and did the extra work of really organising the day, getting the necessary infrastructure and even paid for drinks and lunch. (Thank you Görge, I owe you.) The Software Craftsmen GmbH helped us out with their meeting room and shared their office with us for a day. The Software Craftsmen are a young company of experienced but still enthusiastic software professionals.

Mini Open Space MarketplaceSo a few members of the Vienna Craftsmanship group came together to discuss, share and exchange knowledge with Nicole. In the morning we collected possible topics. As Nicole is into functional programming, it was no surprise that Haskell, Monads and all kind of functional topics came up. We started discussing and reviewing one of her older presentation on Monads, which gave us plenty food for thought. In the afternoon we decided to do some coding and mob programmed an asynchronous error handling Monad in NodeJS. It was a great day and I learned a lot. Thank you Nicole for finding time for us and squeezing in a day of learning between your customer meetings, travel time and conference presentations.

Conclusion
The bottom line of this week is that our community is very inclusive. It is easy to find people who will accept you as a guest or be your guest if you just pay a little attention to their schedule. I had found Nicole's name in the list of speakers of Agile Tour Vienna, so I knew she would come. All I had to do was reach out to her early enough and we made it happen. The same was true for my visit to Carlos. I knew he would run a Code Retreat for GDCR15, so all I had to do was propose doing it together. I encourage you to look out for such kind of learning opportunities. Follow the people you meet at conferences, pay some attention to their (promotional) tweets and conference schedules and do not be afraid to reach out and ask them to spend some time together to discuss, learn, practise or just write some code together.

21 November 2015

Interview Carlos Blé

After Sebastian my dear friend Carlos Blé agreed to talk to me about his values and meaningful work. Unfortunately we did not find a time to discuss the topic in person, but he took the time (I assume during nights) to answer my questions nevertheless. I reproduce his answers here - still all (spelling) mistakes are mine to blame. Read Carlos' blog or find him on Twitter to get in touch with him.

Carlos BléPeter: Carlos, please take a few sentences to introduce yourself in a professional context.
Carlos: My father bought an Intel 8086 back in 1987, I was just six years old. He had several books with examples of source code in BASIC. That fascinating language got me hooked, I used to copy listings from the book to the computer to see the program run. That marvellous machine seemed to be the gate to the future, as it turned out to be... Years later I had an Amiga 500, then Amiga 1200 and was an active member of the Amiga community. Later I discovered Open Source and installed GNU/Linux on my machine back in 2000, it was Mandrake, then Debian...

When I was in my second year in college I sold my first program, it was a Delphi program to read data from files and render as graphs. With the local Debian community I volunteered as system administrator in several LAN parties, installing and monitoring servers. My first "official" job was as a PHP developer and Linux system administrator. My third job was my own company which made me grow as an individual. I started with three good friends and ended without company and without friends, but I learned a lot about myself and many other things.

Moving to Ireland was another milestone in my career, I went there without job and without a place to stay, spending a couple of weeks in a cheap hostel. I was over optimistic and did not really know how hard it is to start from scratch in a different country with a different spoken language. As you can imagine that was an awakening. That year in Dublin my brain learned to think in English and I learned that I could make a living as a developer anywhere. That gave me confidence to start up new projects when I moved back to home. I thought that if everything went wrong I could move abroad for good while this crazy bubble was still growing in Europe and the US.

What do you consider your biggest successes?
In the long term, the success lies in the perseverance. Working in many different places and learning from different people has helped me a lot. Writing a blog and self-publishing the first book on TDD in Spanish opened new doors. Sharing what you know and learning from others is essential. I have been using computers my whole life pretty much and I have been making a living out of it for about 15 years now. Today I run a successful company providing training and consulting as well as development services.

I know that you are vegetarian since more than ten years and I noticed you sharing content about cruelty to animals in factory farming. Why does that matter to you?
Once you know what happens in the factory farms and the slaughterhouses it is not very difficult to become vegan. Discovering the lies of the system is like taking the red pill in Matrix. I am slowly transitioning to a way of life that is sustainable for the planet. I do not want to take part in the animal holocaust. Most people do not know the truth about the system, the way the planet is dying so I feel like sharing what I know.

The reason to become vegan goes way beyond respect and empathy for animals. The carnist system (meat industry, consumers, etc.) is killing the planet at a dramatic rhythm:
  • 51% of the greenhouse gas comes from the meat industry.
  • 45% of the Earth's solid surface is used by the meat industry.
  • 10.000 square metres of land may produce 27.600 kilograms of vegetables, however it only produces 280 kilograms of meat.
  • Between 4.000 and 8.000 square metres of Amazon rain forest disappear every second, they are destroyed to grow grain for animals in the factory farms.
  • Three quarter of animal life in the ocean has disappeared already, species like tuna are disappearing quickly.
  • A single hamburger requires 3000 litres of water.
  • 70.000 million of animals die every year for meat.
  • Most of the food for animals is transgenic, which is killing the diversity of the vegetable species on the planet and giving even more power to large corporations like Monsanto.
And there is the protein myth, people believe that we need more protein that we actually need which is causing many diseases. The myth is promoted by the carnist system. The time of our life when we experiment the highest growth is within our first two years of life, when we only drink breast milk, consisting of only 6% of protein. There are top level vegan athletes like Carl Lewis. Look at the muscles and power of vegan Frank Medrano. It is interesting that after all these years as vegan myself, people keep telling me it cannot be healthy, despite my excellent health. I am a living empirical evidence!

Carlos planting cropFor references and more information about the numbers above I highly recommend the book Why we love dogs, eat pigs and wear cows by Melany Joy, it is an eye opener, a terrific book. Our ignorance is causing our own extinction but I believe we still can change it, I am very positive about it. I see more and more people aware of their consumer habits. Consumers have the power to change the world. I recommend the documentaries Cowspiracy and Home for those how want more numbers and facts.

What other topics are you concerned about and what do you actually do regarding these things?
I try to reduce my ecological footprint as much as I can, everyday a little step further towards a sustainable life which involves many areas, a lot of thing to learn and unlearn. We have been educated for competition but the current situation requires collaboration. So I want to be the change that I want to see in the world as Gandhi said, I am the first one who has to change in many respects. Every little gesture helps.

The easy way for us to change the world is by changing our consumer habits. Buy local food rather than going to a massive shopping centre. By organic food. Reduce the amount of animal products in your diet (you do not have to be vegan) and buy them directly from sources where you can see with your own eyes how the animals are treated. Help local producers first. Ask big corporations to be transparent when it comes to the way they produce their products. We need to know how things are made to make good decisions.

Make sure that cosmetics and cleaning products have not been tested on animals. There is no need for that at all. Laundry and dish-washing detergent as well as other cleaning products have a big impact in the nature, causing water pollution. Search for sustainable alternatives. Recently I have found a woman who makes soap in the traditional way and I am buying her soap and using it for the washing machine and dish-washing.

Do not buy stuff you do not really need, consider buying second hand. You do not need a new laptop every year or a new cell phone every six months. Do you have an idea on the ecological footprint caused by mobile devices? It is a good time to start wondering about these type of things. The way you spend your money has a direct impact on the life of the planet. Governments and large corporations are not taking care of the planet for us, we are the ones with the power to change. Your choices when you buy are way more important than your choices when you vote for a politician party. See the interesting documentary the story of the stuff for more details.

Outside your personal topics discussed above, what do you consider the biggest challenges of our times?
To survive our own ignorance, to stop living as if the resources of the planet were infinite.

What could we do to engage in these topics?
Whatever you do, it has to be fun or rewarding in some respect, otherwise it will not be sustainable and you will finally stop it. The transition movement is very inspiring, it is like a great promise and it is working in many places, e.g. agroecology, permaculture, de-growth, and so on. There are nice and cool things to get involved in, more than we think. I recommend the documentary In Transition.

Carlos' first cropThe less money you need the more freedom you get. I am starting to grow my own food at home, my plan is not to need money for food soon. I plan to instal clean energy at home so I am able to survive without money while my lifestyle is humble. The way we spend our money, the way we shop is more important and more powerful than we think. I am also limiting the number of flights per year, this explains why I am attending less conferences than usual.

Most of our time is spent on regular work and thus I want to see more impact of my work. While I could quit my job and do charity only, I would rather keep doing what I can do best and earn my salary as usual, just working on "the right things". Do you think that is possible in general?
Everyday at work we have an opportunity to be nice to others, help and support them with love. We do not have to quit our jobs or run charity organisations. We just have to be aware and consistent with our thoughts, our feelings and our words. Take a look at Radical Simplicity.

Do you have any examples where you took professional decisions based on your values and social responsibility?
I have been lucky not to work on projects or at companies that I consider deeply against my principles. I try to listen to my gut feeling. Sometimes I take a day off to disconnect and get some inspiration from nature.

How do you think about selecting customers and projects based on your values?
I try to know more about my customers before working with them. I do some research and if I do not like what I find or what I see during my first visit then I just do not work with them. As I said I have been lucky enough to stand in a position where I can say no to some jobs. I understand that not everybody can say this all the time.

Sometimes a company does not sound very good but it is still worth visiting it to see what they do and how they do it. There is always time to reject projects or customers. I try to avoid companies where everybody's goal is to make money. Money is a means and not a goal in itself.

Let's be more specific. Would you work for an animal factory? Would you work for a company producing equipment for animal factories?
I might visit some of those companies to meet people before saying no beforehand. The list of undesired industries or projects would be big man ;-) But yeah, I do not work for money, money is a secondary effect.

Did you ever reject a customer or an actual project based on your values?
When you leave a company, most of the times the reason is that you feel you have different values and principles, a different vision. Otherwise you stay. I do not want to write any company names in here.

BatCat from Carlos' cat shelterWhat would be customers and projects that you consider important and have an impact on society and the problems we discussed earlier?
As a software developer, your colleagues are the ones who make projects interesting and fun. People are the key. I recently saw that the guys from Avaaz were recruiting. They work for a better world and I signed many of their petitions, but I have enough years of experience not be enticed for their job offer because I do not know anyone working there, I do not know about their values as software developers.

Years ago I used to work as the "computer man for everything" in a little charity shop and I it was not nice at all because time and energy was spent discussing irrelevant stuff, fighting with egos, with no impact at all in the final goal. It is a romantic idea to think that a software project might have a positive impact on the world. Sometimes it does but in my experience the values and principles of the team are what really matter. I search for a combination of projects with less negative impact on the world, whose team members are people I know and who are aligned with my values and principles as a professional.

For example, one of my current customers is a car importer and dealer. The cars they sell need oil to run, they are just regular cars. It does not sound like a company that helps the planet. But I do have a gasoline car as well and so far I could not find a way to live without it. I try to minimise gasoline waste and hopefully someday I will not need the car or I will at least have a solar car. But it would be silly to say "I don’t want to work for a car company" while using a car myself. Moreover, the employees have a great sense of collaboration. People help one another in the office, the company really cares about the employees and people are happy working in that environment. I had the chance to meet the CEO several times for lunch and he has told me that they donate almost half a million Euro every year to local NGO's. I have shared my concern for the climate change and the peak oil with him. These guys have a lot of potential to change things for better so I see the job as an opportunity to help influential people awake awareness apart from growing myself as a professional.

I have been brief but if people read the answers and write comments or further questions I will go deeper into the subject, I just need some feedback to do so ;-)

Credits
Thank you Carlos for taking the time to answer my questions. This has become a long article but I believe it is worth it. I really enjoyed discussing these important topics with you and appreciate that you took the time to share. Thank you very much and I wish you all the best for your projects in the future.

16 November 2015

Interview Sebastian Göttschkes

Following up on my previous post on meaningful work I want to further dive into the topic started there. As most of our time is spent on regular work, i.e. in our day job, I am especially curious about the impact we could have there. For me as software developer my day job is to sit in a chair and press keys on my keyboard in weird sequences almost all day. And by doing that, what can I do about the important issues of preserving the environment or cruelty to animals to name just two examples? Is it possible for my work to help these issues? Is it possible to make a difference by just working on the "right" things? What are these "right" things?

To get some answers, I decided to use a more structured approach. This topic is complicated, probably highly philosophical, and I do not expect to get good answers by analysis alone. I think we need to start a dialogue with one another to discuss and define what our responsibilities might be. I created a list of questions and started asking some of my peers, i.e. developers with solid experience of working in our industry. I have collected their answers and will mark their ideas and opinions either by quoting or typing in italics to separate from my own interpretations and errors.

Introducing Sebastian
Sebastian Göttschkes was the first to accept my invitation. Sebastian is a developer living in Vienna. He is interested in programming since he was a kid and started coding when he volunteered for programming classes in school. After finishing his studies at university he has been working as professional software developer for ten years. He likes to build stuff. Read his blog or find him on Twitter to get in touch with him.

Vegetarian food or notBeing Vegan
I noticed that Sebastian was vegan and asked him about it. Some time ago he had started to eat less meat due to health problems. Being concerned about what to eat and what to avoid, he thought more about food in general which led him becoming vegan for ethical reasons. He said that being vegan is important to him because as developed being he does not want to treat other beings badly. Cruelty and killing is not necessary for his survival. It is disappointing how we, human beings treat other beings. We should be able to do better.

Other Topics of Concern
Sebastian is also very concerned how we treat one another as individuals and as society on the whole. The current refugee crisis in Europe is a perfect example. If people are starving we have to help them. We have to help first, there will be enough time for discussion later. Currently there are many discussions in the European Union regarding refugee quotas and refugees are forced to wait. Surely they need to be registered and their claims have to be verified, but that could come later. These people should not be treated like numbers on some form. Sebastian believes this to be the result of our capitalist ways. There are more and more areas where people and whole systems are reduced to numbers.

Challenges for Humanity
When I asked Sebastian about what he considered to be the biggest challenges for humanity he laughed. There are plenty. The environment is obviously very important. We need to fight climate change and forest deaths. We must not destroy our planet. Further politicians and governments need to work together smoothly to avoid wars and all the unrest caused on a global scale.

How to engage in these topics?
Sebastian likes to talk about being vegan but he makes sure not to have a reproachful attitude. People are open for the discussion when they are not attacked or forced a bad conscience. Even a single meal without meat each week makes a difference. In the current refugee crisis in Vienna he keeps donating goods and actively supports the NGOs helping refugees around Westbahnhof where he lives. He has also organised charity concerts in the past.

My first questions were just introducing Sebastian and setting the stage. The really interesting question was about the impact of our regular work. I asked him several questions regarding impact, choice of work, choice of project, customer or industry and so on.

Is it possible to have impact on your day job?
There is the social entrepreneurship movement which has similar goals. Today almost every product or service needs supporting technology so we developers have many options. As our technology is everywhere we should be able to find jobs with more impact in general. But the problem is to find suitable companies and keep the standard of living at the same time. Also it is more difficult for people with a high degree of specialisation. Sebastian looks for companies who help people in some way. Even regular companies can do that, it is not necessary to work for NGOs exclusively. But it is difficult to recognise such companies. You have to check each project you work on individually. Sometimes you cannot tell up front at all.

Poppyseeds Mom And DadChoice of Industry
While software development is an industry on its own, most of us work to support another industry, e.g. finance, insurance or energy, although often we do not take this choice deliberately. Sebastian does not believe that the choice of industry matters. It is more important which company you work for and even more so which project you actually work on. While the finance sector has a bad reputation, supporting micro loans to help poor people is a good thing, unless the project's goal is to rip off everybody and just make more money. In general Sebastian recommends to stay away from finance and overly capitalist industries, because of their problems discussed earlier.

Choice Based on Values
On the other hand it is not easy to find a company according to one's values. We cannot be too particular because we need the money. As we are part of the system, i.e. our society, our current way of life, our capitalist world, we have to live by its rules. All I can do is to decide according my values inside my possibilities and choose from the options I have. But the system is complex and hard to understand. There is much indirection and it keeps getting more and more indirect. For example some things we consume are not made locally. And even if we know where something was made, we do not know where its raw materials came from. It is not unusual for raw materials to travel halfway around the world. It is impossible to think about all the problems and implications so they are usually ignored.

Choice of Companies
I was not satisfied by Sebastian's answers and continued asking because I wanted to explore his values and decision process more. For example I asked him if he would work for a butcher? He denied, but he would work for a company working for a butcher. In fact he has worked on some platform of local advertisements where butchers would be able to advertise their goods as well. I kept asking and asking, but Sebastian did not have a list of undesired customers. Sebastian prefers small companies. In general small companies are less "evil" than larger ones because they have less power and cannot ignore laws. Small companies have other goals and there are still people in charge who have a conscience.

Projects are especially interesting to Sebastian when they try to change people's way of thinking without blaming. For example he mentioned TREEDAY, a gamification of checking CO2 footprints, or WienRadeltZurArbeit where you win prices by collecting miles of going to work by bike. These initiatives are great because by making people think they have more impact than by just supporting people who already care for the topic.

Conclusion
I enjoyed talking to Sebastian and it took us around 90 minutes to cover all questions. The conclusion is that there is neither black nor white. What should we do if we write software that - in the end - destroys 100, 1000 or 10000 jobs? Maybe there is no way we can do the "right" thing - either we do not know all its implications or we have no choice. But to ignore the situation is definitely wrong. We need to address the issues, preferably in a positive, improving manner.

Credits
Thank you Sebastian for sharing your values and ideas with us. I am glad you took the time and I appreciate the interesting discussions we had. Thank you very much.

6 November 2015

Bank-OCR Kata in Scheme

Why is it when I wanted to do something completely different from work to relax - I end doing code katas in Scheme? (Last week on Twitter.)

SoCraTes Belgium
Two weeks ago I attended SoCraTes Belgium, the Belgian branch of the Software Craftsmanship and Testing family of (un-)conferences. Being an un-conference the complete agenda of both days was created by the participants. Early during the first day, a participant proposed a session to work through the exercises of the well known SICP book using the Scheme programming language. We worked through the exercises as a mob and it was a lot of fun so another session was scheduled for afternoon. Time and again Scheme sessions were scheduled outside the official agenda. In the end I had spent several hours playing with Scheme and I really enjoyed it.

Why Scheme?
Later I started doing code katas in Scheme, which surprised me, see my initial quote. I do not know why I chose Scheme. There were other programming languages I had planned to learn. Maybe, as my friend Thomas remarked, I chose Scheme because it is seldom used in commercial projects, at least in my surroundings. As it is far away from anything I might touch during my regular work, it is easier to have fun with.

Unit Testing
Nevertheless I wanted to follow my typical development process, using TDD and looked for recommended unit testing frameworks. As minimalism is in the spirit of Scheme, I went with the Scheme Unit outlined on Cunningham's Wiki,
(define (report-error msg)
    (error (string-append "AssertionError: " msg)))

(define (assert msg b)
    (if (not b)
        (report-error msg)))
and added assertions whenever I needed them.

Banking the LightBank OCR
Today I want to share my take on the Bank OCR Kata using Scheme. The Bank OCR assignment is to parse files containing lists of numbers written in LCD style using only pipes and underscores. Each number has nine digits, all of which are in the range one to nine. I knew the Bank OCR kata and had done it before using different languages like Java or C#. I was familiar with the domain which allowed me to focus on functional programming in Scheme.

Outside-In
In the past I used the Bank OCR kata especially to practise the outside-in way of development. Using this approach you build the system from the "outside-in", following the user interaction through all the parts of the system. You start with the interactions and collaborators up-front, especially those at the top level and create fake implementations or mock necessary dependencies. With every finished component, you move to the previously mocked collaborators and implement them. See Emily Bache's article on Outside-In development for a discussion of Outside-In both with London school and classic TDD.

Outside-In vs. Functional?
So whenever I did the Bank OCR kata I tried to follow strict outside-in. But this time I wondered if the outside-in approach was feasible when using a functional language? As far as I knew the typical way of functional programming was to compose small functions to more powerful ones, which naturally lent itself to the bottom-up or classic approach. I was curious how these two would match, if at all.

The Guiding Test
Following Double Loop TDD I started with failing guiding test to parse a single number containing all possible digits,
(define all-digits (list "    _  _     _  _  _  _  _ "
                         "  | _| _||_||_ |_   ||_||_|"
                         "  ||_  _|  | _||_|  ||_| _|"
                         "                           "))

(assert-list= string=?
              "should parse a single number"
              (list "123456789")
              (bank-ocr all-digits))
which expected that bank-ocr(all-digits) yielded ["123456789"].

How to solve the problem?
Then I started to TDD the top level function bank-ocr.
(assert-list= string=?
              "should return empty list on empty input"
              (list)
              (bank-ocr (list)))
which created the initial function. Then I tested for a non-trivial case
(assert-list= string=?
              "not sure about the name of the test yet"
              (list "123456789")
              (bank-ocr all-digits))
Big Ben (London School TDD is Outside-In but Classic TDD can be as well.)But how would I solve the problem? I had no idea. Nevertheless, the first step of the algorithm was to split the input into groups of four lines each and another function, e.g. parse-line, would parse the line then. Following outside-in I defined a stub for parse-line and changed bank-ocr to call it.
;; stub
(define (parse-line ocr-line)
    "123456789")

(define (bank-ocr ocr-lines)
    (if (null? ocr-lines)
        '()
        (list (parse-line ocr-lines))))
The next test forced me to implement the recursion to call parse-line for each group of four lines.
(assert-list= string=?
              "should parse each group of lines"
              (list "123456789" "123456789")
              (bank-ocr (append all-digits all-digits)))

(define (bank-ocr ocr-lines)
    (if (null? ocr-lines)
        '()
        (append (list (parse-line (take ocr-lines 3)))
                (bank-ocr (drop ocr-lines 4)))))
Moving "in"
bank-ocr was complete but the guiding test told me that there was no parse-line function in the production code and I knew where to go next.
(define ocr-digit-one (list "   "
                            "  |"
                            "  |"))

;; should split and parse first digit
(assert-string= "1" (parse-line ocr-digit-one))
Parsing a line would need to split the line into digits and then parse each digit. I added another two stubbed functions and built parse-line to get the test green.
;; stub
(define (split-digits ocr-line)
    ocr-digit-one)

;; stub
(define (parse-digits ocr-digits)
    ;; use assert-list= to check that ocr-digits is ocr-digit-one
    "1")

(define (parse-line ocr-line)
    (parse-digits (split-digits ocr-line)))
Parenthesis(Actually I was cheating here: I should have checked that the output of split-digits was fed into parse-digits. Nobody is perfect and I will atone for that later, but let's move on for now.) Again a function was finished but I had invented two new collaborating functions to do so.

Another step "outside-in"
Next came testing split-digits to split the three lines into nine digits containing three lines of three characters each.
(define two-ocr-digit-one (list "      "
                                "  |  |"
                                "  |  |"))

;; missing test "should split empty line into no digits"

(assert-list= (list-equals-for string=?)
              "should split single digit"
              (list ocr-digit-one)
              (split-digits ocr-digit-one))

(assert-list= (list-equals-for string=?)
              "should split two digits"
              (list ocr-digit-one ocr-digit-one)
              (split-digits two-ocr-digit-one))

(define (split-digits ocr-line)
    (define (take-3-chars s)
        (substring s 0 3))
    (define (drop-3-chars s)
        (substring s 3 (string-length s)))
    (if (zero? (string-length(car ocr-line)))
        '()
        (append (list (map take-3-chars ocr-line))
                (split-digits (map drop-3-chars ocr-line)))))
I did not start with the degenerate test-case that an empty line, a list of three empty strings, should be split into an empty list of digits. I did not add this test because it did not feel right from the solution's perspective. split-digits would always be called with a full line, i.e. three strings of 27 characters each. But as soon as I tried to get the recursion for the second digit right (as forced by the second test), I struggled because I had to figure out the recursion and termination condition at the same time.

ParenthesisA Functional TDD "Pattern"
There is some obvious pattern here. Consider we need a function that operates on a list of inputs and processing of a single input is either simple or can be delegated to another function. Then we need three tests to drive the implementation of that function:
  1. An empty input should produce an empty output, where empty is defined differently for input and output. This drives the creation of the function header and the body of the (future) termination condition.
  2. A single input should produce a single output. This drives the conditional for the termination condition and the processing of a single input. The processing must be simple otherwise the step is too large.
  3. A list of inputs should produce a list of outputs. This test drives the splitting of the first input from the remaining ones for the recursion.

Coming to an end
The second missing function was parse-digits. It was supposed to work on a list of digits, to parse each of them and return the list of parsed digits so I used my three steps from above.
;; should parse empty digits as empty string
(assert-string= "" (parse-digits (list)))

;; stub
(define (parse-digit ocr-digit)
    "1")

;; test for parsing a single digit omitted

;; should parse digits into numbers for each digit
(assert-string= "111"
                (parse-digits (list ocr-digit-one ocr-digit-one ocr-digit-one)))

(define (parse-digits ocr-digits)
    (if (null? ocr-digits)
        ""
        (string-append (parse-digit (car ocr-digits))
                       (parse-digits (cdr ocr-digits)))))
I skipped step two of my list above and omitted the test for parsing a single digit because I felt confident and delegated the actual parsing of a single digit to another function. parse-digit was the final function and compared a given digit against stored digits to determine the number.
(assert-string= "should parse one"
                (parse-digit ocr-digit-one))

(assert-string= "should parse two"
                (parse-digit ocr-digit-two))

;; etc.

(define (parse-digit ocr-digit)
    (let ((digit (apply string-append ocr-digit)))
        (cond ((string=? digit (string-append "   "
                                              "  |"
                                              "  |")) "1")
        ;; etc.
    )
  )
)
I did not push the final solution of parse-digit. Probably I could remove the duplication using some functional magic, but I had spent some hours already on coding, it was late and I was tired. The full source is available here.

Conclusion
Using Scheme was fun. I had to look up library functions a lot and spent some time on Stackoverflow, but I felt progress all the time. I committed on red, green and refactor, on average each ten minutes, and I was never stuck. The minimalist unit testing function gave me enough feedback to move forward quickly. I did not bother for expressive assertion messages because my steps were small and I never looked at the failures anyway - I knew which test would fail or pass next. Solving Bank OCR was straight forward, probably due to the nature of the assignment. Also knowing the solution - which is not the implementation - helped me a lot and I focused almost entirely on Scheme and the functional aspect.

I was able to do outside-in TDD by stubbing future functions. The stubbing was crude, I just redefined the functions in the test code. I was unhappy with this approach but it worked and I lacked in-depth knowledge of Scheme to come up with a proper way to stub functions. It seemed wrong to pass functions around according to Dependency Inversion Principle, because the called functions were low-level internals and no peer collaborators. In a way I followed Ralf Westphal's approach of True Stepwise Refinement, where he stubbed private functions. In the end I thought about deleting (some) unit tests of the internal functions but did not have any conclusive ideas how to do so.

P.S. for Claus
We had agreed to code together and do some serious product development, and again I spent time on weird ideas like Scheme or Assembly. I am sorry.

27 October 2015

Work with Meaning

Years ago I worked for the IT department of an Austrian bank. I contributed to an application built to approve loans automatically, including some fraud detection. Surely the application made perfect sense for the bank, as it had already taken 50 person years to develop it. But my work did not feel meaningful. I believed it was due to the virtual nature of the product. (Most banking products are virtual, nothing real is produced. Further virtual products allow for the most contrived processes which is why I believe finance to be a horrible industry to work for. But that is not the point here.)

Like it Matters?So my work had no meaning, it did make sense. It was neither important nor did it matter. It did not feel real. Of course it did make sense, but not to me. It was just a feeling, soon forgotten over the excitement of a new project. What does it mean to be meaningful, to be important, to matter? Using the definitions from dictionaries the meaning is the end, purpose, or significance of something. Being important says it is of consequence or significance. Consequence again is defined as importance or significance - I am going in circles here. I use the words meaning, importance and it matters in the same way. I am still looking for the right words to use as English is not my native language.

We can argue for hours and still not agree on a definition of meaningful work. You are paid for your work, so it matters. People spend money on the product or service you provide, so it must be important to them. Maybe you tackle real problems and create new and innovative solutions, which surely have meaning. To describe what I mean, I refer to Alf Rehn's presentation about How To Save Innovation From Itself, given during Craft Conference this year. It is the most important presentation I have seen in 2015. I will not summarise it, just watch it now. (I definitely recommend watching it. Besides talking about important topics, Alf's sarcasm is hilarious. I laughed and cried at the same time.) Kasia Mrowca shared her summary of his presentation and Linda Saukko-Rauta published her sketch notes from the same talk given in 2013.

I am still not sure of my definition of "meaning / importance / it matters", but it includes social factors and much responsibility, maybe a personal social responsibility similar to Corporate social responsibility. I will not talk about your personal responsibilities, which are your own decision, but I believe that we as software delivery professionals have a professional responsibility because our software is everywhere and heavily impacts society.

A similar opinion was expressed by Martin Fowler during his lightning talk Not Just Code Monkeys at Agile 2014 and OOP. Martin emphasised three points for us developers: Sustainable Business, Professional Software Excellence and Social Justice. While we (developers) are concerned with software excellence a lot, I have hardly seen people touching the other two areas. Even articles discussing ethics, e.g. Mike Cavaliere's Ethics for Freelance Programmers mainly talk about customer relationship and avoid the real issue of social responsibility.

Witch's HatMartin finished his talk with the concrete call to care actively for diversity and privacy. The recent story about VW showed another aspect: fraud. Robert Martin said that the engineers that implemented the cheating code failed in their professional duty. Even if the engineers did not know, which is unlikely, they need to take some responsibility for their actions.

So why did they do it? Maybe they were afraid to lose their job. While getting fired is not appealing, I believe it is not a real problem. The demand for our skills is huge and there are always more offers than we can take. But I agree that changing jobs may be inconvenient. Then there is thought of replaceability which might be not as important as we think. I guess that they did not care. There was a problem and the engineers found a solution. The technical challenge of cheating the test was interesting and possible. So it was done. I know developers who are more interested in the solving of problems, the technical challenge and the tools than in the implications of their work. I do not blame them. I do not know if I had acted differently.

I find the whole topic difficult. Structuring my thoughts (by writing this post) helped but I still have many questions. Obviously there are many things we need to care for, e.g. the environment, extreme poverty, waste of resources, Human Rights, cruelty to animals and much more. What should we actually care for? What can we do about it and which impact could we have as software professionals? I plan to explore these questions in a series of future articles. Let's see what comes up during these discussions.

14 October 2015

Journeyman Pairing Sessions

This is the third and last part of my series about my Journeyman Tour two years ago. In how to Journeyman Tour I summed up all facts and advice regarding planning such a tour. Then I described what I learned by going on a Journeyman Tour. Today I want to share more about the actual pair programming sessions. During the tour I already summarised some findings, e.g. I wrote about discussing expectations with your pairing partner up front and bringing a keyboard for all languages used in the area.

The Very First Session
When I started my tour I did not know how it would work out. I was uncertain how others would react and afraid to screw up. It helped me that the very first session took place in my usual environment. Raphael and I met in a co-working space I had been before. I knew the place and how to get there. Also we worked in Java, the language I had been using almost exclusively until my tour. By using my main language I was not bothered by the language and its tools. Third we started a new project from scratch, starting with a detailed introductory discussion. There was no old code I had to understand. And finally Raphael and I shared the same mindset. It was clear from the beginning that we would do TDD and create high quality code that he needed for his games. The only thing that was new for me during our pair programming was being on tour and pairing with a stranger. It was the perfect start. Probably I was just lucky, but I recommend starting your tour like that. Look for someone you know, working in a place you know, using a programming language you know. This might be a colleague from a previous engagement or someone from your favourite meetup community who agrees with you on most things.

Warm-up
When pairing with a stranger for the first time, I needed some time to establish a rapport. During my tour it took between a few pomodoros (two hours) up to the while day (eight hours) to get in sync with my partner and understand the domain to an extend that I was able to contribute. On the second day we usually worked much better. Due to this warm-up I recommend sessions of at least two full days with each person - assuming that you are looking for real pair programming during your tour.

Interruptions
Most of my pairing partners had blocked their calendar and made sure they were available the whole day without interruptions. Many did not even check their email all day. Some had even organised a meeting room so we could work on our own. Unfortunately not all people I visited knew how to "behave well". Working with heavy task switchers was really difficult. As the guest I did not complain about task switches, but when the interruptions became too many or too long, I went back discussing our expectations of the pairing. Few young developers had to be reminded to stay focused on the task at hand.

Expectation Driven Pairing (by Paul Rohorzka)
Tasks
In the introduction of my Code Cop Tour I explained my conditions as following: The only condition is that we will pair program. It should be a quiet time without meetings where you plan development activities on the mainline of delivery, e.g. writing code, writing tests or improve your build system. Obviously not all kinds of work, even on the mainline of delivery, were useful to me. For example researching or spiking, where we both had no clue how to continue, did not work well. And I hated spending two days of my tour looking for a single bug, tracing execution through auditing records in the database. While I believe that pair programming might be useful for debugging in general, I did not have the relevant experience to help my pair here. I recommend rejecting such work for your visit, or at least discuss the problems with your pairing partner up front.

Taking Notes
I brought a large notebook with me to record all interesting things. I wrote down the full names of my pairing partners, their expectations and any learnings during the sessions. I kept notes of each session retrospective and a kind of personal diary. I glued in business cards, Post-it notes and all stickers I collected during my tour. In the beginning I used a cheap pen, which made my hand hurt after some time. I had not practised my hand writing for almost 20 years. I fall back to my fountain-pen, which created a mess of ink now and then, but was a better writing device by far. I wrote a total of 55 pages A4, two pages per pair programming session on average. For road thoughts I used the standard voice recorder of my mobile phone. While it worked I do not recommend using it during driving, especially when going fast on the highway.

Known Or Unknown Pairing Partners
In the previous blog posts I quoted some other Journeymen and named their advice according their names. While these rules make sense for me, you may chose to ignore them. The last of these "rules" is Samir's rule: If I do not know you, I will not pair with you. What Samir meant was to meet before the session, to get to know the partner and make sure that both get something out of pairing. This is definitely a way to reduce uncertainty and avoid surprises. Checking future pairing partners helps aligning your expectations with potential learnings. On the other hand - depending on your learning goal (see Daniel's rule, you need a learning goal) - you might want to pair only with people you do not know because it gives you more coverage.

That ends my notes. If you plan to go on tour yourself and have some questions I did not discuss, do not hesitate to contact me. And when you have been on tour, I would love to talk about how it went and compare our experiences. Please get in touch with me!

30 September 2015

New Classes in Java 8

Jumping Spider #1Java (SE) 8 was released on the 18th of March 2014. Unlike previous releases it did not have a code name like Tiger or Dolphin. Spider was proposed as unofficial name on Code Ranch because of "8 legs, and a strong association with webs." It was an exciting release with huge changes, with probably similar or even larger impact than Java 5, which brought Generics. The new features (and the ones that did not make it into Java 8 yet) show that Java is on its way to be a modern and productive programming language.

Numbers
The rt.jar and other JARs located in the lib folder of the JRE contain many classes. For each new release I take a look at the new (public) classes. The list of new classes complements the list of new language features. Java 8 adds more than 1000 public classes, mainly in the packages javafx.*. Without JavaFX there are 251 added classes, similar to Java 7.

Java Classes by JDK/JSE
Lambdas and Streams
The major library changes are to support Lambda Expressions and the related Stream API. The new java.util.function package contains all types of possible function types.
java.lang.FunctionalInterface

java.lang.invoke.LambdaConversionException
java.lang.invoke.LambdaMetafactory
java.lang.invoke.MethodHandleInfo
java.lang.invoke.SerializedLambda

java.util.function.
BiFunction                Function                   Predicate
ToDoubleBiFunction        DoubleFunction             BiPredicate
ToIntBiFunction           IntFunction                DoublePredicate
ToLongBiFunction          LongFunction               IntPredicate
                                                     LongPredicate
BinaryOperator            DoubleToIntFunction
DoubleBinaryOperator      DoubleToLongFunction       Supplier
IntBinaryOperator         IntToDoubleFunction        BooleanSupplier
LongBinaryOperator        IntToLongFunction          DoubleSupplier
                          LongToDoubleFunction       IntSupplier
Consumer                  LongToIntFunction          LongSupplier
BiConsumer                ToDoubleFunction
DoubleConsumer            ToIntFunction              UnaryOperator
IntConsumer               ToLongFunction             DoubleUnaryOperator
LongConsumer                                         IntUnaryOperator
ObjDoubleConsumer                                    LongUnaryOperator
ObjIntConsumer
ObjLongConsumer
The Streams are in the package java.util.stream,
Stream
Stream$Builder
StreamSupport
BaseStream
DoubleStream
DoubleStream$Builder
IntStream
IntStream$Builder
LongStream
LongStream$Builder

Collector
Collector$Characteristics
Collectors
as well as some additions to java.util for splitting and collecting.
java.util.DoubleSummaryStatistics
java.util.IntSummaryStatistics
java.util.LongSummaryStatistics

java.util.Spliterator
java.util.Spliterator$OfDouble
java.util.Spliterator$OfInt
java.util.Spliterator$OfLong
java.util.Spliterator$OfPrimitive
java.util.Spliterators
java.util.Spliterators$AbstractDoubleSpliterator
java.util.Spliterators$AbstractIntSpliterator
java.util.Spliterators$AbstractLongSpliterator
java.util.Spliterators$AbstractSpliterator
java.util.SplittableRandom

java.util.StringJoiner
Java 8 Date and Time API
The next big change is the new date and time API. It contains a lot of new classes to model and use dates and time in your code.
java.time.Clock                     ...format.DateTimeFormatter
java.time.DateTimeException         ...format.DateTimeFormatterBuilder
java.time.DayOfWeek                 ...format.DateTimeParseException
java.time.Duration                  ...format.DecimalStyle
java.time.Instant                   ...format.FormatStyle
java.time.LocalDate                 ...format.ResolverStyle
java.time.LocalDateTime             ...format.SignStyle
java.time.LocalTime                 ...format.TextStyle
java.time.Month
java.time.MonthDay                  ...temporal.ChronoField
java.time.OffsetDateTime            ...temporal.ChronoUnit
java.time.OffsetTime                ...temporal.IsoFields
java.time.Period                    ...temporal.JulianFields
java.time.Year                      ...temporal.Temporal
java.time.YearMonth                 ...temporal.TemporalAccessor
java.time.ZonedDateTime             ...temporal.TemporalAdjuster
java.time.ZoneId                    ...temporal.TemporalAdjusters
java.time.ZoneOffset                ...temporal.TemporalAmount
                                    ...temporal.TemporalField
...chrono.AbstractChronology        ...temporal.TemporalQueries
...chrono.ChronoLocalDate           ...temporal.TemporalQuery
...chrono.ChronoLocalDateTime       ...temporal.TemporalUnit
...chrono.Chronology                ...temporal.UnsupportedTemporalTypeException
...chrono.ChronoPeriod              ...temporal.ValueRange
...chrono.ChronoZonedDateTime       ...temporal.WeekFields
...chrono.Era
...chrono.HijrahChronology          ...zone.ZoneOffsetTransition
...chrono.HijrahDate                ...zone.ZoneOffsetTransitionRule
...chrono.HijrahEra                 ...zone.ZoneOffsetTransitionRule$TimeDefinition
...chrono.IsoChronology             ...zone.ZoneRules
...chrono.IsoEra                    ...zone.ZoneRulesException
...chrono.JapaneseChronology        ...zone.ZoneRulesProvider
...chrono.JapaneseDate
...chrono.JapaneseEra
...chrono.MinguoChronology
...chrono.MinguoDate
...chrono.MinguoEra
...chrono.ThaiBuddhistChronology
...chrono.ThaiBuddhistDate
...chrono.ThaiBuddhistEra
And Other Classes
There are several new classes all over the place. The most notable are:
  • Reflection for Type Annotations.
  • Finally a Base 64 encoder and decoder.
  • Optional.
  • CompletableFuture and StampedLock.
java.lang.annotation.Native                      java.io.UncheckedIOException
java.lang.annotation.Repeatable
                                                 java.net.URLPermission
java.lang.reflect.AnnotatedArrayType
java.lang.reflect.AnnotatedParameterizedType     java.sql.DriverAction
java.lang.reflect.AnnotatedType                  java.sql.JDBCType
java.lang.reflect.AnnotatedTypeVariable          java.sql.SQLType
java.lang.reflect.AnnotatedWildcardType
java.lang.reflect.Executable                     java.util.Base64
java.lang.reflect.MalformedParametersException   java.util.Base64$Decoder
java.lang.reflect.Parameter                      java.util.Base64$Encoder

java.security.DomainLoadStoreParameter           java.util.Calendar$Builder
java.security.KeyStore$Entry$Attribute           java.util.Locale$FilteringMode
java.security.PKCS12Attribute                    java.util.Locale$LanguageRange
java.security.spec.DSAGenParameterSpec
                                                 java.util.Optional
java.security.cert.CertPathChecker               java.util.OptionalDouble
java.security.cert.PKIXRevocationChecker         java.util.OptionalInt
java.security.cert.PKIXRevocationChecker$Option  java.util.OptionalLong

java.util.spi.CalendarDataProvider               java.util.PrimitiveIterator
java.util.spi.CalendarNameProvider               java.util.PrimitiveIterator$OfDouble
java.util.spi.ResourceBundleControlProvider      java.util.PrimitiveIterator$OfInt
                                                 java.util.PrimitiveIterator$OfLong
java.util.concurrent.atomic.DoubleAccumulator
java.util.concurrent.atomic.DoubleAdder
java.util.concurrent.atomic.LongAccumulator
java.util.concurrent.atomic.LongAdder

java.util.concurrent.CompletableFuture
java.util.concurrent.CompletableFuture$AsynchronousCompletionTask
java.util.concurrent.CompletionException
java.util.concurrent.CompletionStage
java.util.concurrent.ConcurrentHashMap$KeySetView
java.util.concurrent.CountedCompleter

java.util.concurrent.locks.StampedLock
Additional changes cover additions to UI capabilities - JavaFX is now part of the JRE. The Java Language Model has been updated (javax.lang.model) and Rhino has been replaced by Nashorn (package jdk.nashorn). There are more changes, e.g. stronger security algorithms, but these do not show up as new classes.

Summary
Java 8 brings big changes for the language, finally adding closures to Java. This is as ground breaking as Java 5's Generics. Lambdas and Streams will change the way we write Java and allow a more functional style in our code.

You can download the complete list of all classes available in Java 8. Each class name is annotated with [release] showing the release it first appeared, e.g. java.lang.annotation.Annotation [5]. Package access classes are marked by a lowercase p, e.g. java.lang.CharacterName [7p].