The "Dial-able" Power Principle (aka?)

78 views Asked by At

As a designer, I like providing interfaces that cater to a power/simplicity balance. For example, I think the LINQ designers followed that principle because they offered both dot-notation and query-notation. The first is more powerful, but the second is easier to read and follow. If you disagree with my assessment of LINQ, please try to see my point anyway; LINQ was just an example, my post is not about LINQ.

I call this principle "dial-able power". But I'd like to know what other people call it. Certainly some will say "KISS" is the common term. But I see KISS as a superset, or a "consumerism" practice. Using LINQ as my example again, in my view, a team of programmers who always try to use query notation over dot-notation are practicing KISS. Thus the LINQ designers practiced "dial-able power", whereas the LINQ consumers practice KISS. The two make beautiful music together.

edit I'll give another example. Imagine a logging tool that has two signatures allowing two uses:

void Write(string message);
void Write(Func<string> messageCallback);

The purpose of the two signatures is to fulfill these needs:

//Every-day "simple" usage, nothing special.
myLogger.Write("Something Happened" + error.ToString() );

//This is performance critical, do not call ToString() if logging is
//disabled.
myLogger.Write( () => { "Something Happened" + error.ToString() });

Having these overloads represents "dial-able power," because the consumer has the choice of a simple interface or a powerful interface. A KISS-loving consumer will use the simpler signature most of the time, and will allow the "busy" looking signature when the power is needed. This also helps self-documentation, because usage of the powerful signature tells the reader that the code is performance critical. If the logger had only the powerful signature, then there would be no "dial-able power."

So this comes full-circle. I'm happy to keep my own "dial-able power" coinage if none yet exists, but I can't help think I'm missing an obvious designation for this practice.

p.s. Another example that is related, but is not the same as "dial-able power", is Scott Meyer's principle "make interfaces easy to use correctly, and hard to use incorrectly."

3

There are 3 answers

1
Juliet On

I call this principle "dial-able power". But I'd like to know what other people call it.

I've personally never heard of "dial-able power", and I don't think its an industry standard term.

In the case of LINQ, we'd refer to its design as a fluent interface.

Fluent interfaces are design so that all methods on an object return the same type as that object, and therefore makes method chaining easy. You see the same fluent design in the StringBuilder.Append overloads, fluent NHibernate, and RhinoMocks.

In the case of JQuery, it also uses fluent interfaces for method chaining, but I believe "query" or "DSL" is the proper name for its selector notation.

(Obj-C selectors use the same terminology, but describe something completely different.)

Since its described as a querying DSL, most people can infer that it takes a sequence as input and returns a sequence as output. The query notation is performs roughly the same function as XPath with more bells and whistles.

Hibernate HQL is a querying DSL on top of many SQL dialects, and in a very superficial way regexes are a querying DSL which transform string sequences into a new set of string sequences (you can, in principle, make a fluent interface for regexes, but it would probably make you claw your eyes out).

0
Nicole Calinoiu On

If your "dial" has only two positions/levels, it sounds like you're simply referring to a façade.

0
Andy Thomas On

"Progressive disclosure."

You may already be acquainted with the term because of its use with user interfaces -- e.g., "More" buttons. However, the concept is more general.

From "Universal Principles of Design," by Lidwell, Holden and Butler:

   Progressive disclosure involves separating information into 
   multiple layers and only presenting layers that are necessary or relevant.