The Offside Rule explained using Specification by Example

 

People who know me know that I like two things:

I like my football.

I like my Agile.

Why do I like these things?

The beautiful game.  The beauty of a team, each player knowing the role they play but willing to step into other roles as needed for the benefit of the team. Each player excelling within their own role, some dazzlingly so, but the whole that the team produces is significantly more than its individual parts.

They are self-organizing and cross-functional.

A team who have many practices they work on tirelessly in the pursuit of perfection.

They pursue technical excellence.

They focus only on the next game, each game contributing to the overall objective – Premiership Champions……

They iteratively pursue their goals (and measure progress in points).

You may be forgiven to think that this article is leading to a comparison of football teams and Agile teams. Sorry – that must surely have been done already – it’s just I get carried away when I talk about the beautiful game (now am I talking about football or Agile?).

This article aims to bring an Agile technique together with a football rule in an attempt to explain both.

The off-side rule explained using Specification by Example.

Should have something for everyone.

So let us start with an overview of Specification by Example.

Simply put, it is a technique from the school of Agile that is used to specify requirements using examples. It also goes by the name of Acceptance Test Driven Development. However, I personally feel that dilutes what it is trying to achieve.

Although it uses tests as its primary angle, it is primarily a technique for elicitation and understanding of requirements.

Does that make sense?

It may not as it reverses a traditional viewpoint and achieves something that often comes up in a traditional projects lessons learned.

The traditional viewpoint is that we derive our test specifications from our requirements specifications. In Specification by Example, our tests are our requirements specification.

The lesson learned we do something about is to bring our testers into the project earlier. That is, during requirements elicitation. If our tests are our requirements specification, then it stands to reason we need our testers wonderful edge case seeking brain in the starting position to start coming up with these tests / requirements / whatever.

Make sense yet?

When we sit with our clients during those early stages to try and understand what they want, our Business Analyst often asks our client for concrete examples or scenarios to explain and help the analyst understand the requirement.

When the analyst has this understanding, he tends to discard those examples. They are transitional artifacts used only to get it. Once they get it they then write it down in the form of a Software Requirements Specification or a Use Case or a Functional Specification where they try and describe, in as much detail as they can and as precisely and accurately as the English language will allow, what the system should (or should I say Shall) do.

Even worse, the analyst never got examples in the first place or these examples were basic happy-day scenarios leaving big gaping holes and questions in the resultant specification.

The developer comes along and codes to the spec but some of the meaning is lost so they are forced to make assumptions. They come up with their own examples in isolation to test their work before handing it over to a tester, who has spent the same amount of time coming up with his own assumptions and his own examples in the form of tests.

They come together and the assumptions clash.

They work through the clashes, agree solutions and show it the customer who declares that’s not exactly what I meant, here let me give you an example….

So what if we get the tester and developer involved with the customer and Business Analyst and as a team they come up with examples? The tester will ask all sorts of difficult to answer questions around business rules that the analyst wouldn’t have thought of and the developer will be able to input technical knowledge and his experience on what normally gets missed in order to support the development and automation of tests.

Make sense now?

No?

Time for an example.

The offside rule.

To break the off-side rule a player needs to be in an offside position so let’s keep it simple and start there.

To be in an offside position a player needs to be nearer to his opponents goal line than both the ball and the second last opponent.

Position of Player from opponents goal line Position of Ball from goal line Position of second last opponent from goal line In offside position?
10 yards 12 yards 11 yards Yes
10 yards 9 yards 11 yards No
10 yards 12 yards 9 yards No

Our tester will surely ask now – what if they are in line?

The ball can be played sideward so although you may be in front of the second last opponent the ball has to be played forwards for you to be off side.

Also, you can be level with the second last opponent when the ball is played forward without being in an offside position.

Tables gets updated to now look like this.

Position of Player from opponents goal line Position of Ball from goal line Position of second last opponent from goal line In offside position?
10 yards 12 yards 11 yards Yes
10 yards 9 yards 11 yards No
10 yards 12 yards 9 yards No
10 yards 10 yards 11 yards No
10 yards 12 yards 10 yards No

Now matter where on the pitch, if the player is in front of the ball and the second last opponent, is he offside?

No – they can only be offside if they are in the opponents half.

Now lets imagine our football pitch is 100 yards long, resulting in the half way line being 50 yards from either goal line.

So if our player is more than 50 yards from the opponents goal line they can never be in an offside position. Even if standing directly on the half way line.

Position of Player from opponents goal line Position of Ball from goal line Position of second last opponent from goal line In offside position?
10 yards 12 yards 11 yards Yes
10 yards 9 yards 11 yards No
10 yards 12 yards 9 yards No
10 yards 10 yards 11 yards No
10 yards 12 yards 10 yards No
51 yards 53 yards 52 yards No
50 yards 53 yards 52 yards No
49 yards 53 yards 52 yards Yes

So that determines if the player is in an offside position.

Yes – but many pundits often make errors with regard to the second last opponent so we should clarify that with an example.

The error they make is that they miss the fact that the last opponent (not the second last opponent) is usually the goal keeper and is often disregarded from the decision. For the player to be in an offside position this is irrelevant. The player must be  closer to the goal line than the ball and two players (whether this is the goal keeper of not) to be in an offside position.

Position of Player from opponents goal line Position of Ball from goal line Position of second last opponent from goal line Position of goal keeper In offside position?
10 yards 12 yards 11 yards 1 yard Yes
10 yards 9 yards 11 yards 1 yard No
10 yards 12 yards 9 yards 1 yard No
10 yards 10 yards 11 yards 1 yard No
10 yards 12 yards 10 yards 1 yard No
51 yards 53 yards 52 yards 1 yard No
50 yards 53 yards 52 yards 1 yard No
49 yards 53 yards 52 yards 1 yard Yes
10 yards 12 yards 11 yards 80 yards Yes

In this last case the goal keeper is up for a last minute corner in an attempt to get a last ditch equalizer. It happens but to be onside when the ball is played forward and the player is in the opponents half the opponent would need to have at least two outfield players further forward than the player for the player to be onside.

Make sense?

We now need the rules to determine whether being in an offside position causes an offside offence and the resultant raised red or yellow flag followed by the blowing of a whistle.

The player in an offside position only commits an offence if the ball touches or is played by one of his team and the referee considers the player in an offside position to be interfering with play, with another opponent or is gaining an advantage.

Player in offside position played by or touched by other team member interfering with play, opponent, or gaining advantage offside offence?
No N/A N/A No
Yes Yes Yes Yes
Yes Yes No No

In reality, when designing your tables, you’d probably need to ask a few questions of your customer (a referee in this case) to get a deeper understanding of the requirement.

For example, what does “touched by other team member mean?”, “what constitutes interfering with play?”, “what gives a player an advantage?” and most importantly, “can you give me examples of each?”. You can then build those examples into the tables for a clearer picture.

Back to the next part of the rule.  The player cannot be penalized if the ball was played from a goal kick, a throw-in or a corner kick. We therefore need to include the type of play that is leading up to a potential offside call.

Player in offside position played by or touched by other team member interfering with play, opponent, or gaining advantage Play Type offside offence?
No N/A N/A Open No
Yes Yes Yes Open Yes
Yes Yes No Open No
Yes Yes Yes Goal Kick No
Yes Yes Yes Corner Kick No
Yes Yes Yes Throw-in No
Yes Yes Yes Free Kick Yes

There we go.

Specification by Example explained with an example.

The offside rule explained using Specification by Example.

Today sees the start of the Premier league so go impress your friends in the pub tonight with your knowledge of the most discussed rule in football. There will always be a bad offside call this afternoon that needs dissecting over a pint.

A final note…..

Come on Villa……!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s