This is part four of the mini series "Magic principles in test automation". Forcing has multiple meaning in magic as well as software development - in this article I will try to explain both.
The first thing that comes to mind of a magician when thinking about forcing is making the spectator think, do or say something but making it feel like he or she had a free choice.
Let's take card tricks as an example (by the way my favorite discipline of magic).
Imagine, you want to let the spectator choose any card which is then put back into the pack. For your desired effect, it is necessary that you know the identity of said card.
There are multiple ways to achieve this, among those are:
You secretly control the card when it is put back and peek it at an appropriate time.
This works but it is a lot of effort to achieve this as two very separate actions are required: controlling and peeking.
You know the identity of the card when it is chosen.
This is where the forcing aspect comes in. If you can make your spectator believe that the chosen card was a free choice (when in fact it was not because you knew the card before it was picked), you have only one action to worry about: the force.
There are many more ways to achieve the latter but this would lead too far for this article. Also, I don't want to expose any techniques here.
The point is that it is safer and more deceptive if you rely on one technique that is applied when it is least expected. Virtually all spectators let their guards down during a seemingly fair selection process and start watching more closely when they return their card to the pack. At this point, your dirty work is already done - you don't need to worry about any further action.
There are multiple ways of forcing - these don't necessarily differ in technique but in the feeling they invoke in spectators:
Forcing a thought
"Think of a any travel destination."
Forcing a choice
"Choose one of these three colors: red, yellow or blue."
Forcing an action
"Do you want to switch your card for another one?"
Young magicians (including me when I started) often suffer from a specific trait: they want to force themselves and their magic on everybody. They think all people need to see how great they are.
This is a trait that I have seen in software development multiple times (especially with developers who just started their first job).
With more experience, however, this changes for most magicians and developers alike. We see how little we actually know and how much experience matters. Also, and this is even more important, we start to realize when the time is right.
Even Socrates determined that
“The more you know, the more you realize you know nothing.”
It is best when other people approach you instead of you forcing something on them. For this to happen, they need to understand what you have to offer and how it can help them. Especially in test automation, your project is bound to fail if people don't understand the benefits of it. And it is even worse if the sole reason to start such a project is because you or somebody else said so.
This is forcing in the worst possible way.