Design – meaning of a HINT when used in software engineering

designterminology

I've seen this now in a number of places and a number of contexts, for example in SQL.

I cannot define the meaning of a "Hint" which it seems clear has some application as or part of a larger design pattern/technique.

What exactly is a Hint when used in software engineering?

Best Answer

The notion of hints is a particular way to express a specific API contract, or maybe more precisely, lack thereof. Basic idea is that application developer passes some information to the underlying system / library without any guarantees that it will be taken into account.

I personally like the way how this is described in OpenGL API docs for glHint:

specify implementation-specific hints... a symbolic constant indicating the desired behavior.

  • Note word desired - that's the point. Application developer expresses a desire for implementation to behave in a particular way. Desire is not a mandatory requirement, can be ignored.

Wikipedia article on SQL hints mentions:

Oracle implements hints by using specially-crafted comments in the query that begin with a + symbol, thus not affecting SQL compatibility.

  • Note above means practically the same "permission to ignore" since a database not supporting Oracle-specific hints will execute SQL statement without these.
Related Topic