Hammer
From APIDesign
JaroslavTulach (Talk | contribs)
(New page: There is an old observation: ''when you have a hammer all problems look like a nail''. Wikipedia calls it law of the instrument. ...)
Next diff →
Revision as of 08:40, 12 November 2012
There is an old observation: when you have a hammer all problems look like a nail. Wikipedia calls it law of the instrument.
Doing the Same Thing. Expecting Different Results
It is tempting to stick to tools, policies and solutions that have proven to work in the past. They have a history, they are familiar to us. We can project what they can do. It is comfortable to not change the winning team. Still it may not be the wise choice.
At the end we want to achieve something new. By repeating what we have done in the past, we can hardly get something new. We can apply similar practice, we can just follow the pattern, but in order to do so, we should recognize the basic pre-requisites (that may be hidden from our shallow understanding) that are critical to applying the hammer properly.
Substitution
Once I heard a quote from a member of Die Grünen and Greenpeace about the latter organization: We started as fighters against nuclear weapons testing (a very laudable goal, I'd say), but since then we turned to be against anything nuclear. Something must went wrong.
As someone watching from a distance, I can't help seeing the Greenpeace having a hammer (a successful fund raising when fighting against nuclear weapon testing) and using it on a completely different nail. Which is probably natural given the fact that all the nuclear weapons holders from the Greenpeace beginnings ceased on any testing and the organization needed to re-focus to be relevant.
Still the hammer law seems to be present and it is causing us more harm than good as the Greenpeace credit (earned in the nuclear weapons testing fight) is now used to promote idea which has little to do with the original one. Some people find this kind of doublethink twist uncomfortable and humiliating for an organization that otherwise does bunch of good.
A NetBeans Hammer Experience
An IDE like NetBeans does not live in a vacuum and needs to play well with command line tools. However when two systems (the IDE and for example Hg or Git) are accessing the same files on a disk, we have a conflict. They may not properly understand each's other intentions. The IDE may then see sources which are not up-to-date or which are inconsistent.
Various IDEs solve this problem differently. Some ignore external changes all together and require an explicit refresh. Others try to detect the changes and refresh automatically at the right moment. Old NetBeans used to do a pull like check on gaining focus. New NetBeans comes with a native file system listener support and detect the changes as soon as possible (on a push basis).
The performance of the new system is certainly better in the old scenarios (as it eliminates needless checks at the moment when user wants to do something with the IDE and gives it focus). On the other hand the external tools did progress as well and there are new use-cases we have not dreamed of back then: Git users are shamelessly switching branches from command line, merging between them and meanwhile the NetBeans IDE gets confused (and burns the CPU like crazy). This is indeed a flaw.
And here we get to the hammer experience - some members of NetBeans community (Tim and his fellows) reminded themselves about the old, good on focus synchronization and started to push really hard for it as being solution to the problem. I can't help myself, but from my perspective it is like the Greenpeace of nuclear weapon testing by fight against nuclear energy - it misses the root causes why the refresh on focus gained worked in the past.
The original use-case was to synchronize when there was a chance that an external tool was executed. To execute an external process one had to switch to terminal window or window of some other application. Obviously gaining focus back was relatively good moment to refresh (at least for short running external commands). There was some sense in doing this.
However using a focus gained to prevent the IDE from doing refresh is more a black magic then a user interface. First of all it is not intuitive UI, second it will lead to situations when people will be afraid to use Alt-Tab as they might accidentally switch to the IDE at inappropriate moment.
This is the kind of solution one gets when attracted by the hammer effect and seeing the nails all over.