Naming: best practices and constraints

Naming is often half-joking regarded as one of the top programming hard problems. Coding style guidelines for any language devote entire sections to the art of naming and for good reasons. Names convey meaning, intent, can make source code readable or hard to follow. But naming is not just about best practices. It’s also about constraints. From the basic ones, such as what constitutes a valid name, to how to avoid name conflicts.

In Logtalk and Prolog programming, what are we naming? Essentially, libraries, source files, objects, protocols, categories, modules, predicates, non-terminals, and variables. When using message printing and question asking mechanisms, we can also include and message and question terms.