Monthly Archives: May 2012

Situational Leadership and Coaching

Much of the content of this post comes from my girlfriend’s masters thesis on the subject though it is quite relevant to our industry as we seem to use many words wrong and have some misguided ideas.

Many people talk about coaching within teams. Hell you can go just about anywhere to find an “agile coach”. We might for instance want to go to the http://www.agilecoach.net/. We LOVE coaching in our industry. However coaching is just one tool amongst many in our belt and is actually non-effective at times.

At a talk recently I heard that we should always be coaching within our teams. This is likely as we will see to not work well. We overuse coaching.

Situational Leadership defines four learning mechanisms.

Direction: where a learner is given tasks and direction
Coaching: where the learner is doing the task
Supporting: where the learner is doing the task but lacks confidence
Delegating: where the learner is no longer a learner but is actually doing the task

We have a tendency of applying “coaching” all the way through the process. The research is looking more so at when coaching should be applied. As an example its quite common for a team to want to go to agile so they will hire an “agile coach”.

Getting Started

Highly Directive/Low Supportive

Situational Leadership would specify that when a learner is new to a task, coaching in ineffectual. Instead we should be giving direction to the learner without being highly supportive.

When I was quite young I worked cleaning cars. My first day on the job my boss did not sit with me and show me the best ways of cleaning a tire. He did not talk to me about the theory associated with rims verse hub caps. He just told me to “do it this way”. He gave direction.

Learners who are new to a subject are not good candidates for coaching. They need direction and to reach of a level of understanding before coaching will be effective for them.

no he was not Mr Miyagi though Mr Miyagi was very directive.

Coaching

Highly Directive/Highly Supportive

Coaching would be the next step after a learner has reached a certain level of maturity in understanding. A classic example of where coaching would apply would be after a learner has for instance taken a class on a subject.

Years ago I took a class on how to build and deliver presentations. Oddly at the end of that class (which was mostly directive) I found that giving real presentations is well slightly different. Talking to a room full of people about a real subject is different than doing it in class. I am sure many people that have taken classes (even mine) can relate to this feeling.

I began videotaping my presentation and I had someone who was very good at presenting look over them with me, give me feedback (positive and negative). They also even would sometimes go through with me doing dry runs of the presentation. They were coaching me. I was defining and doing the work, they were helping to guide me and providing feedback.

Support

Low Directive/Highly Supportive

The next level would be a supporting role. It would be a move away from providing feedback (constructive criticism) and moving more towards a supporting role.

Over time I learned better how to present to an audience. Admittedly I still lacked confidence in my own decision making. My mentor slowly stopped giving me direct assistance and feedback and became more so a supporting role. They would help me in having the confidence that I did actually know what I was doing. Sometimes a rightly placed “at a boy” can make a world of difference.

This brings us to the last stage.

Delegation

Low Directive/Low Supportive

This is the last step in the process (the ending of the learning). This is the teacher pulling away from a now fully competent no longer student.

Care must be had as well as many leaders have a hard time pulling away from the supporting role and allowing the student/learner to flourish on their own. This is generally considered the end point of a successful learning process.

The “levels” actually flow into one another as well. Its not that one day you stop getting direction and start getting support etc its that you get less of one or more of the other.

Picture blanchard situational leadership

When we discuss “coaching” we generally discuss this whole process. This is not correct and understanding the differences in situations can be very valuable in successful learning. I can’t claim to be an expert but this was very interesting stuff personally to learn about.

Again this is based on my girlfriend’s research for her masters thesis (I got to help quite a bit and learned a lot in educational theory, maybe I am ready for coaching now!). I have been trying to convince her to do a talk at one of our conferences on the subject (this is 1-2 pages, her paper was 70!). If this is interesting to you please drop her a comment of encouragement here!

Q/A

Use case : Internet shop.

The customers creates an order containing: containing: BookA, BookB, BookC. and sends this order command to server, the moment the command begins to execute someone else bought BookC, and we are out of stock.

How we are supposed to validate this command on server, if we shouldn’t query reporting database in commands handlers? Udi has been asked similar questions at DDD Exchange 2010, by Eric and Greg. But he didn’t provided an answer.

I tried to respond on your blog but didnt have my credentials for wordpress. I wrote more than I thought so I will respond on my blog as well.

The example that you give of ordering is actually a quintessential one. You mention that a web system may want to prevent two people from ordering the last of the same product at the exact same moment (Inventory should be consistent). My guess is you have not worked at a large online retailer before.

So generally you want to allow these orders to come in. There are a few reasons for this. The first it that inventory is by definition not consistent. There are domain terminologies to describe its eventually consistent nature. Unfortunately when people break, misplace, or steal something they have a tendency of not updating the computer system as to the items new location. As such you often don’t have in physical inventory what the system says you do (this is partly why audits exist).

There is also further questions from a business point of view about things like lead times of getting the item or even buying the item from a competitor to keep the customer happy. Loads of examples of this happen daily in these situations (ever booked a hotel and been upgraded to another hotel?). They are perfectly willing to oversell in many scenarios. These types of substitutions are quite common…

However let’s assume for a moment that there is a valid use case here (I won’t just brush you off by looking at the use-case). With say a CQRS/ES based system you still have some amount of consistency within aggregate boundaries. For invariants that exist within boundaries you have everything fully consistent. For aggregates that are outside of the boundary there are a load of strategies.

The strategies mostly look at the ability to detect that this has happened and to minimize the chance of it happening. If my warehouse sells 1,000,000 items and 1 goes oversold we can likely deem that as a “nice problem to have”. It is far better to handle such a problem from a business perspective than to make large architectural constraints upon our system. The detection of the situation happening previously is key though in order to be able to do this. If you can’t detect a failure its hard to talk about minimizing the costs of a failure.

One way to do this is to say keep the last n seconds worth of transactions in memory (assuming single write server). You could then look through these transactions on top of what the read model had. This obviously has a downside to it in that it doesnt scale to many servers… Your queue (if you use one) may also support peeking inside of it at what messages have not been processed. Neither of these is perfect but can help in many scenarios.

The last strategy is to actually make everything full consistent. You can certainly bring in a lock (either a distributed lock, or use a database, or whatever). This has very well established trade offs but can be done. I would tend to error towards not doing this and mitigating risk through other means but there can certainly exist situations where the  cost of a failure is so high that 100% prevention is required.

Multi-Tasking

I was reading through many of the recent posts on the harmfulness of multi-tasking this weekend.

Many cite the cost of a push/pop operation as harmful to multi-tasking. This can absolutely be the case. Some things are very costly to push/pop other things are not costly to push/pop. I feel however the discussion is being completely lost. The issue is not that we should avoid multi-tasking at all costs. We should be trying to figure out what things are low cost to push/pop and what things are high cost to push/pop.

Imagine for example that I asked you to write two programs with TDD. The first is FizzBuzz, the second is to count the recurrence of words in a text. In a quick non-scientific example I was about 10% less productive working on both at the same time (with switches between them at +- 3 minutes) than I was working on each separately start to finish (there was a mild cost of push/pop). I think I could have gotten them to near identical time if I had made my switches allowed 15 seconds or so to find a stopping point (I literally stopped typing in the middle of a word and alt-tab’ed).

In another quick non-scientific study I tried with simple features in a much larger space (e.g. adding features into a larger more complicated code base). I was in this case much slower. The reason why was that my push/pop costs were much higher. I was keeping more information in my head and it took me longer to get back into the problem.

Disclaimer, I often like to think I am multi-tasking. I often have 2-3 things going on the “back burner” where suddenly thoughts hit me and I mark down that thought and continue with what I was working on. How often do you solve that difficult bug while in the shower or cooking spaghetti?

However I see the difficulty of multi-tasking in a code base to be just like any other “ility” it is something that we can optimize towards (and likely we are making tradeoffs on other things). In particular coupling and complexity come to mind as related to the ility and I don’t necessarily mean cyclomatic complexity when I say complexity (it is often more difficult to work in very highly factored code where to put together an operation you need to bring together 20 well factored pieces that to look at one piece of code with high cyclomatic complexity). Oddly these same things that slow you down multi-tasking are the same things that slow down someone new to your team that needs to ramp up.

If you are writing code that you lose exponential productivity in multi-tasking with its probably because the code is complex. Your push/pop costs are high. You probably have a lot of other issues with this code like bringing new people into it.

If something is difficult, do it more.

The best way to get through such problems is to do it more. You are hurting due to complexity and push/pop costs? Multi-task more, where does it hurt when you are multi-tasking? Some tasks are truly complex but more often than not we introduce the complexity ourselves. Our models are wrong.