Intention Not Algorithm

We might also say, WhatNotHow?, or WhyNotHow?.

The most important thing about any (without loss of generality) method is what it accomplishes or why one would call it, not how it does whatever it does.

See also IntentionRevealingSelector


Yes, as I've said so many times, IntentionalityAndHermeneutics? are all there is to good code. Any ideas why this catch phrase hasn't caught on? Perhaps because few know what hermeneutics means (or how to pronounce it) without a dictionary. -- SethKlein


Note also that the How of this level becomes the What/Why of the next level down.


Also could be called PolicyNotMechanism? (as opposed to MechanismNotPolicy?).


Isn't the name of the method the intention and the body of the method the algorithm? Shouldn't one be able to determine the intent from the algorithm and vice-versa? Another restatement of this would be that "If the intent and algorithm diverge, there is a problem."


But the intent is not always sufficient to determine the algorithm. My intent may be to sort a list, but the algorithm I use may be crucially important. Others may wish to call a sort method, why should they have to say "Sort_with_quickSort" or "Sort_with_smoothSort"

In this particular case, intention alone is insufficient - algorithms are a necessary addition.

* Actually, intention is sufficient, it is, however, incomplete as stated, since intention includes whatever we think is important. The full intention is "sort with such and such attributes, such as stable/unstable, importance of simplicity vs speed, data is random versus might be mostly sorted, etc."

* This is where testing comes into play. One can select any algorithm that meets the requirements of the test. It is too unwieldy to name a method in a way to identify every important characteristic, but it is equally inappropriate merely to identify one specific algorithm as the one and only solution. Alternative algorithms probably do exist that solve the problem as well or better than the one initially chosen. ** Au contraire. For instance, how would testing help with the intention that the sort use no extra space? (Merge sort of arrays needs O(n) space, by contrast.)


EditText of this page (last edited July 2, 2004)
FindPage by browsing or searching

This page mirrored in WikiPagesAboutRefactoring as of July 17, 2004