markhneedham/blog huggingface dataset:
ThoughtWorks University: "It's your project"
Date: 2011-04-13 20:28:34

One of the things that we've struggled with at ThoughtWorks University is giving the attendees the opportunity to run the project that we've been working on.

The first few weeks were the most frustrating both for the trainers and for the attendees because we spent a lot of time telling the attendees that it was their project but then didn't display behaviour consistent with that message.

From my observations this happened because the role of the trainers was defined as 'senior team member' which meant that if a trainer saw something going wrong they'd try and fix it since that's what they'd do in a normal team.

This was most evident initially with the Iteration Manager which started off being one of the trainers.

After realising that this meant that person solved pretty much every problem we had to change that approach and let one of the attendees take the role.

By doing this I think the group as a whole have learnt more about what it takes to drive stories across the wall, facilitate a showcase, prepare a release and so on.

More recently we've stepped back a bit in the other roles and although I'm still acting as the tech lead we're allowing others to cover some of the tasks that someone in that role might usually take care of.

The main learning for me is that our initial metaphor of being a 'senior team member' rather than a 'trainer'  actually hindered the learning of the group despite creating a more realistic project environment.

It's difficult to say whether we should have gone with our current approach straight from the start or not.

Part of me thinks it may have been useful to get an idea of what a normal project would look like but the other part thinks maybe we wasted learning time.
Feedback: Easing in
Date: 2011-04-13 02:33:52

One of the most common techniques of feedback which I've come across is one that William Noonan describes in 'http://www.amazon.com/Discussing-Undiscussable-Overcoming-Jossey-Bass-Management/dp/0787986321/ref=sr_1_1?ie=UTF8&s=books&qid=1302551239&sr=8-1[Discussing the Undiscussable]' as *easing in*.

From the book:

____
Easing in is a skilful strategy whereby I try to get the other person to come round to my point of view without my stating it directly.
____

From my experience we'll try to do this because giving our point of view could lead to an awkward conversation so we'd rather they express our opinion for us instead.

Amusingly I managed to create an example of easing in while showing a colleague (colleague 1) the chapter about easing in!

We'd been involved in a conversation the previous evening with one other colleague (colleague 2) where colleague 1 was asking leading questions to colleague 2 in order to get colleague 2 to confirm an observation that colleague 1 had made.

It didn't really work because colleague 2 had a different opinion of the situation so the conversation eventually petered out.

The next day I was reading the chapter on 'easing in' and showed it to colleague 1 expecting that they would immediately recognise what I was talking about.

Unfortunately that's not what happened and my colleague just read the part I pointed out and then handed the book back without any comment.

Having realised what I'd done I went and spoke with them about 20 minutes later and described how I thought the chapter had some relevance to the conversation of the previous evening.

We then had the chance to discuss the idea of easing in a bit more and now both of us are more aware of the concept and try to avoid doing so when giving each other feedback.
Feedback Loops: Human Decisions
Date: 2011-05-05 18:04:56

I've been reading Donella Meadows' 'http://www.amazon.com/Thinking-Systems-Donella-H-Meadows/dp/1603580557/ref=sr_1_1?ie=UTF8&qid=1304614405&sr=8-1[Thinking In Systems: A Primer]', an introductory text on systems thinking, and after 30 pages or so the author poses the following challenge:

____
Sometimes I challenge my students to try to think of any human decision that occurs _without_ a feedback loop - that is, a decision that is made without regard to any information about the level of stock that it influences
____

Meadows has quite a nice way of guiding us to thinking about systems by referring to 'stocks' and 'flows'.

____
A stock is the foundation of any system. *Stocks are the elements of the system that you can see, feel, count, or measure at any given time.* A system stock is just what it sounds like: a store, a quantity, an accumulation of material or information that has built up over time.
____

____
*Stocks change over time through the actions of a flow.* Flows are filling and draining, births and deaths, purchases and sales, growth and decay, deposits and withdrawals, successes and failures.
____

For example the following diagram represents the flows into and out from a water reservoir:

image::{{<siteurl>}}/uploads/2011/05/reservoir.jpg[Reservoir,570]

The 'water in reservoir' is the stock in this system while rain/river inflow act as the in flows and evaporation/discharge are the out flows.

This is a reasonably simple example because it doesn't show any of the factors in the system which might impact the in flows or out flows of the system.

I talk with friends of mine reasonably frequently on instant messenger so I thought it'd be interesting to try and see how that system would fit into this model:

image::{{<siteurl>}}/uploads/2011/05/im-conversations.jpg[Im conversations,569]

The curved arrows in the diagram are known as information links and they direct the action in the system.

In this example we have "desired knowledge level" and "knowledge of friends' lives" which are compared to each other and lead to a discrepancy which can be fixed through instant messenger conversations which increase the 'communication with friends' in flow.

I think the 'stock' in this system is the desire to know more about what my friends are up to but I'm sure there are other ways of looking at this relationship as well.

It feels a little bit 'unhuman' to think of things in terms of stocks/flows and I'm doubt most people think about stock levels consciously when deciding to have a conversation! *The feedback loop is much more implicit.*

When discussing this with http://twitter.com/#!/satphilora[Sat] he pointed out that in a more accurate systems diagram there would also be other feedback loops which might include how busy we are, how interesting the conversation is, how tired you are and so on.

The book does get onto that but I hadn't realised that such a simple human decision was in fact being influenced by a feedback loop!
Feedback: In public
Date: 2011-05-11 12:12:00

One of the areas that I covered during a session I ran at http://xp2011.org/[XP 2011] on making feedback work in teams was the idea of giving feedback in public.

The general consensus seems to be that giving feedback in public isn't a good idea and it'd much more effective to give that feedback privately.

I think this is a good rule of thumb and my observations are that feedback given in public tends to not be given in a very constructive manner and therefore leads to a defensive response from the recipient.

image::{{<siteurl>}}/uploads/2011/05/pillars.jpg[Pillars,320]

On the other hand if it's done in quite an informal joke-y way then I think it's less of a problem.

On the last team that I worked on we created some 'pillars' for our team which contained some choice phrases that we used to shout across the room at each other whenever someone wasn't displaying one of them.

I don't remember anyone reacting in a defensive way to having someone quoting one of the pillars and it actually seemed to act as a nice reminder that they'd lost focus on their work, were taking things too seriously or something else.

The other situation where I don't know that it needs to be completely private is when there's a lot of trust between the people in a group and there's no repercussions from any of the feedback being exchanged.

For example I wrote last year about how Christian, Dermot and I had done a http://www.markhneedham.com/blog/2010/07/07/group-feedback/[feedback session with all 3 of us in the room], each giving feedback to the other two.

I think the trust thing is important in that situation because if there was someone in management looking on the discussion as part of a performance review then it could quickly become a witch hunt against a person.
In what world does that make sense
Date: 2011-05-14 21:12:31

In http://www.markhneedham.com/blog/2011/05/13/xp-2011-esther-derby-still-no-silver-bullets/[her keynote at XP 2011] http://www.estherderby.com/[Esther Derby] encouraged us to ask the question "in what world does that make sense?" whenever we encounter something which we consider to be stupid or ridiculous.

I didn't think much of it at the time but my colleague http://www.thekua.com/atwork/[Pat Kua] has been asking me the question whenever I've been describing something that I find confusing to him.

After about the third time I  noticed that its quite a nice tool for *getting us to reflect on the systems and feedback loops that may be encouraging the behaviour witnessed*.

In one of our conversations I expressed confusion at the way something had been communicated in an email.

Answering the question made me think why the person would go for that approach and allowed me to see why what I initially thought was obvious actually wasn't.

A common example of frustration for consultants at ThoughtWorks is around travel and hotel booking which is booked centrally.

People are often frustrated that they end up with a different hotel/flight than they would prefer.

Asking the question in that case helped to understand that the people doing the booking reported to the finance manager and had been told to ensure costs didn't exceed a certain level.

In 'http://www.amazon.com/Thinking-Systems-Donella-H-Meadows/dp/1603580557[Thinking In Systems]' the author points out that people (mainly me) often have a very narrow view of the world which from my experience leads to us committing the http://en.wikipedia.org/wiki/Fundamental_attribution_error[fundamental attribution error]:

____
\...the fundamental attribution error describes the *tendency to over-value dispositional or personality-based explanations for the observed behaviours of others while under-valuing situational explanations for those behaviours*. The fundamental attribution error is most visible when people explain the behaviour of others. It does not explain interpretations of one's own behaviour--where situational factors are often taken into consideration. This discrepancy is called the actor--observer bias.
____

Asking this question seems to help us avoid falling into this trap.

Now I just need to remember to ask myself the question instead of jumping http://www.markhneedham.com/blog/2011/04/24/the-ladder-of-inference/[the inference ladder] to conclusions!
Ruby: Where to define the method?
Date: 2011-02-03 19:37:17

In our application we deal with items which can be put into a shopping cart.

An item is defined like so:

[source,ruby]
----

class Item < ActiveRecord::Base

end
----

One problem that we had to solve recently was working out how to display a message to the user if the item they wanted to buy was out of stock.

We can find out if items are out of stock by making a call to an external service:

[source,ruby]
----

def out_of_stock_items
  items_from_external_service_call.map do |i|
    item = look_up_item_by(i[:id])
    item.number_available = i[:number_available]
    ...
  end
end
----

Line 5 is the interesting one because we needed to work out where to define the 'number_available' method.

The easiest way to do it is this:

[source,ruby]
----

class Item < ActiveRecord::Base
  attr_accessor :number_available
end
----

But it seems a bit misleading because the concept of availability doesn't exist in every context that we use the 'Item' object.

Another approach could be to add an instance method to each of the cart items in that context which is a bit more complicated:

[source,ruby]
----

def out_of_stock_items
  items_from_external_service_call.map do |i|
    item = look_up_item_by(i[:id])

    def item.number_available=(value)
      @number_available = value
    end

    def item.number_available
      @number_available
    end

    item.number_available = i[:number_available]
    ...
  end
end
----

Right now we've gone for the easier option and put the method onto the 'Item' class but I'd be curious how others would solve this problem...
'Why' often unhelpful
Date: 2011-02-03 18:51:45

Something which I've noticed recently in particular when interviewing people but also in some other situations is that frequently posing a question which begins with 'why' results in quite a defensive response.

While discussing this with http://twitter.com/priyaaank[Priyank] he pointed out that asking a question in this way can often be construed as a criticism of the idea being questioned.

Admittedly it is often the case that I'm questioning something which has been done differently than what I might have done but I'm still curious as to the reasoning behind it.

Unfortunately this style of questioning often stops any reasonable discussion from happening which isn't my intent.

I've been reading http://www.amazon.com/Sleight-Mouth-Robert-Dilts/dp/0916990478/ref=sr_1_1?s=books&ie=UTF8&qid=1296756875&sr=1-1[Sleight of Mouth] recently which suggests the following:

____
Why questions, for instance, often presuppose other judgments, which can lead back into conflict or disagreement. \... In general, 'how' questions are most effective for refocusing on an outcome frame or feedback frame.
____

William Noonan has a similar thing to say in http://www.amazon.com/Discussing-Undiscussable-Overcoming-Jossey-Bass-Management/dp/0787986321/ref=sr_1_1?ie=UTF8&s=books&qid=1296756850&sr=8-1[Discussing the Undiscussable]:

____
Quality inquiries generally don't use Why questions because such queries tend to make listeners feel pressured to prove their point or justify their position. \... Asking questions starting with "What," "Where," and "How" elicit more descriptive responses, and result in more concrete information.
____

To give a recent example, in India people are currently collecting feedback and one part of it requires the feedback giver to rank the other person in terms of how well they 'performed' compared to what the feedback giver expected.

I asked why it was necessary to do that and didn't really manage to discover the intention very successfully.

Priyank suggested that I might have been more successful if I had asked 'what' the intention of ranking the person was instead.

Hopefully I'll remember that the next time I want to inquire about something but at the moment the 'why' question is the one that comes to the fore when I want to do that.

I don't think it is necessary to use what is a bit of a convoluted style of communication with everyone.

A lot of the people I've worked with are quite comfortable with 'why' questions being thrown around and I think this style of inquiry is more acceptable when you have trust with the other person.

If the conversation isn't about something which could be construed as criticism of either person then asking 'why' seems to be fine as well.
Communication: Listening
Date: 2011-02-20 18:43:24

I realised a couple of weeks ago while pairing with a colleague that I've become quite bad at interrupting people while they're speaking.

I did have an inkling that I'd let my ability to properly listen to someone drift a bit but http://en.wikipedia.org/wiki/Confirmation_bias[I hadn't seen any evidence] until my colleague pointed it out.

Somewhat ironically I actually wrote a post about http://www.markhneedham.com/blog/2006/09/03/active-listening/[active listening] when I first started working at ThoughtWorks in 2006 and reading back over the listening barriers that I listed I realise that there are a few that I tend to break:

____
*Filling-in*: You don't let the other person finish her sentence; instead you finish it for her.
____

____
*Daydreaming*: You get triggered by something the other person says and you're off in your own world. You don't have a clue what the person said to you.
____

____
*Rehearsing*: Rather than listening, you are mentally preparing what you are going to say. You might look interested, but you're really concentrating on planning how you're going to respond.
____

I find it really hard to understand what someone is saying purely by the words so I create images in my head based on what's being said.

My tendency is then to just say what I'm thinking without actually realising that I'm going to interrupt the other person.

Of course that's because I wasn't totally listening because I was visualising what they were saying.

I feel that I still need to do this in order to understand what someone is talking about but I'm practicing keeping my thoughts to myself and then vocalising them if necessary when the other person has finished speaking.

The challenge for me is that when I try really hard to not break any of these barriers I'll often end up being pretty silent when the person is speaking to the point where it might seem that I'm not interested in what they're saying.
Ruby: Refactoring from hash to object
Date: 2011-02-27 20:10:50

Something I've noticed when I play around with Ruby in my own time is that I nearly always end up with the situation where I'm passing hashes all over my code and to start with it's not a big deal.

Unfortunately I eventually get to the stage where I'm effectively modelling an object inside a hash and it all gets very difficult to understand.

I've written a few times before about http://www.markhneedham.com/blog/category/coding/incremental-refactoring/[incrementally refactoring] code so this seemed like a pretty good chance for me to try that out.

The code in the view looked something like this:

[source,html]
----

<% @tweets.each do |tweet| %>
  <%= tweet[:key] %>  <%= tweet[:value][:something_else] %>
<% end %>
----

+++<cite>+++@tweets+++</cite>+++ was being populated directly from a call to CouchDB so to start with I needed to change it from being a collection of hashes to a collection of objects:

I changed the Sinatra calling code from:

[source,ruby]
----

get '/' do
  @tweets = get_the_couchdb_tweets_hash
end
----

to:

[source,ruby]
----

get '/' do
  tweets_hash = get_the_couchdb_tweets_hash
  @tweets = tweets_hash.map { |tweet| TweetViewModel.new(tweet) }
end
----

where +++<cite>+++TweetViewModel+++</cite>+++ is defined like so:

[source,ruby]
----

class TweetViewModel
  attr_accessor :key, :value

  def initialize(tweet_hash)
    @key = tweet_hash[:key]
    @value = tweet_hash[:value]
  end

  def get(lookup)
    if lookup == :key
      key
    else
      value
    end
  end

  alias_method :[], :get
end
----

The next step was to get rid of the +++<cite>+++get+++</cite>+++ method and rename those +++<cite>+++attr_accessor+++</cite>+++ methods to something more intention revealing.

[source,ruby]
----

class TweetViewModel
  attr_accessor :url, :messages

  def initialize(tweet_hash)
    @url = tweet_hash[:key]
    @messages = tweet_hash[:value]
  end
end
----

[source,html]
----

<% @tweets.each do |tweet| %>
  <%= tweet.url %>  <%= tweet.messages[:something_else] %>
<% end %>
----

I originally didn't realise how easy it would be to make the +++<cite>+++TweetViewModel+++</cite>+++ pretend to temporarily be a +++<cite>+++Hash+++</cite>+++ but it actually made it really easy for me to change the code and know that it was working the whole way.

For someone with more Ruby experience perhaps it wouldn't be necessary to break out the refactoring like this because they could fairly confidently do it in one go.
Sed: Extended regular expressions
Date: 2011-02-11 20:34:53

http://twitter.com/irfn[Irfan] and I were looking at how to do some text substitution in a text file this afternoon and turned to sed to help us in our quest.

He had originally used grep to find what he wanted to replace on each line, using a grep regular expression to match one or more numbers:

[source,text]
----

cat the_file.txt | grep "[0-9]\+"
----

That works pretty well but since I knew how to do the substitution in sed we needed to convert the regular expression to work with sed.

We started off with just trying to print the lines which matched the regular expression:

[source,text]
----

cat the_file.txt | sed -n '/[0-9]\+/p'
----

Which prints nothing because sed uses basic regular expressions by default which means we can't use '+' to match 1 or more numbers.

grep on the other hand...

____
Grep understands two different versions of regular expression syntax: "basic" and "extended." In GNU grep, there is no difference in available functionality using either syntax. In other implementations, basic regular expressions are less powerful.
____

To get sed to allow us to use extended metacharacters we need to pass the '-E' flag to sed which also means that we no longer to escape the '+':

[source,text]
----

cat the_file.txt | sed -nE '/[0-9]+/p'
----

From http://www.amazon.com/sed-awk-2nd-Dale-Dougherty/dp/1565922255/ref=sr_1_1?ie=UTF8&qid=1297456109&sr=8-1[what I understand] you can also only use the following metacharacters in extended mode as well:

* ? - for matching zero or one occurrence of a regular expression
* | - for matching either the preceding or following regular expression
* () - grouping regular expressions
* {n,m} - for matching a range of occurrences of the single preceding character

I'm told that you can use grep to do substitution as well but I haven't figured out how exactly you do that yet.