Software developer blog

The scary thing about being a developer

The other day we watched the movie Sully with my wife. First of all, it's a great movie, you should watch it, here is the trailer for you:

 

Warning: there are spoilers ahead from the movie, but if you know the original story from the news, then you won't hear anything that you didn't know before.

In the movie there is a pivotal moment as the air-traffic controller realizes that he lost US Airways Flight 1549 over the Hudson river. At first he does not want to believe what he hears as captain Chesley Sullenberger says "Can't do it, we're gonna be in the Hudson" before the radio goes silent. Given the horrible track record of jets breaking to smithereens during a water landing, he assumed that the 155 souls he lost are now heading towards imminent death.

After leaving the theatre we discussed this scene at length with my wife. Here is the essence of where the discussion was heading:

screenshot-from-2016-09-13-223743

Click for larger image

@ //

Why I decided to run an online Lean Poker event

For those of you who haven't been following along, Lean Poker is a coding challenge where teams are developing simple poker playing bots. The catch is, that the bots start playing before people even started coding and keep playing all day long. The challenge is in delivering value quickly and continuously in small iterations so that your bot keeps staying ahead of other bots throughout the day. It's an extremely intense day with lot of excitement and a chance to learn how to deliver value faster.

Long story short: if you got interested gather some friends (like 2 to 4 of them) and join us on Saturday, 21st of May. Registration is open until the 18th.

The first Lean Poker event was over two years ago, and at the time I didn't anticipate that by now Lean Poker would be all over the map of Europe, let alone that we will have had events across several locations in Russia. In the coming week we will also have the first ever Lean Poker event in New Zealand. On the other hand it's not easy to set up these events abroad, and even more challenging when I can not travel to these locations. When people asked me when Lean Poker is coming to their town, the best advice I could give, is that they should organize one themselves.

Events around the world

So far we had over 2 dozen events, most of them in Europe

Ever since the first event participants kept suggesting that I should organize events online, but I was a bit skeptical. My fear was that I wouldn't be able to give as much feedback, since I can not talk to teams directly during coding sessions. However as Lean Poker matured I found myself talking less to the teams during coding sessions. Instead I browse the code they commit and reflect on that during the retrospectives. With that in mind I decided to give it a try, and see if it works like that. Maybe it will even help with raising awareness for offline events.

Participants at a Lean Poker event

Participants at a Lean Poker event

@ //

The Bowling Game Kata with commentary

I have just released a code cast in which I do Bob Martins version of the bowling game kata in php, but take it further with a refactoring.

Web app crash course (Part 4)

In the previous part we have built a very simple chat application, but it stored messages in memory. Every time it was restarted, all messages were gone forever. In this part of the series we will look at MongoDB, a document database. There are many other database technologies, some of them are more frequently used than MongoDB, but for our purposes it is the best choice.

If you haven't read the previous parts, click here.

Web app crash course (Part 3)

In the first two parts we have examined how to create web pages using Sinatra and Mustache templates. In both cases we fed a small amount of data through the url, and then we returned something that was based on that data. However having to type input data into a url is not necessarily a good user experience, especially if we wish to send a larger chunk of data. In this part we will learn how to send user inputs properly.

Another problem we haven't addressed yet, is storing that data, so that we can show it later, and show it to other users, but that will be the topic of the 4th and final part of this series.

If you haven't read the previous parts, click here.

Web app crash course (Part 2)

In the previous part we dipped our toe into git, bundler, sinatra and mustache. In this part we will first explore how to add some interesting logic to our web application, while keeping that logic unaware of the very existence of the web. In fact we will go as far as to create a web app and a command line application that will do the same thing through different user interfaces. In the process of creating these applications we will also explore the realm of test driven development, a practice that can lead us to better software.

If you haven't read the previous part, click here.

Web app crash course (Part 1)

This is a beginner tutorial that shows you how to build a Ruby app using a certain set of technologies that I prefer to use. It will not make you a web developer right away, but it will show you the basics, and serve as a starting point for further reading. I assume that you already have basic knowledge ruby, HTML and CSS, or at least have read a tutorial that introduced you to them. If not, visit Codecademy. Another assumption I make, is that you are using Ubuntu (or possibly another Debian derivative) as an operating system. If not, you can download it free, and install it next to your existing operating system.

The approach I have taken is to show you most of the tools at once at a very low level, so that first you get the big picture, and then we will drill deeper later. This may be overwhelming at first, but bare with me, slowly everything will unfold.

By the end of the first part we will have a web page, that can say hello. Not much, but it's not the the goal we reach that will be of importance, but the way we get there. I will show you the tools developers use from day to day. We will look at how we manage gems, the building blocks of software development. Then we will look at some of those gems, most importantly Sinatra, that is designed to respond with web pages for requests of web browsers. We will also take a quick look at git, a tool, that is designed to store source code, and keep several versions of it around, so we can go back, when something goes wrong. Finally we will look, at how you can make your page look better with a Mustache.

Dynamic vs. Static types: the final battle!

On the first day of NDC London 2013 there was a cage match between Gary Bernhardt of Destroy All Software - known for the WAT talk, and Useing You're Type's Good - and Jon Skeet of Google - known for his "C# in Depth" book, and his activity on Stack Overflow. They were discussing the topic of dynamic versus static typing.

Jon Skeet started by asking, what is it that Ruby can do and C# can't. In response Gary tried to show stuff that seems idiomatic in Ruby, and relies heavily on the dynamic nature of Ruby. Where the discussion went a bit south was when Jon Skeet tried to do all that in C#, and did the ugliest hacks just to make it work, while relying on C# features that are explicitly there to make C# a bit more similar to dynamically typed languages. All that proves to me, is that C# is trying really hard to be Ruby, and sucks at it. So what? Besides, we all know that it's not true at all.

I personally have changed back and forth between statically typed and dynamically typed languages quite a lot, and both hated and loved them every time I did. After a while I started to have very exciting discussions between the left and right side of my brain. (Rest assured: we are not schizophrenic, although the rest of this blog entry may suggest differently.) The odd thing is that both of me seem to have realized that the other has interesting points to support his beliefs, but neither of me is willing to give up any of it. Instead I kind of became the devil's advocate on the matter. (And that's really funny if you know what my last name - Ördög - means in Hungarian.) Whenever I meet anyone who seems to strongly believe in one or the other, I try my best to convince them that they are completely wrong and total idiots. So if you came here with the intention of finding out which one is better, here is a final clue: you won't! However I promise there is an interesting conclusion at the end.

Let's give a name to my brains, just to make the rest more fun: Steve is a firm believer in static typing, while Dan is this ruby / nodejs fan boy.

If you wish to read a transcript of the video click here.
@ //

How playing poker can teach you lean and continuous delivery

Last Saturday we had the first ever Lean Poker Tournament, an event much like a code retreat, but with a slightly different format and purpose. A lean poker tournament's aim is for participants to practice concepts related to lean start ups and continuous deployment. A poker team is a small group of developers (ideally 4 people forming 2 pairs) whose aim is to incrementally build a highly heuristic algorithm within a one day time frame that is just smart enough to beat the other robots. Professional poker robots are developed for years, so the purpose is definitely not to come up with something really smart, but to be the smartest among the current competitors. With this in mind teams can come up with simple to implement heuristics, examine their effect on game play during training rounds, and then improve their algorithm in a similar lean fashion.

The participants of the very first Lean Poker Tournament.

The participants of the very first Lean Poker Tournament.

@ //

SQL on steroids

Few weeks ago we held an internal Coderetreat at Emarsys for all programmers within the company. When the business intelligence team heard about it they started to joke around, that they should drop by and implement Conway's Game of Life in SQL. I'm not much of an SQL wizard, but I rose to the challenge. First I tried it in MySQL, since that's the dialect I have the most experience with:

CREATE TABLE generations (`id` INT UNSIGNED, `x` BIGINT, `y` BIGINT);
INSERT INTO generations VALUES (0, 0, -1), (0, 1, 0), (0, -1, 1), (0, 0, 1), (0, 1, 1);
 
CREATE TABLE offsets (`x` BIGINT, `y` BIGINT);
INSERT INTO offsets VALUES (-1,-1),(-1, 0),(-1,1),(0,-1),(0,0),(0,1),(1,-1),(1,0),(1,1);
 
INSERT INTO generations 
  SELECT g.id+1 id, g.x+o.x x, g.y+o.y y
    FROM generations g 
      INNER JOIN offsets o 
    WHERE g.id=(SELECT MAX(id) FROM generations)
    GROUP BY g.x+o.x, g.y+o.y
      HAVING (MAX(o.x=0 AND o.y=0) = 1 AND COUNT(1) - 1 BETWEEN 2 AND 3)
        OR (MAX(o.x=0 AND o.y=0) = 0 AND COUNT(1) = 3);

It works, and it's not even that complicated. First we join the last population with an offset table to generate the set of living cells and their neighbors. Grouping by the cell coordinates plus the offsets we can get all necessary information. The expression max(o.x=0 and o.y=0) is one exactly if the cell was alive in the previous generation, otherwise it's zero. Using that we can count the number of neighbors too: count(1)-max(o.x=0 and o.y=0). The having clause utilizes that knowledge to filter the grouped rows to contain only the cells in the next generation.

@ //
Next Page »