Author Archives: Zsolt

Learn More About the History of a Line with Git Blame

I’m working on an interesting refactoring project at the moment. Today, I found a strange part and I was really curious who and why implemented it, so I run git blame to learn more about it. Since I cannot share code from the customer’s repository, I’ll use the code from one of my repositories. Let’s say that the Munger.java is not working as it is supposed to work, and the test framework reports problem at line 9:

% git blame -L8,+3 src/main/java/com/zsoltfabok/blog/Munger.java
ab7e2b50 (Zsolt 2012-01-25 00:26:17 +0100  8)     public String munge(String word) {
e26fd52f (Zsolt 2012-02-07 20:45:30 +0100  9)       if (word.length() > 2) {
e26fd52f (Zsolt 2012-02-07 20:45:30 +0100 10)           return word;

It seems that the commit e26fd52f affected the line, let’ see what it is about:

% git show e26fd52f
commit e26fd52f2de26bb087f63fd70458e75e08540a02
Author: Zsolt Fabok
Date:   Tue Feb 7 20:45:30 2012 +0100
 
    Indentation fix
 
     public String munge(String word) {
-        if (word.length() < 2) {
-            return word;
-        } else {
-            StringBuilder temp = new StringBuilder(word);
-            temp = temp.reverse();
-            return switchFirstAndLastCharacters(temp).toString();
-        }
+      if (word.length() < 2) {
+          return word;
+      } else {
+        StringBuilder temp = new StringBuilder(word);
+        temp = temp.reverse();
+        return switchFirstAndLastCharacters(temp).toString();
+      }

This is what I saw during the day: someone did and irrelevant change – indentation fix in this case -, which prevents me from learning about the change which matters. Fortunately, git is the best version control system on the market, and provides some help in cases like this one. Read more »

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)

Software Passion Summit 2012, 10% Discount for Followers

I’m going to talk at Software Passion Summit 2012 about Measure and Manage Flow in practice and Achieving Maintenance Stabilisation with Agile, Kanban and Lean Thinking. I’ve just received a mail from the event organizer, and the good news is that the followers of the speakers who plan to attend the conference can get a 10 percent discount from the current price. If you would like to use this discount, please send me a private message. My contact information is on the right.

Cucumber JVM: Dependency Injection

Last time I finished with a failing test case which drove the development to a phase where I had to deal with a sentence instead of a word. The fix was not a big deal, but I ended up with a method in SimpleTextMunger which did three things:

// ...
public String execute(String sentence) {
  StringBuilder mungedSentence = new StringBuilder();
  for (String word : sentence.split(" ")) {
    mungedSentence.append(mungeAWord(word)).append(" ");
  }
  return mungedSentence.toString().trim();
}
 
private String mungeAWord(String word) {
  // ... prior content of the execute(String) method
}
  1. convert the sentence into words
  2. munge a word
  3. collect the munged words and create the new sentence

The first and the third one belong together because they work with a sentence, so I created two classes – SentenceHelper and Munger -, which are used by the SimpleTextMunger:

public class SimpleTextMunger {
  public String execute(String sentence) {
    SentenceHelper sentenceHelper = new SentenceHelper();
    Munger munger = new Munger();
 
    List words = sentenceHelper.split(sentence);
    for (int i = 0; i < words.size(); i++) {
      words.set(i, munger.munge(words.get(i)));
    }
    return sentenceHelper.join(words);
  }
}
 
class Munger {
  public String munge(String word) {
    // the same as before
  }
}
 
class SentenceHelper {
  public List split(String sentence) {
    // ...
  }
 
  public String join(List words) {
    // ...
  }
}

One day, I’d like to write unit tests, mocks – you know, the whole package -, so I must move those two new statements out of the scope of the execute method. Fortunately, I already have spring, so I’m just going to hack a solution together to see whether it works or not. I can do it now, because all the scenarios are green.

This is the best thing about scenarios and BDD, that I can do experimenting, spiking, refactoring or anything else without changing the test cases. Try to do it with unit tests: the moment you move something, the mocks will turn red and you have to do a lot of unnecessary work by fixing them. Read more »

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)

Increase Customer Satisfaction with the Kano Model

A couple of weeks ago I had a great discussion with one of my colleagues about the Kano model and how we could use it to make better deliveries. The model itself is a classification of features of a product based on customer needs and attributes. It was created by Professor Noriaki Kano (on the right) in the 1980s. Professor Kano defined three different feature categories: basic, performance and excitement, which are represented on the diagram below. The x-axis defines the effort put into the execution/implementation of a feature, and the y-axis defines the customer’s satisfaction after receiving the feature. In the software industry poor execution can result in a faulty or unusable product.

The presence of the features belonging to the basic category which presence has no positive effect on the customer’s satisfaction – bottom right corner -, but they are must have features, so their absence or poor quality causes huge dissatisfaction – bottom left corner. Let’s say we are about to create a web shop. It is a must have feature to make it possible for a customer to sign up to the site. Even if it’s the most sophisticated sign up feature, for the users, it is just a sign up feature, but without it or with a faulty one, they cannot use the site, so they’ll leave.
Satisfaction in the features categorized as performance is proportional to the quality in which the features are implemented/delivered. Let’s say we introduce Facebook as an alternative sign up procedure. It isn’t a must have feature, but it will increase the customers’ satisfaction in the project: the users can use their existing accounts, and we don’t have to store user data unnecessarily. After Facebook we introduce twitter as the next alternative. It has no effect on the existing users but may attract more customers.
The last category is the excitement which is the complete opposite of the basic category: the presence of an excitement feature drastically increases the customers’ satisfaction, but nothing happens when it is not there or doesn’t work as expected. For example, we introduce a feature which allows customers to use our shop without signing up, just using their email address and PayPal. If it’s available, the users will be excited to use this great convenience feature, if it’s not, they won’t miss it

Read more »

VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)

Listen to Experts but Trust Your Team Members

Back when I was working in a project as a team leader, on a cloudy Thursday an expert took me aside to talk about the time reporting of one of my team members. He pointed out that the team member in question spent about 6 hours doing a certain task which he – the expert – could have done in 15 minutes. He insisted that I called her to account for the time spent on this task. It was an awkward situation, because I knew that she had worked hard all day – I sat with the team and I knew that she hadn’t spent more than 5 minutes away from the task -, but still I was unable to explain the huge difference. Practically, that task consisted of two sub-tasks and unfortunately I had no experience with either of them.

Instead of talking to her immediately, I chose a different option: I decided to gain some experience on the matter and see how much time it really took to finish that task. I needed to choose this way, because if I had confronted her with the feedback from the expert, I would have only been able to tell her what he told me, that is that the task should have taken only 15 minutes to complete. Instead, I wanted to understand the situation and be able to help her to be more effective next time – provided that the expert was right and her time had indeed not been well spent in this case. Additionally, I wanted to leave the expert out of the discussion, because he wasn’t part of the team, and I felt that these discussions had to be done face-to-face: no need for a third person, an outsider to be there.

I scheduled our discussion for the next Monday, and I spent the preceding Sunday afternoon with the task at home. I needed 2.5 hours to complete the first sub-task, but I felt that I had already gained the necessary technical experience in order to have a constructive discussion on Monday. I assumed that the second sub-task was an easy one considering her technical level, so I estimated half an hour for it, adding up to a total of 3 hours to complete the whole task. Read more »

VN:F [1.9.13_1145]
Rating: 8.3/10 (3 votes cast)